diff options
author | Quentin Le Menez | 2018-03-11 16:28:18 +0000 |
---|---|---|
committer | Quentin Le Menez | 2018-03-11 22:39:35 +0000 |
commit | 6a85d3a05d3bd942dba8e71edf82e97dce813b91 (patch) | |
tree | c58695b63c497d3af16b69f1634d3eb2de0deb49 /plugins/developer/org.eclipse.papyrus.def | |
parent | ba98ab1ef4202d0489df0ae2dd2aee8fe6f378d4 (diff) | |
download | org.eclipse.papyrus-6a85d3a05d3bd942dba8e71edf82e97dce813b91.tar.gz org.eclipse.papyrus-6a85d3a05d3bd942dba8e71edf82e97dce813b91.tar.xz org.eclipse.papyrus-6a85d3a05d3bd942dba8e71edf82e97dce813b91.zip |
[Releng] [Photon] Delete old Dev framework and add a new Toolsmiths one
- Delete the old Dev releng profile and replace it with a Toolsmith one
- Add new features: Junit, Releng, Diagramgen and Debug to be released
- Move the junit framework at the root of the junit test folder
- Remove Toolsmiths from the main build as it will have its own
- Repopulate the SDK feature and distribute the excess features in theit own root parent
- Add a new views feature
- Moved the assistants to the toolsmiths folder and put them in the toolsmiths build
Change-Id: I1c0331b25607baaf1cfcc635d9c7b0d9c6d73e63
Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr>
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.def')
120 files changed, 0 insertions, 12565 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.def/.classpath b/plugins/developer/org.eclipse.papyrus.def/.classpath deleted file mode 100644 index 2b33b90779b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.classpath +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="xtend"/> - <classpathentry kind="src" path="xtend-gen"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/developer/org.eclipse.papyrus.def/.project b/plugins/developer/org.eclipse.papyrus.def/.project deleted file mode 100644 index 2d16d0466af..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.project +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.papyrus.def</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.xtext.ui.shared.xtextBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.openarchitectureware.base.oawBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.gmf.xpand.oawBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.gmf.xpand.xpandBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.xtend.shared.ui.xtendBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.oomph.version.VersionBuilder</name> - <arguments> - <dictionary> - <key>check.maven.pom</key> - <value>true</value> - </dictionary> - <dictionary> - <key>ignore.lower.bound.dependency.ranges</key> - <value>true</value> - </dictionary> - <dictionary> - <key>release.path</key> - <value>/org.eclipse.papyrus.releng.dev.release/release.xml</value> - </dictionary> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.m2e.core.maven2Builder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.m2e.core.maven2Nature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.openarchitectureware.base.oawNature</nature> - <nature>org.eclipse.xtend.shared.ui.xtendXPandNature</nature> - <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> - <nature>org.eclipse.oomph.version.VersionNature</nature> - <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> - </natures> -</projectDescription> diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index e10e3165bba..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -eclipse.preferences.version=1 -encoding/<project>=ISO-8859-1 -encoding/xtend=ISO-8859-1 diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.core.runtime.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d2a7..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.core.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 41b887bd50e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,292 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=260 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=260 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=tab -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true -org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.ui.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 954281dbc31..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,68 +0,0 @@ -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=false -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_functional_interfaces=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=false -cleanup.format_source_code=false -cleanup.format_source_code_changes_only=false -cleanup.insert_inferred_type_arguments=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=false -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=true -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_redundant_type_arguments=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_anonymous_class_creation=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_lambda=true -cleanup.use_parentheses_in_expressions=false -cleanup.use_this_for_non_static_field_access=false -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=false -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup.use_type_arguments=false -cleanup_profile=_Papyrus -cleanup_settings_version=2 -eclipse.preferences.version=1 -formatter_profile=_Papyrus -formatter_settings_version=12 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;org;com; -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.m2e.core.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb2..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.pde.api.tools.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index 23fb95e120f..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.pde.api.tools.prefs +++ /dev/null @@ -1,98 +0,0 @@ -ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error -ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error -ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error -API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error -API_USE_SCAN_FIELD_SEVERITY=Error -API_USE_SCAN_METHOD_SEVERITY=Error -API_USE_SCAN_TYPE_SEVERITY=Error -CLASS_ELEMENT_TYPE_ADDED_METHOD=Error -CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error -CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error -CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error -CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error -ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error -ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error -ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -FIELD_ELEMENT_TYPE_ADDED_VALUE=Error -FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error -FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error -FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error -FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error -ILLEGAL_EXTEND=Warning -ILLEGAL_IMPLEMENT=Warning -ILLEGAL_INSTANTIATE=Warning -ILLEGAL_OVERRIDE=Warning -ILLEGAL_REFERENCE=Warning -INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore -INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error -INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error -INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error -INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error -INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error -INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -INVALID_ANNOTATION=Ignore -INVALID_JAVADOC_TAG=Ignore -INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore -LEAK_EXTEND=Warning -LEAK_FIELD_DECL=Warning -LEAK_IMPLEMENT=Warning -LEAK_METHOD_PARAM=Warning -LEAK_METHOD_RETURN_TYPE=Warning -METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error -METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error -METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error -METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error -METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error -METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error -METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error -MISSING_EE_DESCRIPTIONS=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error -TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error -UNUSED_PROBLEM_FILTERS=Warning -automatically_removed_unused_problem_filters=Enabled -eclipse.preferences.version=1 -incompatible_api_component_version=Error -incompatible_api_component_version_include_major_without_breaking_change=Disabled -incompatible_api_component_version_include_minor_without_api_change=Disabled -invalid_since_tag_version=Error -malformed_since_tag=Error -missing_since_tag=Warning -report_api_breakage_when_major_version_incremented=Disabled -report_resolution_errors_api_component=Warning diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.core.Xtend.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.core.Xtend.prefs deleted file mode 100644 index df3c3c49d40..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.core.Xtend.prefs +++ /dev/null @@ -1,6 +0,0 @@ -//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.directory=xtend-gen -BuilderConfiguration.is_project_specific=true -eclipse.preferences.version=1 -outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true -outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false -outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true diff --git a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.shared.ui.prefs b/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.shared.ui.prefs deleted file mode 100644 index 89103792688..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/.settings/org.eclipse.xtend.shared.ui.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -metamodelContributor=org.eclipse.xtend.typesystem.emf.ui.EmfMetamodelContributor,org.eclipse.xtend.typesystem.uml2.ui.Uml2MetamodelContributor diff --git a/plugins/developer/org.eclipse.papyrus.def/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.def/META-INF/MANIFEST.MF deleted file mode 100644 index e14e7535af3..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/META-INF/MANIFEST.MF +++ /dev/null @@ -1,25 +0,0 @@ -Manifest-Version: 1.0 -Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)", - org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, - org.eclipse.emf.codegen.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, - org.eclipse.draw2d;bundle-version="[3.10.0,4.0.0)", - org.eclipse.gmf.runtime.notation;bundle-version="[1.8.0,2.0.0)", - org.eclipse.gmf.common;bundle-version="[1.3.0,2.0.0)";visibility:=reexport, - org.eclipse.gmf.validate;bundle-version="[1.2.0,2.0.0)", - org.eclipse.gmf.graphdef;bundle-version="[2.9.0,3.0.0)", - org.eclipse.xtext;bundle-version="[2.10.0,3.0.0)", - org.eclipse.xtext.builder;bundle-version="[2.10.0,3.0.0)", - org.eclipse.xtend.lib;bundle-version="[2.10.0,3.0.0)", - org.eclipse.gmf.codegen.xtend;bundle-version="[1.0.0,2.0.0)", - org.eclipse.papyrus.gmfgenextension;bundle-version="[2.0.0,3.0.0)", - org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0.0)", - org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)" -Bundle-Vendor: %providerName -Bundle-ClassPath: . -Bundle-Version: 1.3.0.qualifier -Bundle-Name: %pluginName -Bundle-Localization: plugin -Bundle-Activator: org.eclipse.gmf.codegen.util.DefaultActivator -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.eclipse.papyrus.def;singleton:=true -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 diff --git a/plugins/developer/org.eclipse.papyrus.def/about.html b/plugins/developer/org.eclipse.papyrus.def/about.html deleted file mode 100644 index 23506a4bae1..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/about.html +++ /dev/null @@ -1,26 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head> - - -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> -<title>About</title> -</head><body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 5, 2006</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> - -</body></html>
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/build.properties b/plugins/developer/org.eclipse.papyrus.def/build.properties deleted file mode 100644 index 057f0ec72ef..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -jars.compile.order=. -source.. = xtend/,\ - xtend-gen/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - about.html,\ - plugin.properties,\ - xtend/,\ - xtend-gen/ -src.includes = about.html diff --git a/plugins/developer/org.eclipse.papyrus.def/plugin.properties b/plugins/developer/org.eclipse.papyrus.def/plugin.properties deleted file mode 100644 index 76b9bbd92d7..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -################################################################################# -# 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 patrick.tessier@cea.fr - Initial API and implementation -################################################################################## -pluginName=Papyrus Templates Extension for GMF tooling -providerName=Eclipse Modeling Project diff --git a/plugins/developer/org.eclipse.papyrus.def/pom.xml b/plugins/developer/org.eclipse.papyrus.def/pom.xml deleted file mode 100644 index 02c8550e469..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>org.eclipse.papyrus.developer</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>0.0.1-SNAPSHOT</version> - </parent> - <artifactId>org.eclipse.papyrus.def</artifactId> - <groupId>org.eclipse.papyrus</groupId> - <version>1.3.0-SNAPSHOT</version> - <packaging>eclipse-plugin</packaging> - - <properties> - <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding> - </properties> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-clean-plugin</artifactId> - <configuration> - <filesets> - <fileset> - <directory>xtend-gen</directory> - <includes> - <include>**/*</include> - </includes> - <excludes> - <exclude>.gitignore</exclude> - </excludes> - </fileset> - </filesets> - </configuration> - </plugin> - <plugin> - <groupId>org.eclipse.xtend</groupId> - <artifactId>xtend-maven-plugin</artifactId> - <executions> - <execution> - <phase>generate-sources</phase> - <goals> - <goal>compile</goal> - </goals> - </execution> - </executions> - <configuration> - <outputDirectory>xtend-gen</outputDirectory> - <testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory> - <encoding>ISO-8859-1</encoding> - </configuration> - </plugin> - </plugins> - </build> -</project> diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/.gitignore b/plugins/developer/org.eclipse.papyrus.def/xtend-gen/.gitignore deleted file mode 100644 index c96a04f008e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend-gen/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend deleted file mode 100644 index cd724aac1d1..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ChildNodeLabelEditPart.xtend +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenChildLabelNode -import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView - -@Singleton class ChildNodeLabelEditPart extends diagram.editparts.ChildNodeLabelEditPart { - - - - override extendsList(GenChildLabelNode it) ''' -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» -extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» -«specifyInheritance(extendedObject as ExtendedGenView)» -«ENDFOR» -«««END: PapyrusGenCode -«ELSE» - extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart -«ENDIF» -''' - -//BEGIN: PapyrusGenCode -//definition of the inheritance -def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' -//END: PapyrusGenCode - -override implementsList(GenChildLabelNode it) '''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend deleted file mode 100644 index 1afae6e2876..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/CompartmentEditPart.xtend +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCompartment -import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView -import xpt.Common - -@Singleton class CompartmentEditPart extends diagram.editparts.CompartmentEditPart { - @Inject extension Common; - - override extendsList(GenCompartment it) ''' - -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» - extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» - «specifyInheritance(extendedObject as ExtendedGenView)» -«ENDFOR» -«««END: BEGIN: PapyrusGenCode -«ELSE» - extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.linklf.LinkLFShapeCompartmentEditPart«ENDIF» -«ENDIF» - ''' - - //BEGIN: PapyrusGenCode - //definition of the inheritance - def specifyInheritance(ExtendedGenView it) '''«superOwnedEditPart»''' - - //END: PapyrusGenCode - override additions(GenCompartment it) ''' - «handleSize(it)» - «refreshbound(it)» - «refreshvisual(it)» - ''' - - def handleSize(GenCompartment it) ''' - «generatedMemberComment» -protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification notification) { - Object feature = notification.getFeature(); - if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature) - || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature) - || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature) - || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { - refreshBounds(); - } - super.handleNotificationEvent(notification); - } -''' - - def refreshbound(GenCompartment it) ''' - «generatedMemberComment» - protected void refreshBounds() { - int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue(); - org.eclipse.draw2d.geometry.Dimension size = new org.eclipse.draw2d.geometry.Dimension(width, height); - int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - org.eclipse.draw2d.geometry.Point loc = new org.eclipse.draw2d.geometry.Point(x, y); - ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint( - this, - getFigure(), - new org.eclipse.draw2d.geometry.Rectangle(loc, size)); - } - ''' - - def refreshvisual(GenCompartment it) ''' - «generatedMemberComment» -protected void refreshVisuals() { - super.refreshVisuals(); - refreshBounds(); - } -''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend deleted file mode 100644 index a6e7c02d13d..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/DiagramEditPart.xtend +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -@Singleton class DiagramEditPart extends diagram.editparts.DiagramEditPart { - - @Inject aspects.impl.diagram.editparts.DiagramEditPart aspectDiagramEditPart; - - //BEGIN: PapyrusGenCode - //patches the super type of the diagram edit part in case the controlled object represents a UML element - override extendsList(GenDiagram it) '''extends «aspectDiagramEditPart.extendsListContents(it)»''' - //END: PapyrusGenCode -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend deleted file mode 100644 index 604015ede6b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/ExternalNodeLabelEditPart.xtend +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel -import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView -import org.eclipse.papyrus.papyrusgmfgenextension.LabelVisibilityPreference -import xpt.Common - -@Singleton class ExternalNodeLabelEditPart extends diagram.editparts.ExternalNodeLabelEditPart { - @Inject extension Common; - - override extendsList(GenExternalNodeLabel it) ''' - «««BEGIN: PapyrusGenCode - «««specify a java super class for external nodes - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v | v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» - extends «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» - «specifyInheritance(extendedObject as ExtendedGenView)» - «ENDFOR» - «««END: PapyrusGenCode - «ELSE» - extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart - «ENDIF» - ''' - - //we add the interface ILabelRoleProvider - override implementsList(GenExternalNodeLabel it) ''' - implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].size != 0» - , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider - «ENDIF» - ««« END: PapyrusGenCode - ''' - - override additions(GenExternalNodeLabel it) ''' - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].size != 0» - «generatedClassComment» - public String getLabelRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].head.role»";//$NON-NLS-1$ - } - - «generatedClassComment» - public String getIconPathRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v|v.externalNodeLabels.contains(it)].head.iconPathRole»";//$NON-NLS-1$ - } - «ENDIF» - ««« END: PapyrusGenCode - ''' - - def refreshBounds(GenExternalNodeLabel it) ''' - ««« BEGIN: PapyrusGenCode - public void refreshBounds() { - int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue(); - getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height)); - getBorderItemLocator().relocate(getFigure()); - } - ««« END: PapyrusGenCode - ''' - - //BEGIN: PapyrusGenCode - //definition of the inheritance - def specifyInheritance(ExtendedGenView it) '''«superOwnedEditPart»''' - -//END: PapyrusGenCode -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend deleted file mode 100644 index 5875e8c2c64..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkEditPart.xtend +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenLink - -@Singleton class LinkEditPart extends diagram.editparts.LinkEditPart { - @Inject aspects.impl.diagram.editparts.LinkEditPart aspectsLinkEditPart; - - - -//BEGIN: PapyrusGenCode -//patches the super type of the link edit part in case the controlled object represents a UML element -override extendsList(GenLink it) '''extends «aspectsLinkEditPart.extendsListContents(it)»''' -//END: PapyrusGenCode - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend deleted file mode 100644 index e4866434ac2..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/LinkLabelEditPart.xtend +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.CustomBehaviour -import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel -import org.eclipse.papyrus.papyrusgmfgenextension.LabelVisibilityPreference -import xpt.Common - -@Singleton class LinkLabelEditPart extends diagram.editparts.LinkLabelEditPart{ - @Inject extension Common; - - - override implementsList(GenLinkLabel it) ''' - implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].size != 0» - , org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider - «ENDIF» - ««« END: PapyrusGenCode - ''' - - - override additions(GenLinkLabel it) ''' - ««« BEGIN: PapyrusGenCode - «IF it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.linkLabels.contains(it)].size != 0» - «generatedClassComment» - public String getLabelRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].head.role»";//$NON-NLS-1$ - } - - «generatedClassComment» - public String getIconPathRole(){ - return "«it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v |v.linkLabels.contains(it)].head.iconPathRole»";//$NON-NLS-1$ - } - «ENDIF» - ««« END: PapyrusGenCode - ''' - - override extendsList(GenLinkLabel it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart''' - - override createDefaultEditPolicies(GenLinkLabel it) ''' - /** - * @generated Papyrus Generation - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy()); - installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE, new «diagram.getTextSelectionEditPolicyQualifiedClassName()»()); - ««« BEGIN: PapyrusGenCode - installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy()); - ««« END: PapyrusGenCode - ««« Get the added custom behavoir - «FOR CustomBehaviour:it.behaviour.filter(typeof (CustomBehaviour))» - installEditPolicy(«CustomBehaviour.key», new «CustomBehaviour.editPolicyQualifiedClassName»()); - «ENDFOR» - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend deleted file mode 100644 index d79b500c2ae..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeEditPart.xtend +++ /dev/null @@ -1,112 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNode -import xpt.Common -import xpt.diagram.editparts.Utils_qvto - -//DOCUMENTATION: PapyrusGenCode -//add call template in order to generate handlenotification in order to refresh figure by taking account event - -@Singleton class NodeEditPart extends diagram.editparts.NodeEditPart { - @Inject extension Common; - @Inject extension Utils_qvto; - - @Inject impl.diagram.editparts.NodeEditPart xptNodeEditPartImpl; - @Inject aspects.impl.diagram.editparts.NodeEditPart aspectsNodeEditPartImpl; - - - - override Main(GenNode it) ''' - «copyright(diagram.editorGen)» - package «xptNodeEditPartImpl.packageName(it)»; - - «generatedClassComment» - public class «xptNodeEditPartImpl.className(it)» «extendsList(it)» «implementsList(it)» { - - «attributes(it)» - - «xptNodeEditPartImpl.constructor(it)» - - «createDefaultEditPolicies(it)» - - «xptNodeEditPartImpl.createLayoutEditPolicy(it)» - -««« BEGIN: PapyrusGenCode -««« call tamplate to paste code for refresh figure by taking account event - «aspectsNodeEditPartImpl.specificHandleNotificationEvent(it)» -««« END: PapyrusGenCode - - «xptNodeEditPartImpl.createNodeShape(it.viewmap, it)» - - «IF hasFixedChildren(it)» - «xptNodeEditPartImpl.addFixedChild(it)» - - «xptNodeEditPartImpl.removeFixedChild(it)» - - «xptNodeEditPartImpl.addChildVisual(it)» - - «xptNodeEditPartImpl.removeChildVisual(it)» - - «xptNodeEditPartImpl.getContentPaneFor(it)» - «ENDIF» - - «xptNodeEditPartImpl.addBorderItem(it)» - - «xptNodeEditPartImpl.createNodePlate(it)» - - «xptNodeEditPartImpl.getPrimaryDragEditPolicy(it)» - - «xptNodeEditPartImpl.createFigure(it)» - - «xptNodeEditPartImpl.setupContentPane(it)» - - «xptNodeEditPartImpl.getContentPane(it)» - - «xptNodeEditPartImpl.setForegroundColor(it)» - -««« «xptNodeEditPartImpl.setBackgroundColor(it)» - - «xptNodeEditPartImpl.setLineWidth(it)» - - «xptNodeEditPartImpl.setLineStyle(it)» - - «xptNodeEditPartImpl.getPrimaryChildEditPart(it)» - - - - «IF hasChildrenInListCompartments(it)» - «xptNodeEditPartImpl.getTargetEditPartMethod(it)» - «ENDIF» - - «handleNotificationEvent(it)» - - «xptNodeEditPartImpl.innerClassDeclaration(viewmap)» - - «additions(it)» - } - ''' - - //BEGIN: PapyrusGenCode - //patches the super type of the node edit part in case the controlled object represents a UML element - override extendsList (GenNode it)''' extends «aspectsNodeEditPartImpl.extendsListContents(it)»''' - //END: PapyrusGenCode - - // override additions(GenNode it) ''' - // «aspectsNodeEditPartImpl.genPreferredValue(it)» - // ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend deleted file mode 100644 index effa52d178c..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/diagram/editparts/NodeLabelEditPart.xtend +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNodeLabel -import xpt.Common - -//DOCUMENTATION: PapyrusGenCode -//add in the addition codes in order to refresh the labels -@Singleton class NodeLabelEditPart extends diagram.editparts.NodeLabelEditPart { - @Inject extension Common; - - @Inject impl.diagram.editparts.NodeLabelEditPart xptNodeLabelEditPart; - -override implementsList(GenNodeLabel it)'''implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit''' - -//BEGIN: PapyrusGenCode -//Definition of the inheritance -override extendsList (GenNodeLabel it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart''' -//END: PapyrusGenCode - - override handleNotificationEvent(GenNodeLabel it) ''' - «generatedMemberComment» - protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) { - refreshLabel(); - «xptNodeLabelEditPart.handleNotificationEventBody(it)» - } - ''' - - override additions(GenNodeLabel it) ''' - ««« Code to refresh icon - - «generatedMemberComment» - private static final String ADD_PARENT_MODEL = "AddParentModel"; - - - «generatedMemberComment» - public void activate() { - super.activate(); - addOwnerElementListeners(); - } - - «generatedMemberComment» - protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((org.eclipse.gmf.runtime.notation.View) getParent().getModel())); - - } - - «generatedMemberComment» - public void deactivate() { - removeOwnerElementListeners(); - super.deactivate(); - - } - - - «generatedMemberComment» - protected void removeOwnerElementListeners() { - removeListenerFilter(ADD_PARENT_MODEL); - - } - - «««END: PapyrusGenCode - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/actions/LoadResourceAction.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/actions/LoadResourceAction.xtend deleted file mode 100755 index 5b903b1d792..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/actions/LoadResourceAction.xtend +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation - *****************************************************************************/ -package aspects.impl.actions - -import com.google.inject.Singleton - -@Singleton class LoadResourceAction extends impl.actions.LoadResourceAction{ - - override def extendsList(org.eclipse.gmf.codegen.gmfgen.LoadResourceAction it) // - ''' extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.actions.DefaultLoadResourceAction''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend deleted file mode 100644 index aab60587751..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChildNodeLabelEditPart.xtend +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenChildLabelNode -import xpt.diagram.editparts.Common - -/** - * Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class? - */ -@Singleton class ChildNodeLabelEditPart extends impl.diagram.editparts.ChildNodeLabelEditPart { - @Inject extension Common; - - - override handleNotificationEventBody(GenChildLabelNode it) ''' - Object feature = event.getFeature(); - «handleText(it)» - «IF labelElementIcon» - if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){ - refreshLabel(); - } - «ENDIF» - if (org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature)) { - refreshUnderline(); - } - super.handleNotificationEvent(event); - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChoiceUtils_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChoiceUtils_qvto.xtend deleted file mode 100644 index 38e0ccecec7..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ChoiceUtils_qvto.xtend +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (c) 2011 - 2013 Montages AG - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Svyatoslav Kovalsky (Montages) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.LabelModelFacet -import org.eclipse.gmf.codegen.gmfgen.OclChoiceParser -import org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser -import xpt.Common_qvto - -@Singleton class ChoiceUtils_qvto extends impl.diagram.editparts.ChoiceUtils_qvto { - @Inject extension Common_qvto - - override boolean isChoiceLabel(LabelModelFacet modelFacet) { - var parser = modelFacet.parser; - if (parser != null) { - return parser.oclIsKindOf(typeof(PredefinedEnumParser)) || parser.oclIsKindOf(typeof(OclChoiceParser)); - } else { - return false; - } - } -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend deleted file mode 100644 index 8ec2edaf53e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/CompartmentEditPart.xtend +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2006, 2009 Borland Software Corporation - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCompartment -import xpt.diagram.editparts.Common -import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView - -//DOCUMENTATION: PapyrusGenCode -//Overload only the creation of editPolicies in order to add the paste edit policy -@Singleton class CompartmentEditPart extends impl.diagram.editparts.CompartmentEditPart { - @Inject extension xpt.Common; - @Inject Common xptEditpartsCommon; - - - - override createDefaultEditPoliciesBody(GenCompartment it) ''' - super.createDefaultEditPolicies(); - «IF canCollapse» - installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy()); - «ENDIF» - «xptEditpartsCommon.installSemanticEditPolicy(it)» - «IF ! childNodes.empty» - installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy()); - installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy()); - installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy()); - «ENDIF» - «xptEditpartsCommon.installCanonicalEditPolicy(it)» - «xptEditpartsCommon.behaviour(it)» - ''' - - override getTargetEditPartMethod(GenCompartment it) ''' - «generatedMemberComment» - public org.eclipse.gef.EditPart getTargetEditPart(org.eclipse.gef.Request request) { - - return super.getTargetEditPart(request); - } - ''' - - override createFigure(GenCompartment it) { - if (hasExternalSuperClass(it,'org.eclipse.papyrus.uml.diagram.activity.edit.part.ShapeCompartmentWithoutScrollbarsEditPart')) { - ''' - @Override - public org.eclipse.draw2d.IFigure createFigure() { - return super.createFigure(); - } - ''' - } else { - super.createFigure(it); - } - } - - def boolean hasExternalSuperClass(GenCompartment it, String className) { - return it.eResource.allContents.filter(typeof(ExtendedGenView)).filter [v | (v.genView.contains(it) && v.superOwnedEditPart.equals(className))].size > 0; - } -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend deleted file mode 100644 index 44075206b8b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/DiagramEditPart.xtend +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenNode -import xpt.diagram.commands.CreateShortcutDecorationsCommand -import xpt.diagram.editparts.Common -import xpt.diagram.editparts.Utils_qvto - -/** - * Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class? - */ -//DOCUMENTATION: PapyrusGencode -//This template has been modify to allow the drag and drop -@Singleton class DiagramEditPart extends impl.diagram.editparts.DiagramEditPart { - @Inject extension MetaModel; - @Inject extension Utils_qvto; - - @Inject Common xptEditpartsCommon; - @Inject CreateShortcutDecorationsCommand createShoutrtcutDecorationCommand; - -//BEGIN: PapyrusGenCode -//computes super type of the link edit part in case the edit part manages a representation of a UML element -def extendsListContents(GenDiagram it)''' -org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart -''' -//END: BEGIN: PapyrusGenCode - -override createDefaultEditPoliciesBody(GenDiagram it) ''' - super.createDefaultEditPolicies(); - - installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy()); - installEditPolicy(org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy.PASTE_ROLE, new org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy()); - - «xptEditpartsCommon.installSemanticEditPolicy(it)» - «xptEditpartsCommon.installCanonicalEditPolicy(it)» - ««« «xptEditpartsCommon.installCreationEditPolicy(it)» - «IF generateCreateShortcutAction() && null == editorGen.application» - installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() { - public org.eclipse.gef.commands.Command getDropObjectsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest) { - java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors = new java.util.ArrayList<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor>(); - for (java.util.Iterator<?> it = dropRequest.getObjects().iterator(); it.hasNext();) { - Object nextObject = it.next(); - if (false == nextObject instanceof org.eclipse.emf.ecore.EObject) { - continue; - } - viewDescriptors.add(new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter((org.eclipse.emf.ecore.EObject) nextObject), org.eclipse.gmf.runtime.notation.Node.class, null, getDiagramPreferencesHint())); - } - return createShortcutsCommand(dropRequest, viewDescriptors); - } - - private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, java.util.List<org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor> viewDescriptors) { - org.eclipse.gef.commands.Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors); - if (command != null) { - return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «createShoutrtcutDecorationCommand.qualifiedClassName(it)»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors))); - } - return null; - } - }); - «ENDIF» - «IF shouldGenerateDiagramViewmap(it)» - // diagram figure does layout; need to install child editpolicy to show selection feedback - installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) { - final org.eclipse.gef.editpolicies.NonResizableEditPolicy p = new org.eclipse.gef.editpolicies.NonResizableEditPolicy(); - p.setDragAllowed(false); - return p; - } - protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) { - return null; - } - protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) { - return null; - } - }); - «ENDIF» - «xptEditpartsCommon.behaviour(it)» - // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE); -''' - -def featureForMetaclass (GenNode it)''' - if (« MetaClass(modelFacet.metaClass)».equals(class1)) { - return «MetaFeature(modelFacet.containmentMetaFeature)»; - } -''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend deleted file mode 100644 index a2dec74c795..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/ExternalNodeLabelEditPart.xtend +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014 CEA LIST and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ - -package aspects.impl.diagram.editparts - -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel - -/** - * @author Mickael ADAM - * - */ -class ExternalNodeLabelEditPart extends impl.diagram.editparts.ExternalNodeLabelEditPart { - - override additionalEditPolicies(GenExternalNodeLabel it){ - ''' - installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy()); - ''' - } - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend deleted file mode 100644 index 5fd8ade4588..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkEditPart.xtend +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Remi Schnekenburger (CEA LIST) - modification for Papyrus MDT - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.ModeledViewmap -import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView -import xpt.Common - -/** - * Revisit: [MG]: @Inject extension same-named-api-class -> template extends api-class? - */ -@Singleton class LinkEditPart extends impl.diagram.editparts.LinkEditPart { - @Inject extension Common; - - - //BEGIN: PapyrusGenCode - //computes super type of the link edit part in case the edit part manages a representation of a UML element - def extendsListContents(GenLink it)''' - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |(v.genView.contains(it) && v.superOwnedEditPart!=null)].size != 0» - «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |(v.genView.contains(it) && v.superOwnedEditPart!=null)].toIterable» - «specifyInheritance(extendedObject)» - «ENDFOR» - «ELSE» - org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart - «ENDIF» - ''' - //END: BEGIN: PapyrusGenCode - - //BEGIN: PapyrusGenCode - //definition of the inheritance - def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' - //END: PapyrusGenCode - - override addFixedChild (GenLink it)''' - «IF labels.size > 0» - «generatedMemberComment» - protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) { - «FOR label : labels» - «addLabel(label.viewmap,label)» - «ENDFOR» - return false; - } - «ENDIF» -''' - - override removeFixedChild(GenLink it) ''' - «IF ! labels.empty» - «generatedMemberComment» - protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) { - «FOR label : labels» - «removeLabel(label.viewmap, label)» - «ENDFOR» - return false; - } - «ENDIF» - ''' - - override addChildVisual(GenLink it) ''' - «IF ! labels.empty» - «generatedMemberComment» - protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - «ENDIF» - ''' - - override removeChildVisual(GenLink it) ''' - «IF ! labels.empty» - «generatedMemberComment» - protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - «ENDIF» - ''' - - override dispatch createLinkFigure(ModeledViewmap it, GenLink link) ''' -««« «generatedMemberComment» -««« protected org.eclipse.draw2d.Connection createConnectionFigure() { -««« return new «modeledViewmapFigureFQN(it)»(); -««« } -««« -««« «generatedMemberComment» -««« public «modeledViewmapFigureFQN(it)» getPrimaryShape() { -««« return («modeledViewmapFigureFQN(it)») getFigure(); -««« } -««« -««« «xptModeledViewmapProducer.viewmapClassBody(it)» - ''' - - override modeledViewmapFigureFQN(ModeledViewmap it) ''' -««« «xptModeledViewmapProducer.viewmapFigureFQN(it)» - ''' - -} - - - diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend deleted file mode 100644 index 6c1be9c56b0..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/LinkLabelEditPart.xtend +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Thibault Landre (Atos Origin) - initial API and implementation - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel -import xpt.diagram.editparts.Common - -//DOCUMENTATION: PapyrusGencode -//Overlaod only the method handlenotificationEventBody - -@Singleton class LinkLabelEditPart extends impl.diagram.editparts.LinkLabelEditPart { - @Inject extension Common; - - override handleNotificationEventBody(GenLinkLabel it) ''' - Object feature = event.getFeature(); - «handleText (it)» - - ««« START Papyrus Code - «IF elementIcon» - if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){ - refreshLabel(); - } - «ENDIF» - ««« End Papyrus Code - super.handleNotificationEvent(event); - ''' - - override additionalEditPolicies(GenLinkLabel it) - ''' - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy()); - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend deleted file mode 100644 index 78cc989408a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeEditPart.xtend +++ /dev/null @@ -1,489 +0,0 @@ -/** - * Copyright (c) 2006, 2014 Borland Software Corporation, 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Patrick Tessier (CEA) - initial API and implementation - * Thibault Landre (Atos Origin) - initial API and implementation - * Vincent Lorenzo (CEA-LIST) - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels - * Christian W. Damus - bug 451230 - */ -package aspects.impl.diagram.editparts - -import aspects.xpt.editor.VisualIDRegistry -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenChildSideAffixedNode -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel -import org.eclipse.gmf.codegen.gmfgen.GenNavigatorChildReference -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.ParentAssignedViewmap -import org.eclipse.gmf.codegen.gmfgen.ToolEntry -import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView -import org.eclipse.papyrus.papyrusgmfgenextension.PropertyRefreshHook -import org.eclipse.papyrus.papyrusgmfgenextension.SpecificLocator -import utils.EditPartsUtils_qvto -import xpt.Common -import xpt.diagram.editparts.EditPartFactory -import xpt.diagram.editparts.Utils_qvto -import xpt.CodeStyle -import xpt.diagram.ViewmapAttributesUtils_qvto -import org.eclipse.papyrus.papyrusgmfgenextension.SpecificNodePlate -import xpt.providers.ElementTypes - -@Singleton class NodeEditPart extends impl.diagram.editparts.NodeEditPart { - @Inject extension Common; - @Inject extension CodeStyle - - @Inject extension EditPartsUtils_qvto; - @Inject extension VisualIDRegistry; - - @Inject extension ViewmapAttributesUtils_qvto; - - @Inject extension Utils_qvto; - @Inject extension xpt.diagram.Utils_qvto; - @Inject EditPartFactory xptEditPartFactory; - @Inject impl.diagram.editparts.TextAware xptTextAware; - - @Inject VisualIDRegistry xptVisualIDRegistry; - @Inject ElementTypes xptElementTypes; - -//--------- -// GMF -//--------- - - override dispatch extendsListContents (GenNode it)''' -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» -«FOR extendedObject : it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» -«specifyInheritance(extendedObject as ExtendedGenView)» -«ENDFOR» -«««END: BEGIN: PapyrusGenCode -«ELSE» - org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart -«ENDIF» -''' - -override dispatch extendsListContents (GenChildSideAffixedNode it)''' -«««BEGIN: PapyrusGenCode -«««Add own extension -«IF it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].size != 0» -«FOR extendedObject : it.eResource.allContents.filter(typeof(ExtendedGenView)).filter[v |v.genView.contains(it) && v.superOwnedEditPart!=null].toIterable» -«specifyInheritance(extendedObject)» -«ENDFOR» -«««END: BEGIN: PapyrusGenCode -«ELSE» - «IF hasBorderItems(it)»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF» -«ENDIF» -''' -override addFixedChild (GenNode it)''' - «generatedMemberComment» - protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) { -«FOR label:getInnerFixedLabels(it)»«var childViewmap = label.viewmap as ParentAssignedViewmap» - if (childEditPart instanceof «xptEditPartFactory.getEditPartQualifiedClassName(label)») { - ((«xptEditPartFactory.getEditPartQualifiedClassName(label)») childEditPart).«xptTextAware.labelSetterName(childViewmap)»(getPrimaryShape().«childViewmap.getterName»()); - return true; - } -«ENDFOR» - -«FOR compartment : getPinnedCompartments(it)»«var childViewmap = compartment.viewmap as ParentAssignedViewmap» - - if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») { - org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»(); - setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way - pane.add(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure()); - return true; - } -«ENDFOR» - -«FOR child:getSideAffixedChildren(it)» - ««« BEGIN PapyrusGencode - ««« adding IF else end in order to take in account the case where a specific locator is added - - - «IF it.eResource.allContents.filter(typeof (SpecificLocator)).filter[v | v.genChildSideAffixedNode.contains(child)].size !=0» - «FOR extendedObject : it.eResource.allContents.filter(typeof (SpecificLocator)).filter[v |v.genChildSideAffixedNode.contains(child)].toIterable» - «genSpecificLocator(extendedObject,child)» - «ENDFOR» - - «ELSE» - «««END PapyrusGencode«ENDREM - if (childEditPart instanceof «child.getEditPartQualifiedClassName()») { - org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»); - getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator); - return true; - } - ««« BEGIN PapyrusGencode - «ENDIF» - «««END PapyrusGencode -«ENDFOR» - return false; - } -''' - - override installGraphicalNodeEditPolicy(GenNode it) ''' - - installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy()); - - ''' - - override def setLineWidth(GenNode it) ''' - «generatedMemberComment» - protected void setLineWidth(int width) { -««« if (primaryShape instanceof org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) { -««« ((org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure) primaryShape).setLineWidth(«IF getDiagram().isPixelMapMode()»width«ELSE»getMapMode().DPtoLP(width)«ENDIF»); -««« } - super.setLineWidth(width); - } - ''' - - override def setLineStyle(GenNode it) ''' - «generatedMemberComment» - protected void setLineType(int style) { - if (primaryShape instanceof org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) { - ((org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure) primaryShape).setLineStyle(style); - } - } - ''' - - override createFigure(GenNode it) ''' - «generatedMemberComment( - 'Creates figure for this edit part.\n' + - '\n' + - 'Body of this method does not depend on settings in generation model\n' + - 'so you may safely remove <i>generated</i> tag and modify it.\n' - )» - protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure create«IF hasBorderItems(it)»Main«ELSE»Node«ENDIF»Figure() { - «IF it instanceof GenChildSideAffixedNode» - org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new org.eclipse.draw2d.StackLayout()); - org.eclipse.draw2d.IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - «ELSE» - return new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure(createMainFigureWithSVG()); - «ENDIF» - - } - ''' - -// override createNodePlate (GenNode it)''' -// «generatedMemberComment» -// protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() { -// String prefElementId="«elementType.displayName»"; -// org.eclipse.jface.preference.IPreferenceStore store =«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(); -// String preferenceConstantWitdh=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.WIDTH); -// String preferenceConstantHeight=org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.HEIGHT); -// org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result = new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); -// -// «setupNodePlate(it)» -// return result; -// } -// ''' - - override createNodePlate(GenNode it) ''' - «generatedMemberComment» - «IF it.eResource.allContents.filter(typeof(SpecificNodePlate)).filter[v |v.editParts.contains(it) && v.nodePlateQualifiedName!=null].size != 0» - «val editPart = it.eResource.allContents.filter(typeof(SpecificNodePlate)).filter[v |v.editParts.contains(it) && v.nodePlateQualifiedName!=null].head» - protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() { - «editPart.nodePlateQualifiedName» result = new «editPart.nodePlateQualifiedName»(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»); - «setupNodePlate» - return result; - } - «««END: BEGIN: PapyrusGenCode - «ELSE» - ««« «super.createNodePlate(it)» - ««« By default node edit part are now RoundedRectangleNodePlateFigure - protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() { - org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure result = new org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure(«IF getDiagram().isPixelMapMode()»«defaultSizeWidth(viewmap, 40)», «defaultSizeHeight(viewmap, 40)»«ELSE»getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»)«ENDIF»); - «setupNodePlate» - return result; - } - «ENDIF» - ''' - -override borderItemSelectionEditPolicy(GenNode it)''' - «IF hasBorderItems(it)» - org.eclipse.gmf.runtime.notation.View childView = (org.eclipse.gmf.runtime.notation.View) child.getModel(); - String vid = «getVisualIDMethodCall(getDiagram())»(childView); - if (vid != null) { - switch (vid) { - «IF getExternalLabels(it).size > 0» - «FOR nextLabel : getExternalLabels(it) » - «caseVisualID(nextLabel)» - «ENDFOR» - return «borderItemSelectionEP(it)»; - «ENDIF» - «IF getSideAffixedChildren(it).size > 0» - «FOR nextBorderItem : getSideAffixedChildren(it)» - «caseVisualID(nextBorderItem)» - «ENDFOR» - ««« BEGIN PapyrusGenCode - ««« The purprose is to add replace GMF edit prolicy by an new editPolicy that allows to resize BorderItem - return new org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy(); - ««« END PapyrusGenCode - «ENDIF» - } - } -«ENDIF» -''' - - override createLayoutEditPolicyBody_FLOW_LAYOUT(GenNode it) ''' - org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.FlowLayoutEditPolicy() { - «IF hasBorderItems(it)» - «extraLineBreak» - «overrideC» - protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) { - «borderItemSelectionEditPolicy()» - return super.createChildEditPolicy(child); - } - «ENDIF» - - «overrideC» - protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) { - return null; - } - - «overrideC» - protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) { - return null; - } - - «overrideC» - protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) { - return null; - } - }; - return lep; - ''' - - override createLayoutEditPolicyBody_DEFAULT(GenNode it) ''' - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - «overrideC» - protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) { - «borderItemSelectionEditPolicy(it)» - org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new org.eclipse.gef.editpolicies.NonResizableEditPolicy(); - } - return result; - } - - «overrideC» - protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) { - return null; - } - - «overrideC» - protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) { - return null; - } - }; - return lep; - ''' - -//--------- -// PAPYRUS -//--------- - -//BEGIN: PapyrusGenCode -//definition of the inheritance -def specifyInheritance (ExtendedGenView it)'''«superOwnedEditPart»''' -//END: PapyrusGenCode - - -def genSpecificLocator(GenCommonBase it, GenChildSideAffixedNode child) '''''' - -def genSpecificLocator(ToolEntry it, GenChildSideAffixedNode child) '''''' - -def genSpecificLocator(GenNavigatorChildReference it,GenChildSideAffixedNode child)'''''' - -def genSpecificLocator(SpecificLocator it, GenChildSideAffixedNode child)''' -//Papyrus Gencode :«it.comment» - if (childEditPart instanceof «child.getEditPartQualifiedClassName()») { - org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «it.classpath»(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»); - getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator); - return true; - } - -''' - - override def borderItemSelectionEP(GenNode it) ''' - new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy() { - - «overrideC» - protected java.util.List<?> createSelectionHandles() { - org.eclipse.gef.handles.MoveHandle mh = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost()); - mh.setBorder(null); - return java.util.Collections.singletonList(mh); - } - } - ''' - -//BEGIN PapyrusGencode -//Overwrite an existing method to set the preference value in the editpart -//def genPreferredValue (GenNode it)''' -// -// «generatedMemberComment» -// @Override -// public Object getPreferredValue(org.eclipse.emf.ecore.EStructuralFeature feature) { -// org.eclipse.jface.preference.IPreferenceStore preferenceStore = (org.eclipse.jface.preference.IPreferenceStore) getDiagramPreferencesHint() -// .getPreferenceStore(); -// Object result = null; -// -// if(feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFontStyle_FontColor() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFillStyle_FillColor()){ -// String prefColor = null; -// if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor()) { -// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE); -// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFontStyle_FontColor()) { -// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FONT); -// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFillStyle_FillColor()) { -// prefColor = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL); -// } -// result = org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities -// .RGBToInteger(org.eclipse.jface.preference.PreferenceConverter -// .getColor( -// (org.eclipse.jface.preference.IPreferenceStore) preferenceStore, prefColor)); -// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFillStyle_Transparency() || feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFillStyle_Gradient()) { -// String prefGradient = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant("«elementType.displayName»", org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT); -// org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter( -// preferenceStore.getString(prefGradient)); -// if(feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFillStyle_Transparency()){ -// result = new Integer(gradientPreferenceConverter -// .getTransparency()); -// } else if (feature == org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE -// .getFillStyle_Gradient()){ -// result = gradientPreferenceConverter.getGradientData(); -// } -// } -// -// if(result == null){ -// result = getStructuralFeatureValue(feature); -// } -// return result; -// } -//''' -//END PapyrusGencode - -//BEGIN: PapyrusGenCode -//CreateGenerator to refresh figure by taking account of event of UML element or graphical element -def specificHandleNotificationEvent (GenNode it) ''' - - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it)].size != 0» - /** - *Papyrus codeGen - *@generated - **/ - protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) { - «IF it.labels.filter(typeof(GenExternalNodeLabel)).size != 0» - /* - * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart - * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! - */ - if(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { - Object notifier = event.getNotifier(); - java.util.List<?> modelChildren = ((org.eclipse.gmf.runtime.notation.View)getModel()).getChildren(); - if (false == notifier instanceof org.eclipse.gmf.runtime.notation.Edge - ««« see Bug 463769 - && false == notifier instanceof org.eclipse.gmf.runtime.notation.BasicCompartment) { - if(modelChildren.contains(event.getNotifier())) { - return; - } - } - } - «ENDIF» - super.handleNotificationEvent(event); - «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v |v.genView.contains(it)].toIterable» - «IF extendedObject.propRefreshHook !=null» - «specificHandleNotificationEventBody(extendedObject.propRefreshHook)» - «ENDIF» - «ENDFOR» - - } - «ENDIF» - -''' - -def specificHandleNotificationEventBody(PropertyRefreshHook it)''' -«IF (it.comment !=null)» -//«it.comment» -«ENDIF» -if (resolveSemanticElement() != null) { -if(«it.triggeringCondition»){ - «it.action»; - refreshVisuals(); -} -} -''' -//END: PapyrusGenCode - -override addBorderItem (GenNode it)''' - «IF getExternalLabels(it).size > 0» - «generatedMemberComment» - protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) { - «IF getExternalLabelsWithoutSpecificLocator(it).size > 0» - if («FOR label : getExternalLabelsWithoutSpecificLocator(it) SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOR») { - org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.SOUTH); - locator.setBorderItemOffset(new org.eclipse.draw2d.geometry.Dimension(-20, -20)); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - } else - «ENDIF» - «FOR label : getExternalLabelsWithSpecificLocator(it)» - if (borderItemEditPart instanceof «label.getEditPartQualifiedClassName()») { - org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator locator = new «getSpecificLocator(label)»(getMainFigure()); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - } else - «ENDFOR» - { - super.addBorderItem(borderItemContainer, borderItemEditPart); - } - } - «ENDIF» -''' - -override setupNodePlate (GenNode it) '''''' - -def setupNodePlate (GenChildSideAffixedNode it)''' - //FIXME: workaround for #154536 - result.getBounds().setSize(result.getPreferredSize()); -''' - -override def getTargetEditPartMethod(GenNode it) ''' - «generatedMemberComment» - public org.eclipse.gef.EditPart getTargetEditPart(org.eclipse.gef.Request request) { - if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) { - org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter adapter = ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - org.eclipse.gmf.runtime.emf.type.core.IElementType type = (org.eclipse.gmf.runtime.emf.type.core.IElementType) adapter.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class); - «FOR compartment : compartments» - «IF listCompartmentHasChildren(compartment)» - «FOR childNode : compartment.childNodes» - if («xptElementTypes.className(it.diagram)».isKindOf(type, «xptElementTypes.accessElementType(childNode)»)) { - return getChildBySemanticHint(«xptVisualIDRegistry.typeMethodCall(compartment)»); - } - «ENDFOR» - «ENDIF» - «ENDFOR» - } - return super.getTargetEditPart(request); - } -''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend deleted file mode 100644 index 5e0d1cb8524..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/NodeLabelEditPart.xtend +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Thibault Landre (Atos Origin) - initial API and implementation - * Benoit Maggi (CEA LIST) -#510281 change dependency to replace gmft-runtime - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNodeLabel -import xpt.diagram.editparts.Common -import xpt.diagram.editparts.Utils_qvto -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -@Singleton class NodeLabelEditPart extends impl.diagram.editparts.NodeLabelEditPart { - @Inject extension Utils_qvto; - - @Inject Common xptEditpartsCommon; - - override def nodeLabelDragPolicyQualifiedClassName(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy''' - - - override handleNotificationEventBody(GenNodeLabel it) ''' - Object feature = event.getFeature(); - «IF isStoringChildPositions(node)» - «xptEditpartsCommon.handleBounds(it)» - «ENDIF» - «xptEditpartsCommon.handleText(it)» - ««« START Papyrus Code - «IF elementIcon» - if(event.getNewValue() instanceof org.eclipse.emf.ecore.EAnnotation && org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((org.eclipse.emf.ecore.EAnnotation)event.getNewValue()).getSource())){ - refreshLabel(); - } - «ENDIF» - ««« End Papyrus Code - super.handleNotificationEvent(event); - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend deleted file mode 100644 index 6dc08068748..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/editparts/TextAware.xtend +++ /dev/null @@ -1,826 +0,0 @@ -/** - * Copyright (c) 2006-2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.DesignLabelModelFacet -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel -import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel -import org.eclipse.gmf.codegen.gmfgen.LabelModelFacet -import org.eclipse.gmf.codegen.gmfgen.ParentAssignedViewmap -import org.eclipse.gmf.codegen.gmfgen.Viewmap -import xpt.CodeStyle -import xpt.Common -import xpt.Common_qvto -import xpt.diagram.ViewmapAttributesUtils_qvto -import xpt.providers.ElementTypes - -//DOCUMENTATION: PapyrusGencode -//This template has been modified to take in account the possibility to have extended direct editors - -@Singleton class TextAware extends impl.diagram.editparts.TextAware { - @Inject extension Common - - @Inject extension CodeStyle - - @Inject extension ViewmapAttributesUtils_qvto - - @Inject extension Common_qvto - - @Inject ElementTypes xptElementTypes; - - override fields(GenCommonBase it)''' - «generatedMemberComment» - private org.eclipse.gef.tools.DirectEditManager manager; - - «generatedMemberComment» - private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser; - - «generatedMemberComment» - private java.util.List<?> parserElements; - - «generatedMemberComment» - private String defaultText; - - ««« BEGIN: PapyrusGenCode - ««« Add attributes to manage extended editors - «generatedMemberComment('direct edition mode (default, undefined, registered editor, etc.)')» - protected int directEditionMode = org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - «generatedMemberComment('configuration from a registered edit dialog')» - protected org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration configuration; - ««« END: BEGIN: PapyrusGenCode - -''' - override methods(GenCommonBase it, boolean needsRefreshBounds, boolean readOnly, boolean useElementIcon, Viewmap viewmap, - LabelModelFacet modelFacet, GenCommonBase host, GenDiagram diagram) ''' - - «getLabelTextHelper(it)» - - «setLabelTextHelper(it)» - - «getLabelIconHelper(it)» - - «setLabelIconHelper(it)» - - « labelSetter(it)» - - « getModelChildren(it)» - - « getChildBySemanticHint(it)» -««« ITEMIS CHANGES - « setParser (it)» -««« ITEMIS CHANGES END - « getParserElement(it,modelFacet)» - - « getLabelIcon(it,useElementIcon, diagram)» - - « getLabelText(it)» - - « setLabelText(it,diagram)» - - « getEditText(it)» - - « isEditable(it,readOnly)» - - « getEditTextValidator(it)» - - « getCompletionProcessor(it)» - - « getParserOptions(it)» - - « getParser(it,modelFacet, diagram, host)» - - « getManager(it,diagram)» - - « setManager(it)» - - « performDirectEdit(it)» - - « performDirectEditAtPoint(it)» - - « performDirectEditWithInitialChar(it)» - - « performDirectEditRequest(it,diagram)» - - « initializeDirectEditManager(it)» - - « refreshVisuals(it,needsRefreshBounds)» - - « refreshLabel(it,diagram)» - - « refreshUnderline(it)» - - « refreshStrikeThrough(it)» - - « refreshFont(it)» - - « setFontColor(it)» - - « addSemanticListeners(it)» - - « removeSemanticListeners(it)» - - « getAccessibleEditPart(it)» - - « getFontStyleOwnerView(it,viewmap)» - - ««« BEGIN: PapyrusGenCode - ««« Add extended editors management for direct edit - « getDirectEditionType(it,readOnly)» - - « checkExtendedEditor(it)» - - « checkDefaultEdition(it)» - - « initExtendedEditorConfiguration(it)» - - « updateExtendedEditorConfiguration(it)» - - « performDefaultDirectEditorEdit(it)» - - «««END: PapyrusGenCode -''' - -def labelSetterName(ParentAssignedViewmap it) ''' -«IF setterName != null»«setterName»«ELSE»setLabel«ENDIF» -''' - -override labelSetterName(Viewmap it)'''setLabel''' - -override getLabelTextHelper (GenCommonBase it)''' - « generatedMemberComment» - protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) { - if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { - return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText(); - } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) { - return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getText(); - } else { - return ((org.eclipse.draw2d.Label) figure).getText(); - } - } -''' - -override setLabelTextHelper (GenCommonBase it)''' - «generatedMemberComment» - protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) { - if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { - ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text); - } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) { - ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setText(text); - } else { - ((org.eclipse.draw2d.Label) figure).setText(text); - } - } -''' - -override getLabelIconHelper (GenCommonBase it)''' - «generatedMemberComment» - protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) { - if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { - return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon(); - } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) { - return ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).getIcon(); - } else { - return ((org.eclipse.draw2d.Label) figure).getIcon(); - } - } -''' - -override setLabelIconHelper (GenCommonBase it)''' - «generatedMemberComment» - protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) { - if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { - ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) { - ((org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure) figure).setIcon(icon); - } else { - ((org.eclipse.draw2d.Label) figure).setIcon(icon); - } - } -''' - -override labelSetter (GenCommonBase it)''' - «generatedMemberComment» - public void « labelSetterName (viewmap)»(« labelSetterFigureClassName(viewmap)» figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } -''' - -def labelSetterFigureClassName (ParentAssignedViewmap it)''' - «IF figureQualifiedClassName != null» - «figureQualifiedClassName» - «ELSE» - org.eclipse.draw2d.IFigure - «ENDIF» -''' - -override labelSetterFigureClassName (Viewmap it)''' - org.eclipse.draw2d.IFigure -''' - -override getModelChildren (GenCommonBase it)''' - «generatedMemberComment» - protected java.util.List<?> getModelChildren() { - return java.util.Collections.EMPTY_LIST; - } -''' - -override getChildBySemanticHint (GenCommonBase it)''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } -''' - -def setParser (GenCommonBase it)''' - «generatedMemberComment» - public void setParser(org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser) { - this.parser = parser; - } -''' - -override getParserElement(GenCommonBase it, LabelModelFacet modelFacet) ''' - «generatedMemberComment» - protected org.eclipse.emf.ecore.EObject getParserElement() { - «IF modelFacet == null» - org.eclipse.emf.ecore.EObject element = resolveSemanticElement(); - return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel(); - «ELSE»« getParserElement(modelFacet)»«ENDIF» - } -''' - -def getParserElement (LabelModelFacet it)''' - return resolveSemanticElement(); -''' - -def getParserElement (DesignLabelModelFacet it)''' - return (org.eclipse.gmf.runtime.notation.View) getModel(); -''' - -override getLabelIcon(GenCommonBase it,boolean useElementIcon, GenDiagram diagram ) ''' - «generatedMemberComment» - protected org.eclipse.swt.graphics.Image getLabelIcon() { - «IF useElementIcon» - ««« START: PapyrusGenCode - return org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil.getIcon(getParserElement(), getViewer()); - ««« END: PapyrusGenCode - «ELSE» - return null; - «ENDIF» - } -''' - -override getLabelText (GenCommonBase it)''' - «generatedMemberComment» - protected String getLabelText() { - String text = null; - org.eclipse.emf.ecore.EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString( - org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } -''' - -override setLabelText(GenCommonBase it, GenDiagram diagram) ''' - «generatedMemberComment» - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback(); - } - } -''' - -override getEditText (GenCommonBase it)''' - «generatedMemberComment» - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; «nonNLS» - } - return getParser().getEditString( - org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this), - getParserOptions().intValue()); - } -''' - -def isEditable(GenCommonBase it, boolean readOnly ) ''' - «generatedMemberComment» - protected boolean isEditable() { - «IF readOnly» - return false; - «ELSE» - return getParser() != null; - «ENDIF» - } -''' - -override getEditTextValidator (GenCommonBase it)''' - «generatedMemberComment» - public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() { - return new org.eclipse.jface.viewers.ICellEditorValidator() { - - «overrideI» - public String isValid(final Object value) { - if (value instanceof String) { - final org.eclipse.emf.ecore.EObject element = getParserElement(); - final org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = getParser(); - try { - org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid = - (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive( - new org.eclipse.emf.transaction.RunnableWithResult.Impl<java.lang.Object>() { - - «overrideI» - public void run() { - setResult(parser.isValidEditString(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), «editPartClassName».this), (String) value)); - } - }); - return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } -''' - -override getCompletionProcessor (GenCommonBase it)''' - «generatedMemberComment» - public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParserAdapter(getParserElement(), this)); - } -''' - -override getParserOptions (GenCommonBase it)''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() { - return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE; - } -''' - -override getParser(GenCommonBase it, LabelModelFacet modelFacet, GenDiagram diagram , GenCommonBase host ) ''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() { - if (parser == null) { - parser = org.eclipse.papyrus.infra.gmfdiag.common.parsers.ParserUtil.getParser(«xptElementTypes.accessElementType(host)», getParserElement(), this, VISUAL_ID); - } - return parser; - } -''' - -def getManager(GenCommonBase it,GenDiagram diagram) ''' - «generatedMemberComment» - protected org.eclipse.gef.tools.DirectEditManager getManager() { - if (manager == null) { - setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this, - org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this), - «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this))); - } - return manager; - } -''' - -override setManager (GenCommonBase it)''' - «generatedMemberComment» - protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) { - this.manager = manager; - } -''' - -override performDirectEdit (GenCommonBase it)''' - «generatedMemberComment» - protected void performDirectEdit() { - org.eclipse.swt.custom.BusyIndicator.showWhile(org.eclipse.swt.widgets.Display.getDefault(), new java.lang.Runnable() { - - «overrideI» - public void run() { - getManager().show(); - } - }); - } -''' - -def performDirectEditAtPoint (GenCommonBase it)''' - «generatedMemberComment» - protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) { - if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) { - ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } -''' - -override performDirectEditWithInitialChar (GenCommonBase it)''' - «generatedMemberComment» - protected void performDirectEdit(char initialCharacter) { - if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) { - ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } -''' - -def performDirectEditRequest(GenCommonBase it, GenDiagram diagram ) ''' - «generatedMemberComment» - protected void performDirectEditRequest(org.eclipse.gef.Request request) { - - final org.eclipse.gef.Request theRequest = request; - - if (org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - // Create default edit manager - setManager(new org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager(this, - org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager.getTextCellEditorClass(this), - «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this))); - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - org.eclipse.jface.dialogs.Dialog dialog = null; - if (configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) { - setManager(((org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); - initializeDirectEditManager(theRequest); - return; - } else if (configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration) { - org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper helper = ((org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration)configuration).createPopupEditorHelper(this) ; - helper.showEditor() ; - return ; - } - else if(configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration) { - dialog = ((org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration)configuration).createDialog(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if(configuration instanceof org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration) { - dialog = new org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final org.eclipse.jface.dialogs.Dialog finalDialog = dialog; - - if (org.eclipse.jface.window.Window.OK == dialog.open()) { - org.eclipse.emf.transaction.TransactionalEditingDomain domain = getEditingDomain(); - org.eclipse.emf.transaction.RecordingCommand command = new org.eclipse.emf.transaction.RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog)finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR: - initializeDirectEditManager(theRequest); - break; - default: - break; - } - } -''' - -def initializeDirectEditManager (GenCommonBase it)''' - «generatedMemberComment» - protected void initializeDirectEditManager(final org.eclipse.gef.Request request) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - «overrideI» - public void run() { - if (isActive() && isEditable()) { - if (request.getExtendedData().get( - org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) request.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } - else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -''' - -def refreshVisuals(GenCommonBase it, boolean needsRefreshBounds ) ''' - «generatedMemberComment» - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - «IF needsRefreshBounds» - refreshBounds(); - «ENDIF» - } -''' - -override refreshLabel(GenCommonBase it , GenDiagram diagram )''' - «generatedMemberComment» - protected void refreshLabel() { - org.eclipse.gef.EditPolicy maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if(maskLabelPolicy==null){ - maskLabelPolicy = getEditPolicy(org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - if (maskLabelPolicy == null) { - org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View)getModel(); - if(view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } - else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») { - ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback(); - } - } -''' - -override refreshUnderline (GenCommonBase it)''' - «generatedMemberComment» - protected void refreshUnderline() { - org.eclipse.gmf.runtime.notation.FontStyle style = - (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle( - org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { - ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if(resolveSemanticElement() instanceof org.eclipse.uml2.uml.Feature){ - if(((org.eclipse.uml2.uml.Feature)resolveSemanticElement()).isStatic()){ - ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)getFigure()).setTextUnderline(true); - } - else{((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)getFigure()).setTextUnderline(false);} - } - } -''' - -override refreshStrikeThrough (GenCommonBase it)''' - «generatedMemberComment» - protected void refreshStrikeThrough() { - org.eclipse.gmf.runtime.notation.FontStyle style = - (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle( - org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) { - ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } -''' - -override refreshFont (GenCommonBase it)''' - «generatedMemberComment» - protected void refreshFont() { - org.eclipse.gmf.runtime.notation.FontStyle style = - (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle( - org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData( - style.getFontName(), style.getFontHeight(), - (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) | - (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL)); - setFont(fontData); - } - } -''' - -override setFontColor (GenCommonBase it)''' - «generatedMemberComment» - protected void setFontColor(org.eclipse.swt.graphics.Color color) { - getFigure().setForegroundColor(color); - } -''' - -override addSemanticListeners (GenCommonBase it)''' - «generatedMemberComment» - protected void addSemanticListeners() { - if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) { - org.eclipse.emf.ecore.EObject element = resolveSemanticElement(); - parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «nonNLS» - } - } else { - super.addSemanticListeners(); - } - } -''' - -override removeSemanticListeners (GenCommonBase it)''' - «generatedMemberComment» - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); «nonNLS» - } - } else { - super.removeSemanticListeners(); - } - } -''' - -override getAccessibleEditPart (GenCommonBase it)''' - «generatedMemberComment» - protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - «overrideC» - public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } -''' - -override getFontStyleOwnerView(GenCommonBase it, Viewmap viewmap ) ''' - «generatedMemberComment» - private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() { - «IF isFixedFont(viewmap)» - return (org.eclipse.gmf.runtime.notation.View) getModel(); - «ELSE» - return getPrimaryView(); - «ENDIF» - } -''' - - -//BEGIN: PapyrusGenCode -//Methods for advanced direct edition - -def getDirectEditionType(GenCommonBase it, Boolean readOnly) ''' - /** - * Returns the kind of associated editor for direct edition. - * - * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition - * @generated - */ - public int getDirectEditionType() { - «IF readOnly» - // The label is read-only (defined in GMFGen model) - return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION; - «ELSE» - if (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - - // not a named element. no specific editor => do nothing - return org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition.NO_DIRECT_EDITION; - «ENDIF» - } -''' - -def checkExtendedEditor (GenCommonBase it)''' - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - * @generated - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(),this); - } - return false; - } -''' - -def checkDefaultEdition (GenCommonBase it)''' - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - * @generated - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } -''' - -def initExtendedEditorConfiguration (GenCommonBase it)''' - /** - * Initializes the extended editor configuration - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = org.eclipse.papyrus.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString(org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(), this); - } else { - configuration = org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); - } - } - } -''' - -def updateExtendedEditorConfiguration (GenCommonBase it)''' - /** - * Updates the preference configuration - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = org.eclipse.papyrus.extensionpoints.editors.Activator.getDefault().getPreferenceStore().getString( - org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { - configuration = org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement(),this); - } else if (org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } -''' - -def performDefaultDirectEditorEdit (GenCommonBase it)''' - /** - * Performs the direct edit usually used by GMF editors. - * @param theRequest the direct edit request that starts the direct edit system - * @generated - */ - protected void performDefaultDirectEditorEdit(final org.eclipse.gef.Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - «overrideI» - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get( - org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) { - org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -''' -//END: PapyrusGenCode - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend deleted file mode 100644 index 6e4fe0a5516..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/diagram/update/CanonicalUpdate.xtend +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Artem Tikhomirov - refactoring of containerBaseCanonicalMethods.xpt; extraction of API/non-API of CEP templates - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.diagram.update - -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.gmf.codegen.gmfgen.GenContainerBase -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Common -import xpt.diagram.updater.DiagramUpdater -import xpt.diagram.updater.NodeDescriptor -import xpt.diagram.updater.Utils_qvto -import xpt.diagram.updater.LinkDescriptor -import xpt.editor.VisualIDRegistry - -@Singleton class CanonicalUpdate extends impl.diagram.update.CanonicalUpdate { - @Inject extension Common; - @Inject extension Utils_qvto; - - @Inject NodeDescriptor nodeDescriptor; - @Inject MetaModel xptMetaModel; - @Inject DiagramUpdater xptDiagramUpdater; - @Inject LinkDescriptor linkDescriptor; - @Inject VisualIDRegistry xptVisualIDRegistry; - - override def getFeaturesToSynchronizeMethod(GenContainerBase it) ''' - «IF getSemanticChildrenChildFeatures(it).size == 1» - - «generatedMemberComment» - protected org.eclipse.emf.ecore.EStructuralFeature getFeatureToSynchronize() { - return «xptMetaModel.MetaFeature(getSemanticChildrenContainmentFeatures(it).head)»; - } - «ELSEIF getSemanticChildrenChildFeatures(it).size > 1» - - «generatedMemberComment» - protected java.util.Set<org.eclipse.emf.ecore.EStructuralFeature> getFeaturesToSynchronize() { - if (myFeaturesToSynchronize == null) { - myFeaturesToSynchronize = new java.util.HashSet<org.eclipse.emf.ecore.EStructuralFeature>(); - «FOR f : getSemanticChildrenContainmentFeatures(it)» - «addContainmentFeature(f)» - «ENDFOR» - } - return myFeaturesToSynchronize; - } - «ENDIF» - ''' - - override def getSemanticChildrenListMethod(GenContainerBase it) ''' - «generatedMemberComment» - protected java.util.List<org.eclipse.emf.ecore.EObject> getSemanticChildrenList() { - «IF hasSemanticChildren(it)/*REVISIT: is there real need for this check - Generator seems to consult needsCanonicalEP, which in turns ensures there are semantic children?*/» - org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); - java.util.LinkedList<org.eclipse.emf.ecore.EObject> result = new java.util.LinkedList<org.eclipse.emf.ecore.EObject>(); - java.util.List<«nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)»> childDescriptors = «xptDiagramUpdater. - getSemanticChildrenMethodCall(it)»(viewObject); - for («nodeDescriptor.qualifiedClassName(it.diagram.editorGen.diagramUpdater)» d : childDescriptors) { - result.add(d.getModelElement()); - } - return result; - «ELSE» - return java.util.Collections.EMPTY_LIST; - «ENDIF» - } - ''' - - override def refreshConnectionsBody(GenDiagram it) ''' - «Domain2Notation(it)» domain2NotationMap = new «Domain2Notation(it)»(); - java.util.Collection<«linkDescriptor.qualifiedClassName(editorGen.diagramUpdater)»> linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap); - java.util.List<org.eclipse.gmf.runtime.notation.View> edges = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>(); - for (Object edge : getDiagram().getEdges()) - { - if (edge instanceof org.eclipse.gmf.runtime.notation.View) - { - edges.add((org.eclipse.gmf.runtime.notation.View) edge); - } - } - java.util.Collection<org.eclipse.gmf.runtime.notation.View> existingLinks = new java.util.LinkedList<org.eclipse.gmf.runtime.notation.View>(edges); - for (java.util.Iterator<org.eclipse.gmf.runtime.notation.View> linksIterator = existingLinks.iterator(); linksIterator.hasNext();) { - org.eclipse.gmf.runtime.notation.Edge nextDiagramLink = (org.eclipse.gmf.runtime.notation.Edge) linksIterator.next(); - int diagramLinkVisualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(nextDiagramLink); - if (diagramLinkVisualID == -1«FOR link : links.filter[gl|gl.modelFacet == null]»«compareLinkVisualID(link)»«ENDFOR») { - if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) { - linksIterator.remove(); - } - continue; - } - org.eclipse.emf.ecore.EObject diagramLinkObject = nextDiagramLink.getElement(); - org.eclipse.emf.ecore.EObject diagramLinkSrc = nextDiagramLink.getSource().getElement(); - org.eclipse.emf.ecore.EObject diagramLinkDst = nextDiagramLink.getTarget().getElement(); - for (java.util.Iterator<«it.editorGen.diagramUpdater.linkDescriptorQualifiedClassName»> linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) { - «linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)» nextLinkDescriptor = linkDescriptorsIterator.next(); - if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) { - linksIterator.remove(); - linkDescriptorsIterator.remove(); - break; - } - } - } - deleteViews(existingLinks.iterator()); - return createConnections(linkDescriptors, domain2NotationMap); - ''' - - override def collectAllLinksMethod(GenDiagram it) ''' - «generatedMemberComment» - private java.util.Collection<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> collectAllLinks(org.eclipse.gmf.runtime.notation.View view, «Domain2Notation( - it)» domain2NotationMap) { - if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view))) { - return java.util.Collections.emptyList(); - } - java.util.LinkedList<«linkDescriptor.qualifiedClassName(it.editorGen.diagramUpdater)»> result = new java.util.LinkedList<«linkDescriptor. - qualifiedClassName(it.editorGen.diagramUpdater)»>(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(view); - if (vid != null) { - switch (vid) { - «FOR se : it.allSemanticElements» - «caseSemanticElement(se)» - «ENDFOR» - } - } - for (java.util.Iterator<?> children = view.getChildren().iterator(); children.hasNext();) { - result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) children.next(), domain2NotationMap)); - } - for (java.util.Iterator<?> edges = view.getSourceEdges().iterator(); edges.hasNext();) { - result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) edges.next(), domain2NotationMap)); - } - return result; - } - ''' - - override getEditPartMethod(GenDiagram it) ''' - «generatedMemberComment» - private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap) { - org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.get(domainModelElement); - if (view != null) { - return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view); - } - return null; - } - ''' - - override getHintedEditPartMethod(GenDiagram it) ''' - «generatedMemberComment» - protected final org.eclipse.gef.EditPart getHintedEditPart(org.eclipse.emf.ecore.EObject domainModelElement, «Domain2Notation(it)» domain2NotationMap, int hintVisualId) { - org.eclipse.gmf.runtime.notation.View view = domain2NotationMap.getHinted(domainModelElement, «xptVisualIDRegistry.typeMethodCall(it, 'hintVisualId')»); - if (view != null) { - return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view); - } - return null; - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend deleted file mode 100644 index 7d21bab98fb..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/parsers/ParserProvider.xtend +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright (c) 2007-2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - [235113] alternative parser access - * [244419] custom parsers - * [138179] expression-backed labels - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.parsers - -import com.google.inject.Inject -import com.google.inject.Singleton -import impl.parsers.expression_qvto -import metamodel.MetaModel -import org.eclipse.gmf.codegen.gmfgen.GenChildLabelNode -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.GenParsers -import parsers.ExpressionLabelParser -import parsers.PredefinedParser -import plugin.Activator -import xpt.Common -import xpt.Common_qvto -import xpt.editor.VisualIDRegistry -import xpt.expressions.OclTracker_qvto -import xpt.expressions.getExpression -import xpt.providers.ElementTypes -import xpt.providers.ParserUtils_qvto - -@Singleton class ParserProvider extends impl.parsers.ParserProvider { - @Inject extension Common - @Inject extension Common_qvto - - @Inject extension OclTracker_qvto - @Inject extension ParserUtils_qvto - @Inject extension expression_qvto - - @Inject extension ExpressionLabelParser; - @Inject extension PredefinedParser; - - @Inject getExpression xptGetExpression; - @Inject MetaModel xptMetaModel; - @Inject VisualIDRegistry xptVisualIDRegistry; - @Inject ElementTypes xptElementTypes; - @Inject parsers.ParserProvider xptParsers; - @Inject Activator xptActivator; - - override def HintAdapterClass(GenParsers it) ''' - «generatedMemberComment()» - private static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter { - - «generatedMemberComment()» - private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType; - - «generatedMemberComment()» - public HintAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType type, - org.eclipse.emf.ecore.EObject object, String parserHint) { - super(object, parserHint); - «_assert('type != null')» - elementType = type; - } - - «generatedMemberComment()» - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { - if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) { - return elementType; - } - return super.getAdapter(adapter); - } - } - ''' - - override dispatch dispatch_parsers(GenNode it) ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)» - «ENDIF» - «ENDFOR» - ''' - - override dispatch dispatch_parsers(GenLink it) ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «dispatch_parser(label.modelFacet.parser, label.modelFacet, label)» - «ENDIF» - «ENDFOR» - ''' - - override dispatch dispatch_getParsers(GenNode it) // - ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «doGetParser(label.modelFacet.parser, label)» - «ENDIF» - «ENDFOR» - - ''' - - override dispatch dispatch_getParsers(GenLink it) // - ''' - «FOR label : it.labels» - «IF label.modelFacet != null» - «doGetParser(label.modelFacet.parser, label)» - «ENDIF» - «ENDFOR» - - ''' - - override dispatch dispatch_getParsers(GenChildLabelNode it) ''' - «IF it.modelFacet != null» - «doGetParser(it.labelModelFacet.parser, it)» - «ENDIF» - ''' - - override def getParserByVisualIdMethod(GenParsers it) ''' - «generatedMemberComment()» - protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(String visualID) { - if (visualID != null) { - switch (visualID) { - «FOR node : editorGen.diagram.topLevelNodes» - «dispatch_getParsers(node)» - «ENDFOR» - «FOR node : editorGen.diagram.childNodes» - «dispatch_getParsers(node)» - «ENDFOR» - «FOR link : editorGen.diagram.links» - «dispatch_getParsers(link)» - «ENDFOR» - } - } - return null; - } - ''' - - override def provider_providesMethod(GenParsers it) ''' - «generatedMemberComment()» - public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) { - if (operation instanceof org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) { - org.eclipse.core.runtime.IAdaptable hint = - ((org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) operation).getHint(); - if («xptElementTypes.qualifiedClassName(editorGen.diagram)».getElement(hint) == null) { - return false; - } - return getParser(hint) != null; - } - return false; - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend deleted file mode 100644 index f934212e028..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/impl/preferences/StandardPage.xtend +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2006, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.impl.preferences - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenStandardPreferencePage -import org.eclipse.gmf.codegen.gmfgen.StandardPreferencePages -import xpt.Common - -//DOCUMENTATION: PapyrusGencode -//change the superclass and the initialization - -@Singleton class StandardPage extends impl.preferences.StandardPage { - @Inject extension Common; - - - override Main(GenStandardPreferencePage it) ''' - «copyright(it.diagram.editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» «extendsList(it)» «implementsList(it)» { - - «generatedMemberComment» - public «className(it)»() { - setPreferenceStore(«getDiagram().editorGen.plugin.activatorQualifiedClassName».getInstance().getPreferenceStore()); - «IF StandardPreferencePages.GENERAL_LITERAL == kind» - setPreferenceKey(«getDiagram().editPartsPackageName».«getDiagram().editPartClassName».MODEL_ID); - «ENDIF» - } - } - ''' - - override extendsList(GenStandardPreferencePage it) ''' - «IF kind == StandardPreferencePages::GENERAL_LITERAL» - extends org.eclipse.papyrus.infra.gmfdiag.preferences.pages.DiagramPreferencePage«» - «ELSEIF kind == StandardPreferencePages::APPEARANCE_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage«» - «ELSEIF kind == StandardPreferencePages::CONNECTIONS_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage«» - «ELSEIF kind == StandardPreferencePages::PRINTING_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage«» - «ELSEIF kind == StandardPreferencePages::RULERS_AND_GRID_LITERAL» - extends org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage«» - «ENDIF» - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend deleted file mode 100644 index 7d9127b2272..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/metamodel/Facility.xtend +++ /dev/null @@ -1,32 +0,0 @@ -package aspects.metamodel; - -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.Facility_qvto -import org.eclipse.emf.codegen.ecore.genmodel.GenPackage -import org.eclipse.gmf.codegen.gmfgen.DynamicModelAccess -import xpt.Common - -@Singleton class Facility extends metamodel.Facility { - - @Inject extension Common; - @Inject extension Facility_qvto; - - - -override getMethod(GenPackage it, DynamicModelAccess dma)''' - «generatedMemberComment('@throws IllegalStateException if no EPackage with given URI is registered.')» - public static «className(dma)» get«getNameToken(it)»() { - if («fieldName(it)» == null) { - org.eclipse.emf.ecore.EPackage pkg = getRegistry().getEPackage("«getEcorePackage().nsURI»"); - if (pkg == null) { - throw new IllegalStateException("Package «getEcorePackage().name»(«getEcorePackage().nsURI») not found"); - } - «fieldName(it)» = new «className(dma)»(pkg); - «fieldName(it)».init«getNameToken(it)»(); - } - return «fieldName(it)»; - } -''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend deleted file mode 100644 index 6c597db0afb..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/metamodel/MetaModel.xtend +++ /dev/null @@ -1,16 +0,0 @@ -package aspects.metamodel - -import org.eclipse.emf.codegen.ecore.genmodel.GenClass -import org.eclipse.emf.codegen.ecore.genmodel.GenFeature -import com.google.inject.Inject -import metamodel.MetaModel_qvto -import com.google.inject.Singleton - -@Singleton class MetaModel extends metamodel.MetaModel { - - @Inject extension MetaModel_qvto; - - override DeclareAndAssign2(GenClass it, String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) // - '''«getQualifiedInterfaceName(it)» «assignee» = «getFeatureValue(srcFeature, src, srcMetaClass)».«srcExt»;''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/parsers/PredefinedParser.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/parsers/PredefinedParser.xtend deleted file mode 100755 index 881e7e7edf0..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/parsers/PredefinedParser.xtend +++ /dev/null @@ -1,65 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Bug 464625 - *****************************************************************************/ -package aspects.parsers - -import com.google.inject.Singleton - -@Singleton class PredefinedParser extends parsers.PredefinedParser{ - - override def extendsList(org.eclipse.gmf.codegen.gmfgen.PredefinedParser it) // - '''extends org.eclipse.papyrus.infra.gmfdiag.common.parsers.AbstractElementTypeBasedAttributeParser''' - - override def additions(org.eclipse.gmf.codegen.gmfgen.PredefinedParser it) // - ''' - /** - * @generated - * {@inheritDoc} - * @see org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractFeatureParser#getModificationCommand(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) - */ - @Override - protected org.eclipse.gmf.runtime.common.core.command.ICommand getModificationCommand(final org.eclipse.emf.ecore.EObject element, final org.eclipse.emf.ecore.EStructuralFeature feature, final Object value) { - org.eclipse.gmf.runtime.common.core.command.ICommand result = null; - - // If the feature to edit is the name, check that this is not really the internationalization to edit and not the name - if (feature.equals(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name())) { - if (org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement) element)) { - final org.eclipse.papyrus.infra.core.resource.ModelSet modelSet = (org.eclipse.papyrus.infra.core.resource.ModelSet) element.eResource().getResourceSet(); - if (null != modelSet) { - result = new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (org.eclipse.uml2.uml.NamedElement) element, (String) value, null)); - } - } - } - - return null != result ? result : super.getModificationCommand(element, feature, value); - } - - /** - * @generated - * {@inheritDoc} - * @see org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.parsers.AbstractAttributeParser#getValue(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EStructuralFeature) - */ - @Override - protected Object getValue(final org.eclipse.emf.ecore.EObject element, final org.eclipse.emf.ecore.EStructuralFeature feature) { - Object result = null; - - if(element instanceof org.eclipse.uml2.uml.NamedElement && feature.equals(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNamedElement_Name())){ - if (org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils.getInternationalizationPreference(element) && null != org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement)element)) { - result = UMLLabelInternationalization.getInstance().getLabelWithoutUML((org.eclipse.uml2.uml.NamedElement)element); - } - } - - return null != result ? result : super.getValue(element, feature); - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend deleted file mode 100644 index 7b56ab74a76..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/CodeStyle.xtend +++ /dev/null @@ -1,12 +0,0 @@ -package aspects.xpt - -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import com.google.inject.Singleton - -@Singleton class CodeStyle extends xpt.CodeStyle { - - override overrideI(GenCommonBase xptSelf) ''' - @Override - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend deleted file mode 100644 index 58a5807bc5e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/Common.xtend +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2006-2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt; - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator -import org.eclipse.papyrus.papyrusgmfgenextension.VisualIDOverride - -@Singleton class Common extends xpt.Common { - override copyright(GenEditorGenerator it) - ''' - «IF copyrightText != null» - /** - * «copyrightText.replaceAll('\n', '\n * ')» - */ - «ENDIF» - ''' - - def String stringVisualID(GenCommonBase it) { - if (it.eResource.allContents.filter(typeof (VisualIDOverride)).exists(v|v.genView == it)) - it.eResource.allContents.filter(typeof (VisualIDOverride)).findFirst(v|v.genView == it).visualID - else - it.visualID.toString - } - - def String stringUniqueIdentifier(GenCommonBase it) { - if (it.eResource.allContents.filter(typeof (VisualIDOverride)).exists(v|v.genView == it)) - it.eResource.allContents.filter(typeof (VisualIDOverride)).findFirst(v|v.genView == it).visualID - else - it.uniqueIdentifier - } -} - diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/QualifiedClassNameProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/QualifiedClassNameProvider.xtend deleted file mode 100644 index cb73c870eef..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/QualifiedClassNameProvider.xtend +++ /dev/null @@ -1,30 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - *****************************************************************************/ -package aspects.xpt - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCompartment -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.GenNode - -@Singleton class QualifiedClassNameProvider extends xpt.QualifiedClassNameProvider { - - - - - override dispatch getItemSemanticEditPolicyQualifiedClassName(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy''' - override dispatch getItemSemanticEditPolicyQualifiedClassName(GenCompartment it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy''' - override dispatch getItemSemanticEditPolicyQualifiedClassName(GenLink it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy''' - override dispatch getItemSemanticEditPolicyQualifiedClassName(GenNode it) '''org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy''' - - - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend deleted file mode 100644 index 3017f6719d9..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateLinkUtils.xtend +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2007-2012 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.commands - -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.gmf.codegen.gmfgen.LinkModelFacet -import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet -import xpt.Common -import xpt.diagram.Utils_qvto - -@Singleton class CreateLinkUtils extends xpt.diagram.commands.CreateLinkUtils { - @Inject extension Common; - @Inject extension Utils_qvto; - - @Inject MetaModel xptMetaModel; - - - /** - * Fields of command that creates link. - */ - override dispatch fields(LinkModelFacet it) ''' - «extraLineBreak» - «generatedMemberComment()» - protected final org.eclipse.emf.ecore.EObject source; - - «generatedMemberComment()» - protected final org.eclipse.emf.ecore.EObject target; - ''' - - override dispatch fields(TypeLinkModelFacet it) ''' - «extraLineBreak» - «generatedMemberComment()» - protected final org.eclipse.emf.ecore.EObject source; - - «generatedMemberComment()» - protected final org.eclipse.emf.ecore.EObject target; - «IF hasContainerOtherThanSource(it)» - - «generatedMemberComment()» - protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» container; - «ENDIF» - ''' - - override dispatch containerAccessor(TypeLinkModelFacet it) ''' - «IF hasContainerOtherThanSource(it)» - - «generatedMemberComment()» - public «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» getContainer() { - return container; - } - - «generatedMemberComment( - 'Default approach is to traverse ancestors of the source to find instance of container.\n' + 'Modify with appropriate logic.' - )» - protected «xptMetaModel.QualifiedClassName(it.containmentMetaFeature.genClass)» deduceContainer(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) { - // Find container element for the new link. - // Climb up by containment hierarchy starting from the source - // and return the first element that is instance of the container class. - for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) { - if («xptMetaModel.IsInstance(containmentMetaFeature.genClass, 'element')») { - return «xptMetaModel.CastEObject(it.containmentMetaFeature.genClass, 'element')»; - } - } - return null; - } - «ENDIF» - - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend deleted file mode 100644 index ab940ff8036..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/CreateNodeCommand.xtend +++ /dev/null @@ -1,227 +0,0 @@ -/** - * Copyright (c) 2007, 2010 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.commands - -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet -import xpt.Common -import xpt.OclMigrationProblems_qvto -import xpt.diagram.Utils_qvto - -@Singleton class CreateNodeCommand extends xpt.diagram.commands.CreateNodeCommand { - @Inject extension Common; - - @Inject extension OclMigrationProblems_qvto; - @Inject extension MetaModel - @Inject extension Utils_qvto; - - - @Inject MetaModel xptMetaModel; - - override CreateNodeCommand(GenNode it) ''' - «copyright(it.diagram.editorGen)» - package «packageName(it)»; - - - - «generatedClassComment()» - public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand { - - «IF ! it.modelFacet.isPhantomElement()» - «generatedMemberComment()» - private org.eclipse.gmf.runtime.notation.Diagram diagram = null; - «ENDIF» - - «_constructor(it)» - - «getElementToEdit(it)» - - «canExecuteMethod(it)» - - «doExecuteWithResultMethod(it)» - - «doConfigureMethod(it)» - - «additions(it)» - } - ''' - - override _constructor(GenNode it) ''' - «generatedMemberComment()» - public «className(it)»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.gmf.runtime.notation.Diagram diagram) { - super(req.getLabel(), null, req); - «IF ! it.modelFacet.isPhantomElement()» - this.diagram = diagram; - «ENDIF» - } - ''' - -// override CreateNodeCommand(TypeModelFacet it) ''' -// «copyright(ownerGenNode(it).diagram.editorGen)» -// package «packageName(it)»; -// -// «generatedClassComment()» -// public class «className(it)» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand { -//««« Mutating canvas auxiliary -// «generatedMemberComment» -// private org.eclipse.emf.ecore.EClass eClass = null; -// «generatedMemberComment» -// private org.eclipse.emf.ecore.EObject eObject = null; -// ««« Mutating canvas auxiliary constructor -// «generatedMemberComment» -// public «ownerGenNode(it).createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) { -// super(req.getLabel(), null, req); -// this.eObject = eObject; -// this.eClass = eObject != null ? eObject.eClass() : null; -// } -// ««« Mutating canvas auxiliary builder -// «generatedMemberComment» -// public static «ownerGenNode(it).createCommandClassName» create(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req, org.eclipse.emf.ecore.EObject eObject) { -// return new «ownerGenNode(it).createCommandClassName»(req, eObject); -// } -// « _constructor(it)» -// « getElementToEdit(it)» -// « canExecuteMethod(it)» -// « doExecuteWithResultMethod(it)» -// « doConfigureMethod(it)» -// } -// ''' -// -// -// -// /** -// * TODO: either use setElementToEdit, or generate downcasted version (which may be troublesome if containment and child features point to a different parent) -// */ -// override getElementToEdit(TypeModelFacet it) ''' -// «generatedMemberComment('FIXME: replace with setElementToEdit()')» -// protected org.eclipse.emf.ecore.EObject getElementToEdit() { -// -// ««« Mutating canvas helper -// org.eclipse.emf.ecore.EObject container = -// ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer(); -// if (container instanceof org.eclipse.gmf.runtime.notation.View) { -// container = ((org.eclipse.gmf.runtime.notation.View) container).getElement(); -// } -// if (container != null) { -// return container; -// } -// return eObject; -// -// } -// ''' - - // [AbstractElement] Modified for Abstract domain element - override doExecuteWithResultMethod(GenNode it) ''' - «generatedMemberComment()» - protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { - ««« [AbstractElement] START - - «IF it.modelFacet.metaClass.ecoreClass.abstract != true» - ««« [AbstractElement] END - «IF it.modelFacet.isPhantomElement()» - «phantomElementCreation(it.modelFacet, it, 'newElement')» - «ELSE» - «normalElementCreation(it.modelFacet, it, 'newElement')» - «ENDIF» - «extraLineBreak» - «initialize(it.modelFacet, it, 'newElement')» - «IF true/*FIXME boolean needsExternalConfiguration*/» - «extraLineBreak» - doConfigure(newElement, monitor, info); - «extraLineBreak» - «ENDIF» - ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).setNewElement(«xptMetaModel. - DowncastToEObject(it.modelFacet.metaClass, 'newElement')»); - return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(newElement); - } - ««« [AbstractElement] START - «ELSE» - throw new UnsupportedOperationException("Unimplemented operation (abstract domain element)."); - } - «ENDIF» - ««« [AbstractElement] END - ''' - - - override canExecute_Normal(TypeModelFacet it) ''' - «IF containmentMetaFeature != null» - «IF containmentMetaFeature.ecoreFeature != null» - «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || (childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature))» - «IF ! isUnbounded(containmentMetaFeature.ecoreFeature)» - «DeclareAndAssign(containmentMetaFeature.genClass,'container', 'getElementToEdit()') » - «IF isSingleValued(containmentMetaFeature.ecoreFeature)» - if («getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass) » != null) { - «ELSE» - if (« getFeatureValue(containmentMetaFeature,'container', containmentMetaFeature.genClass)».size() >= «containmentMetaFeature.ecoreFeature.upperBound») { - «ENDIF» - return false; - } - «ENDIF» - «IF childMetaFeature != containmentMetaFeature && ! isUnbounded(childMetaFeature.ecoreFeature)» - «IF isSingleValued(childMetaFeature.ecoreFeature)» - if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) » != null) { - «ELSE» - if («getFeatureValue(childMetaFeature,'container', containmentMetaFeature.genClass) ».size() >= «childMetaFeature.ecoreFeature.upperBound») { - «ENDIF» - return false; - } - «ENDIF» - «ENDIF» - «ENDIF» - «ENDIF» - - org.eclipse.emf.ecore.EObject target = getElementToEdit(); - org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), «MetaClass(metaClass)»); - return data.isPermitted(); - - ''' - - - override normalElementCreation(TypeModelFacet it, GenNode node, String varName) ''' - «xptMetaModel.NewInstance(it.metaClass, varName)» - - org.eclipse.emf.ecore.EObject target = getElementToEdit(); - org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData data = org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker.getFor(target).getChildAddData(diagram, target, «varName»); - if (data.isPermitted()) { - if (data.isPathDefined()) { - if (!data.execute(target, «varName»)) { - return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); - } - } else { - «extraLineBreak» - «IF containmentMetaFeature != null» - «xptMetaModel.DeclareAndAssign(it.containmentMetaFeature.genClass, 'qualifiedTarget', 'target')» - «xptMetaModel.modifyFeature(containmentMetaFeature, 'qualifiedTarget', containmentMetaFeature.genClass, varName)» - «ELSE» - // - // FIXME no containment feature found in the genmodel, toolsmith need to manually write code here to add «varName» to a parent - // - «ENDIF» - - } - } else { - return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); - } - - «IF hasExplicitChildFeature(it)» - «xptMetaModel.DeclareAndAssign(it.childMetaFeature.genClass, 'childHolder', 'getElementToEdit()')» - «xptMetaModel.modifyFeature(it.childMetaFeature, 'childHolder', childMetaFeature.genClass, varName)» - «ENDIF» - ''' - - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend deleted file mode 100644 index acc4f6bfbf4..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/commands/ReorientLinkUtils.xtend +++ /dev/null @@ -1,65 +0,0 @@ -package aspects.xpt.diagram.commands - -import org.eclipse.gmf.codegen.gmfgen.LinkModelFacet -import org.eclipse.gmf.codegen.gmfgen.GenLink -import xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton - -@Singleton class ReorientLinkUtils extends xpt.diagram.commands.ReorientLinkUtils { - - @Inject extension Common - - override canReorient(LinkModelFacet it, GenLink link) ''' - «generatedMemberComment()» - public boolean canExecute() { - «checkLinkValidity(it)» - if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) { - return canReorientSource(); - } - if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_TARGET) { - return canReorientTarget(); - } - return false; - } - - «generatedMemberComment()» - protected boolean canReorientSource() { - «checkSourceRequestValidity(it, link)» - } - - «generatedMemberComment()» - protected boolean canReorientTarget() { - «checkTargetRequestValidity(it, link)» - } - ''' - - override reorient(LinkModelFacet it) ''' - - «generatedMemberComment()» - protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult( - org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) - throws org.eclipse.core.commands.ExecutionException { - if (!canExecute()) { - throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in reorient link command"); «nonNLS()» - } - if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_SOURCE) { - return reorientSource(); - } - if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest.REORIENT_TARGET) { - return reorientTarget(); - } - throw new IllegalStateException(); - } - - «generatedMemberComment()» - protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientSource() throws org.eclipse.core.commands.ExecutionException { - «reorientSource(it)» - } - - «generatedMemberComment()» - protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientTarget() throws org.eclipse.core.commands.ExecutionException { - «reorientTarget(it)» - } - ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/BaseEditHelper.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/BaseEditHelper.xtend deleted file mode 100755 index 491519a8f33..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/BaseEditHelper.xtend +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation - *****************************************************************************/ -package aspects.xpt.diagram.edithelpers; - -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -public class BaseEditHelper extends xpt.diagram.edithelpers.BaseEditHelper { - - override superClass(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase''' - - override def editPolicyCommandConstant(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase.EDIT_POLICY_COMMAND''' - - override def contextElementTypeConstant(GenDiagram it) '''org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE''' - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend deleted file mode 100644 index 59987137756..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/edithelpers/EditHelper.xtend +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2006-2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.edithelpers; - -import com.google.inject.Inject -import org.eclipse.gmf.codegen.gmfgen.MetamodelType -import utils.EditHelperUtils_qvto -import xpt.Common - -public class EditHelper extends xpt.diagram.edithelpers.EditHelper { - @Inject extension Common; - @Inject extension EditHelperUtils_qvto - - - - - override EditHelper(MetamodelType it) ''' - «copyright(diagramElement.diagram.editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «editHelperClassName» extends «getBaseEditHelperFullName(diagramElement.getDiagram())» { - «additions(it)» - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend deleted file mode 100644 index 992cfd621c7..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/Common.xtend +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2006, 2010 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Patrick Tessier (CEA LIST) - */ -package aspects.xpt.diagram.editparts - -import aspects.xpt.QualifiedClassNameProvider -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenContainerBase - -//Documentation: PapyrusGenCode -//This template has been modified in order to remove canonical ediPolicies - -@Singleton class Common extends xpt.diagram.editparts.Common { - @Inject extension aspects.xpt.Common; - - @Inject QualifiedClassNameProvider qualifiedClassNameProvider; - - override installCanonicalEditPolicy(GenContainerBase it) ''' - «IF it.needsCanonicalEditPolicy» - ««« BEGIN: PapyrusGenCode - ««« Used to remove at each time canonical editpolicies - //in Papyrus diagrams are not strongly synchronised - //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»()); - ««« END: PapyrusGenCode - - «ENDIF» - ''' - - override creationEditPolicyNewInstance(GenCommonBase it) - '''new org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy()''' - - - override installSemanticEditPolicy(GenCommonBase it) ''' - «IF sansDomain» - removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE); - «ELSE» - installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «qualifiedClassNameProvider.getItemSemanticEditPolicyQualifiedClassName(it)»()); - «ENDIF» - ''' - - override def visualIDConstant(GenCommonBase it) ''' - «generatedMemberComment» - public static final String VISUAL_ID = "«stringVisualID»"; - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend deleted file mode 100644 index 4d9935befe9..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editparts/EditPartFactory.xtend +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.editparts - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -//DOCUMENTATION: PapyrusGencode -//change to manage the figure of the comment -@Singleton class EditPartFactory extends xpt.diagram.editparts.EditPartFactory { - - @Inject extension xpt.Common; - - - override getTextCellEditorLocator(GenDiagram it) ''' - «generatedMemberComment» - public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator( - org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) { - if (source.getFigure() instanceof org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure){ - return new MultilineCellEditorLocator( - (org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure) source.getFigure()); - } - else { - return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source); - - } - } - - - «generatedClassComment» - static private class MultilineCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator { - - «generatedClassComment» - private org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure multilineEditableFigure; - - «generatedClassComment» - public MultilineCellEditorLocator(org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure figure) { - this.multilineEditableFigure = figure; - } - - «generatedClassComment» - public org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure getMultilineEditableFigure() { - return multilineEditableFigure; - } - - «generatedClassComment» - public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) { - org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl(); - org.eclipse.draw2d.geometry.Rectangle rect = getMultilineEditableFigure().getBounds().getCopy(); - rect.x=getMultilineEditableFigure().getEditionLocation().x; - rect.y=getMultilineEditableFigure().getEditionLocation().y; - getMultilineEditableFigure().translateToAbsolute(rect); - if (getMultilineEditableFigure().getText().length() > 0) { - rect.setSize(new org.eclipse.draw2d.geometry.Dimension(text.computeSize(rect.width, - org.eclipse.swt.SWT.DEFAULT))); - } - if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) { - text.setBounds(rect.x, rect.y, rect.width, rect.height); - } - } - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend deleted file mode 100644 index e211ac08408..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xtend +++ /dev/null @@ -1,387 +0,0 @@ -/** - * Copyright (c) 2007, 2014 Borland Software Corporation, 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Christian W. Damus - bug 451230 - */ -package aspects.xpt.diagram.editpolicies - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.emf.codegen.ecore.genmodel.GenClass -import org.eclipse.emf.codegen.ecore.genmodel.GenFeature -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet -import org.eclipse.papyrus.papyrusgmfgenextension.GenerateUsingElementTypeCreationCommand -import plugin.Activator -import xpt.OclMigrationProblems_qvto -import xpt.editor.VisualIDRegistry -import xpt.providers.ElementTypes - -//Documentation: PapyrusGenCode -//This tamplate has been modified in order to allow the moving command -@Singleton class BaseItemSemanticEditPolicy extends xpt.diagram.editpolicies.BaseItemSemanticEditPolicy { - @Inject extension Common; - @Inject Activator xptPluginActivator; - @Inject extension VisualIDRegistry - @Inject ElementTypes xptElementTypes; - @Inject extension OclMigrationProblems_qvto; - @Inject extension xpt.diagram.editpolicies.Utils_qvto - @Inject MetaModel xptMetaModel; - - override BaseItemSemanticEditPolicy(GenDiagram it) ''' -«copyright(editorGen)» -package «packageName(it)»; - -«generatedClassComment()» -public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy { - - «attributes(it)» - - «constructor(it)» - - «generatedMemberComment( - 'Extended request data key to hold editpart visual id.\n' + 'Add visual id of edited editpart to extended data of the request\n' + 'so command switch can decide what kind of diagram element is being edited.\n' + 'It is done in those cases when it\'s not possible to deduce diagram\n' + 'element kind from domain element.\n' + 'Add the reoriented view to the request extended data so that the view\n ' + 'currently edited can be distinguished from other views of the same element\n ' + - 'and these latter possibly removed if they become inconsistent after reconnect\n' - )» - @SuppressWarnings("unchecked") - public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) { - if (request instanceof org.eclipse.gef.requests.ReconnectRequest) { - Object view = ((org.eclipse.gef.requests.ReconnectRequest) request).getConnectionEditPart().getModel(); - if (view instanceof org.eclipse.gmf.runtime.notation.View) { - String id = «getVisualIDMethodCall(it)»((org.eclipse.gmf.runtime.notation.View) view); - request.getExtendedData().put(VISUAL_ID_KEY, id); - request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view); - } - } - return super.getCommand(request); - } - - «generatedMemberComment('Returns visual id from request parameters.')» - protected String getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) { - return (String) request.getParameter(VISUAL_ID_KEY); - } - - «semanticPart(it)» - - «generatedMemberComment('Returns editing domain from the host edit part.')» - protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() { - return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain(); - } - - «addDestroyShortcutsCommand(it)» - -«IF links.exists(link|!link.sansDomain)» - «linkConstraints(it)» -«ENDIF» - - «additions(it)» -} -''' - -override def addDestroyShortcutsCommand(GenDiagram it) ''' - «generatedMemberComment('Clean all shortcuts to the host element from the same diagram')» - protected void addDestroyShortcutsCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd, org.eclipse.gmf.runtime.notation.View view) { - «_assert('view.getEAnnotation(\"Shortcut\") == null')» - for (java.util.Iterator<?> it = view.getDiagram().getChildren().iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); - if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { «nonNLS()» - continue; - } - cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), nextView)); - } - } -''' - - override attributes(GenDiagram it) ''' - «generatedMemberComment('Extended request data key to hold editpart visual id.')» - public static final String VISUAL_ID_KEY = "visual_id"; «nonNLS()» - «generatedMemberComment('Extended request data key to hold the edge view during a reconnect request.')» - public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; «nonNLS» - «generatedMemberComment()» - private final org.eclipse.gmf.runtime.emf.type.core.IElementType myElementType; - ''' - - override semanticPart(GenDiagram it) ''' - «getSemanticCommand(it)» - - «addDeleteViewCommand(it)» - - «getEditHelperCommand(it)» - - «getContextElementType(it)» - - «getSemanticCommandSwitch(it)» - - «getConfigureCommand(it)» - - «getCreateRelationshipCommand(it)» - - «getCreateCommand(it)» - - «getCreateSemanticServiceEditCommand(it)» - - «getSetCommand(it)» - - «getEditContextCommand(it)» - - «getDestroyElementCommand(it)» - - «getDestroyReferenceCommand(it)» - - «getDuplicateCommand(it)» - - «getMoveCommand(it)» - - «getReorientReferenceRelationshipCommand(it)» - - «getReorientRelationshipCommand(it)» - - «getGEFWrapper(it)» - ''' - - override getContextElementType(GenDiagram it) ''' - «generatedMemberComment()» - protected org.eclipse.gmf.runtime.emf.type.core.IElementType getContextElementType(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) { - org.eclipse.gmf.runtime.emf.type.core.IElementType requestContextElementType = «xptElementTypes.qualifiedClassName(it)».getElementType(getVisualID(request)); - return requestContextElementType != null ? requestContextElementType : myElementType; - } - ''' - - override getCreateRelationshipCommand(GenDiagram it) ''' -«generatedMemberComment()» -protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { - «IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size < 1» - return null; - «ENDIF» - «IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size() > 0» - org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)getHost()).resolveSemanticElement()); - if(req.getElementType() != null) { - commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getElementType(), req.getClientContext()); - } - - if(commandService == null) { - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - } - - org.eclipse.gmf.runtime.common.core.command.ICommand semanticCommand = commandService.getEditCommand(req); - - if((semanticCommand != null) && (semanticCommand.canExecute())) { - return getGEFWrapper(semanticCommand); - } - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - «ENDIF» -} -''' - - override getCreateCommand(GenDiagram it) ''' -«generatedMemberComment()» - protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) { - org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); - if (requestElementType instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) { - org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandProvider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer()); - if (commandProvider != null) { - org.eclipse.gmf.runtime.common.core.command.ICommand command = commandProvider.getEditCommand(req); - if (command != null && command.canExecute()) { - return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command); - } - } - } - return null; - } -''' - - - override getMoveCommand(GenDiagram it) ''' -«generatedMemberComment()» -protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) { - ««« BEGIN: PapyrusGenCode - ««« add move command - org.eclipse.emf.ecore.EObject targetCEObject = req.getTargetContainer(); - if(targetCEObject != null) { - org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(targetCEObject); - if(provider != null) { - org.eclipse.gmf.runtime.common.core.command.ICommand moveCommand = provider.getEditCommand(req); - if(moveCommand != null) { - return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(moveCommand); - } - } - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - } else { - return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand(req)); - } - ««« END: PapyrusGenCode - -} -''' - - /** - * FIXME need to check constraint's provider to ensure we don't generate a field - * for e.g. Java (or Literal, which is unlikely, though) expressions - * - * [Papyrus Quick Fix] Do not generate field when the expression is provided - * by a GenJavaExpressionProvider. - */ - override linkConstraints(GenDiagram it) ''' - - «generatedMemberComment()» - public static «getLinkCreationConstraintsClassName()» getLinkConstraints() { - «getLinkCreationConstraintsClassName()» cached = «xptPluginActivator.instanceAccess(it.editorGen)».getLinkConstraints(); - if (cached == null) { - «xptPluginActivator.instanceAccess(it.editorGen)».setLinkConstraints(cached = new «getLinkCreationConstraintsClassName()»()); - } - return cached; - } - -«generatedClassComment()» -public static class «getLinkCreationConstraintsClassName()» { - - «generatedMemberComment» - public «getLinkCreationConstraintsClassName()»() {«««package-local for the BaseItemSemanticEditPolicy to instantiate. Perhaps, protected is better (i.e. if someone subclasses it?) - // use static method #getLinkConstraints() to access instance - } - - «FOR nextLink : it.links» - «canCreate(nextLink)» - «ENDFOR» - - «FOR nextLink : it.links» - «canExist(nextLink)» - «ENDFOR» -} -''' - - /** - * [MG] extracted from LET statement, @see checkEMFConstraints(TypeLinkModelFacet) - */ - private def checkChildFeatureBounds(TypeLinkModelFacet it) { - childMetaFeature != containmentMetaFeature && !isUnbounded(childMetaFeature.ecoreFeature) - } - - def checkEMFConstraints(TypeLinkModelFacet it) ''' -«IF containmentMetaFeature.ecoreFeature != null» - «IF ! isUnbounded(containmentMetaFeature.ecoreFeature) || checkChildFeatureBounds(it)» - if («getContainerVariable(it)» != null) { - «checkEMFConstraints(containmentMetaFeature, it)» - «IF checkChildFeatureBounds(it)» - «checkEMFConstraints(childMetaFeature, it)» - «ENDIF» - } - «ENDIF» -«ENDIF» -''' - - override checkEMFConstraints(GenFeature it, TypeLinkModelFacet modelFacet) ''' -«IF modelFacet.containmentMetaFeature.ecoreFeature != null» -«IF ! isUnbounded(ecoreFeature)» -if («featureBoundComparator(it, getContainerVariable(modelFacet), modelFacet.getSourceType())») { - return false; -} -«ENDIF» -«ENDIF» -''' - - override canCreate(GenLink it) ''' -«generatedMemberComment()» -public boolean canCreate«stringUniqueIdentifier()»( -«IF !it.sansDomain» -«canCreateParameters(it.modelFacet)» -«ENDIF» -) { - «IF !it.sansDomain» - «checkEMFConstraints(it.modelFacet)» - «ENDIF» - return canExist«stringUniqueIdentifier()»( - «IF !it.sansDomain» - «canCreateValues(it.modelFacet)» - «ENDIF» - ); -} -''' - - override featureBoundsConditionClause(GenFeature it, String targetVar, GenClass targetType) ''' -«««Checking upper bounds if was specified in MM -«IF ecoreFeature != null» - «IF ! isUnbounded(ecoreFeature)»«featureBoundComparator(it, targetVar, targetType)»«ENDIF» - ««« Checking uniqueness in addition if upper bounds != 1 - «IF ! isSingleValued(ecoreFeature) && ! isUnbounded(ecoreFeature)» || «ENDIF» - ««« Checking uniqueness in if upper bounds !- 1 - «IF ! isSingleValued(ecoreFeature)»«featureUniquenessComparator(it, targetVar, targetType)»«ENDIF» -«ENDIF» -''' - - override featureBoundComparator(GenFeature it, String featureVar, GenClass featureVarGenClass) ''' - «xptMetaModel.getFeatureValue(it, featureVar, featureVarGenClass)» - «IF ecoreFeature.upperBound == 1» - != null - «ELSE» - .size() >= «ecoreFeature.upperBound» - «ENDIF» - ''' - - // Generate generic method if using semantic creation command based on element types framework. - def getCreateSemanticServiceEditCommand(GenDiagram it) ''' -«IF it.eResource.allContents.filter(typeof(GenerateUsingElementTypeCreationCommand)).size > 0» - «generatedMemberComment» - protected org.eclipse.gmf.runtime.common.core.command.ICommand getSemanticCreationCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) { - org.eclipse.papyrus.infra.services.edit.service.IElementEditService commandService = org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getContainer()); - if(commandService == null) { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - return commandService.getEditCommand(req); - } -«ENDIF» -''' - - /** - * XXX for now, both constraints are injected into single method - * which may not be suitable for modification especially when mixing - * java and ocl constraints (former requires manual code). - * Better approach would be: - * if either is non-null and providers are not the same - introduce two methods, - * to check source and target separately. Otherwize, do it inplace. -*/ - override canExist(GenLink it) ''' - «generatedMemberComment()» - public boolean canExist«stringUniqueIdentifier()»( - «IF !it.sansDomain» - «canExistParameters(it.modelFacet)» - «ENDIF» - ) { - «IF creationConstraints != null && creationConstraints.isValid() && it.diagram.editorGen.expressionProviders != null» - try { - «IF creationConstraints.sourceEnd != null» - «checkAdditionalConstraint(creationConstraints.sourceEnd.provider, creationConstraints.sourceEnd, 'source', 'target', creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass())» - «ENDIF» - «IF creationConstraints.targetEnd != null» - «checkAdditionalConstraint(creationConstraints.targetEnd.provider, creationConstraints.targetEnd, 'target', 'source', creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass())» - «ENDIF» - return true; - } catch(Exception e) { - «xptPluginActivator.instanceAccess(it.diagram.editorGen)».logError("Link constraint evaluation error", e); «nonNLS()» - return false; - } - «ELSE» - return true; - «ENDIF» - } - ''' - - override def getGEFWrapper(GenDiagram it) ''' - «generatedMemberComment()» - protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) { - return (cmd == null) ? org.eclipse.gef.commands.UnexecutableCommand.INSTANCE : new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd); - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend deleted file mode 100644 index 846bc041d6e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xtend +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (c) 2006-2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.emf.common.util.EList -import org.eclipse.gmf.codegen.gmfgen.GenChildNode -import org.eclipse.gmf.codegen.gmfgen.GenCompartment -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet -import org.eclipse.papyrus.papyrusgmfgenextension.ConstrainedByReferenceCompartmentItemSemanticEditPolicy -import xpt.Common -import xpt.diagram.editpolicies.childContainerCreateCommand - -@Singleton class CompartmentItemSemanticEditPolicy extends xpt.diagram.editpolicies.CompartmentItemSemanticEditPolicy { - @Inject extension Common; - @Inject extension MetaModel - - @Inject childContainerCreateCommand xptChildContainerCreateCommand; - @Inject BaseItemSemanticEditPolicy xptBaseItemSemanticEditPolicy; - - - override CompartmentItemSemanticEditPolicy(GenCompartment it) ''' - «copyright(getDiagram().editorGen)» - package «packageName(it)»; - - «generatedClassComment()» - public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» { - - «_constructor(it)» - - «xptChildContainerCreateCommand.childContainerCreateCommand( it.childNodes)» - - «additions(it)» - - ««« Papyrus REM : - ««« Test if this compartment edit policy should used a referenced constraint for the move command. - - «IF it.eResource.allContents.filter(typeof (ConstrainedByReferenceCompartmentItemSemanticEditPolicy)).filter[v | v.genView.contains(it)].size != 0» - «getChildNodeReference(childNodes)» - - «isCorrectCompartment(it)» - - «constraintedMoveCommand(it)» - - «ENDIF» - } - ''' - -def getChildNodeReference (EList<GenChildNode> it) ''' - «IF !(it.isEmpty)» - «generatedMemberComment» - private static Set<EReference> compartmentReferences; - - «generatedMemberComment» - static { - ««« compartmentReferences = new HashSet<EReference>(«it.modelFacet->size()»); - compartmentReferences = new HashSet<EReference>(); - - «FOR n : it» - «childRef(n.modelFacet,n)» - «ENDFOR» - } - «generatedMemberComment» - protected Iterable<EReference> getCompartmentReferences() { - return compartmentReferences; - } -«ENDIF» - -''' - -def childRef(TypeModelFacet it ,GenNode node) ''' - compartmentReferences.add(«MetaFeature (node.modelFacet.containmentMetaFeature)»); -''' - - -def isCorrectCompartment (GenCompartment it)''' - «generatedMemberComment» - protected boolean isMovedIntoCorrectCompartment(MoveRequest req){ - for(Object entry : req.getElementsToMove().entrySet()) { - if(entry instanceof Map.Entry<?, ?>) { - Map.Entry<?, ?> mapEntry = (Map.Entry<?, ?>)entry; - Object key = mapEntry.getKey(); - if(key instanceof EObject) { - EObject dropppedObject = (EObject)key; - EObject semanticHost = ((IGraphicalEditPart)getHost()).resolveSemanticElement(); - boolean foundERefrences = false; - if(semanticHost != null) { - for(EReference ref : getCompartmentReferences()) { - if(ref.isContainment()) { - foundERefrences = PackageUtil.canContain(semanticHost.eClass(), ref, dropppedObject.eClass(), false); - } else { - foundERefrences = PackageUtil.canReference(semanticHost.eClass(), ref, dropppedObject.eClass()); - } - if(foundERefrences) { - return true; - } - } - } - } - } - } - return false; - } -''' - -def constraintedMoveCommand (GenCompartment it)''' - «generatedMemberComment» - @Override - protected Command getMoveCommand(MoveRequest req) { - if (isMovedIntoCorrectCompartment(req)){ - return super.getMoveCommand(req); - } else { - return UnexecutableCommand.INSTANCE; - } - } -''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xtend deleted file mode 100644 index 70e7cd045fd..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xtend +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2006, 2009 Borland Software Corporation - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Singleton - -@Singleton class DiagramItemSemanticEditPolicy extends xpt.diagram.editpolicies.DiagramItemSemanticEditPolicy { - - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend deleted file mode 100644 index 6e90c98ed11..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xtend +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2007-2012 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Borland) - [243151] explicit source/target for links - * - #386838 - migrate to Xtend2 - * Vincent Lorenzo (CEA-LIST) - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Inject -import com.google.inject.Singleton -import impl.diagram.commands.DeleteLinkCommand -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet -import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingDeleteService -import utils.UtilsItemSemanticEditPolicy -import xpt.Common - -@Singleton class LinkItemSemanticEditPolicy extends xpt.diagram.editpolicies.LinkItemSemanticEditPolicy { - @Inject extension Common; - @Inject extension DeleteLinkCommand - @Inject extension UtilsItemSemanticEditPolicy - - override dispatch getDestroySemanticCommand(TypeLinkModelFacet it, GenLink genLink) ''' - ««« Test to know which delete command should be used in the generated code : "Traditional Delete Command" or the Delete Service - - «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).filter[v | v.genView.contains(genLink)].size !=0 » - - «generatedMemberComment» - «getDestroyElementCommandByService(it)» - «ELSE» - «generatedMemberComment» - protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { - org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null); - cmd.setTransactionNestingEnabled(true); - java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>(); - todestroy.add(req.getElementToDestroy()); - //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); - cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy ))); - return getGEFWrapper(cmd.reduce()); - //return getGEFWrapper(«newDeleteLinkWithClassCommand(it,genLink, 'req')»); - } - «ENDIF» - ''' - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend deleted file mode 100644 index 793aa38e235..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xtend +++ /dev/null @@ -1,253 +0,0 @@ -/** - * Copyright (c) 2007-2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - [257632] do not rely on EditPart presence for element deletion - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Inject -import com.google.inject.Singleton -import java.util.List -import org.eclipse.gmf.codegen.gmfgen.FeatureLinkModelFacet -import org.eclipse.gmf.codegen.gmfgen.GenChildNode -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet -import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingDeleteService -import utils.UtilsItemSemanticEditPolicy -import xpt.Common -import xpt.diagram.editpolicies.childContainerCreateCommand -import xpt.editor.VisualIDRegistry - -/** - * This template should be called only for non-design nodes (modelFacet != null) - * because *ItemSemanticEditPolicy responsible for dealing with semantic model - * elements and meaningless (should not be generated) for pure design nodes. - */ -@Singleton class NodeItemSemanticEditPolicy extends xpt.diagram.editpolicies.NodeItemSemanticEditPolicy { - - @Inject extension Common; - @Inject extension xpt.diagram.editpolicies.Utils_qvto; - @Inject extension UtilsItemSemanticEditPolicy - - - @Inject BaseItemSemanticEditPolicy xptBaseItemSemanticEditPolicy; - @Inject childContainerCreateCommand xptChildContainerCreateCommand; - @Inject linkCommands xptLinkCommands; - @Inject VisualIDRegistry xptVisualIDRegistry; - - - - override NodeItemSemanticEditPolicy(GenNode it) ''' - «copyright(getDiagram().editorGen)» - package «packageName(it)»; - - «generatedClassComment()» - public class «className(it)» extends «xptBaseItemSemanticEditPolicy.qualifiedClassName(getDiagram())» { - - «xptBaseItemSemanticEditPolicy.defaultConstructor(it)» - - «xptChildContainerCreateCommand.childContainerCreateCommand(it.childNodes)» - - ««« Papyrus REM : - ««« Test to know how the delete of this EditPart is done : we used the DeleteService or the "Traditional method" - - «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).filter[v | v.genView.contains(it)].size != 0» - «generatedMemberComment» - «getDestroyElementCommandByService(it)» - «ELSE» - «getDestroyElementCommand(it)» - «IF hasChildrenOrCompartments(it)» - «addDestroyChildNodesCommand(it)» - «ENDIF» - «ENDIF» - - «xptLinkCommands.linkCommands(it)» - - «additions(it)» - } - ''' - - override getDestroyElementCommand(GenNode it) ''' - «generatedMemberComment()» -protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { - org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); - org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand cmd = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), null); - cmd.setTransactionNestingEnabled(true); - ««« «destroyEdges('view')» - org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut");«nonNLS» - if (annotation == null) { - // there are indirectly referenced children, need extra commands: «it.childNodes.union(compartments.map(c | c.childNodes).flatten).exists[GenChildNode gcn | !isDirectlyOwned(gcn, it)]» - «IF hasChildrenOrCompartments(it)» - addDestroyChildNodesCommand(cmd); - «ENDIF» - addDestroyShortcutsCommand(cmd, view); - // delete host element - java.util.List<org.eclipse.emf.ecore.EObject> todestroy=new java.util.ArrayList<org.eclipse.emf.ecore.EObject>(); - todestroy.add(req.getElementToDestroy()); - //cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)); - cmd.add(new org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper(new org.eclipse.emf.edit.command.DeleteCommand(getEditingDomain(),todestroy ))); - } else {«««Here, we may play smart and don't generate else for non-toplevel nodes(which can't be shortcuts). Is it worth doing? - cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), view)); - } - return getGEFWrapper(cmd.reduce()); -} - ''' - - override addDestroyChildNodesCommand(GenNode it) ''' - «generatedMemberComment()» - protected void addDestroyChildNodesCommand(org.eclipse.gmf.runtime.common.core.command.ICompositeCommand cmd) { - org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel(); - for (java.util.Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) { - org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) nit.next(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(node); - if (vid != null) { - switch (vid) { - «FOR cn : it.childNodes» - «destroyChildNodes(cn, 'node', it)» - «ENDFOR» - «FOR compartment : it.compartments» - «xptVisualIDRegistry.caseVisualID(compartment)» - for (java.util.Iterator<?> cit = node.getChildren().iterator(); cit.hasNext();) { - org.eclipse.gmf.runtime.notation.Node cnode = (org.eclipse.gmf.runtime.notation.Node) cit.next(); - String cvid = «xptVisualIDRegistry.getVisualIDMethodCall(it.diagram)»(cnode); - if (cvid != null) { - switch (cvid) { - «FOR cn : compartment.childNodes» - «destroyChildNodes(cn, 'cnode', it)» - «ENDFOR» - } - } - } - break; - «ENDFOR» - } - } - } - } - ''' - - - /** - * @param view - Notation element for the passed node - * assumes 'cmd' to point to composite command - */ - override destroyEdges(GenNode it, String view) ''' - -««« XXX: Though semantic editpolicy is supposed to create commands that operate with semantic elements only, -««« old code used to delegate child/link deletion to respective editparts, which in turn led to semantic commands -««« being combined with notational commands (BaseItemSemanticEditPolicy#addDeleteViewCommand()). -««« --- -««« Use DiagramUpdater.get[Incoming|Outgoing]View instead, to clean links that are not present on a diagram -««« (but don't forget to clean corresponding Edge, if any) - - -«««// This part is commented for Papyrus -«««// Some Papyrus diagrams with lots of elements are reaching the 65K Java limit for method size. -«««// The following change is not supposed to modify the method behavior, just propose a slight more -«««// compact code to avoid size limit. -««« -««««IF genIncomingLinks->notEmpty()-» -««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getTargetEdges().iterator(); it.hasNext();) { -««« org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); -««««FOREACH genIncomingLinks AS il-» -««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(incomingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR il») { -««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'incomingLink') FOR il-» -««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR il»); -««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink)); -««« continue; -««« } -««««ENDFOREACH-» -««« } -««««ENDIF-» -««««IF genOutgoingLinks->notEmpty()-» -««« for («EXPAND CodeStyle::G('java.util.Iterator', '?' /*FIXME Refactor once Notation model is Java5*/)» it = «view».getSourceEdges().iterator(); it.hasNext();) { -««« org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); -««««FOREACH genOutgoingLinks AS ol-» -««« if («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(outgoingLink) == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR ol») { -««« «EXPAND impl::diagram::commands::DeleteLinkCommand::newRequest('r', 'outgoingLink') FOR ol-» -««« cmd.add(«EXPAND impl::diagram::commands::DeleteLinkCommand::newInstance('r') FOR ol»); -««« cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink)); -««« continue; -««« } -««««ENDFOREACH-» -««« } -««««ENDIF-» - - -«IF !genIncomingLinks.isEmpty()» - for (java.util.Iterator<?> it = «view».getTargetEdges().iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.Edge incomingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(incomingLink); - if (vid != null) { - switch(vid) { -«IF !genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty» -«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]» - case «VisualIDRegistry.visualID(il)»: -«ENDFOR» - org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(incomingLink.getSource().getElement(), null, incomingLink.getTarget().getElement(), false); - cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq)); - cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink)); - break; -«ENDIF» -«IF !genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty» -«FOR il : genIncomingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]» - case «VisualIDRegistry.visualID(il)»: -«ENDFOR» - org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(incomingLink.getElement(), false); - cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq)); - cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), incomingLink)); - break; -«ENDIF» - } - } - } -«ENDIF» - -«IF genOutgoingLinks.isEmpty()» - for (java.util.Iterator<?> it = «view».getSourceEdges().iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.Edge outgoingLink = (org.eclipse.gmf.runtime.notation.Edge) it.next(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(getDiagram())»(outgoingLink); - if (vid != null) { - switch(vid) { -«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet].empty» -«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof FeatureLinkModelFacet]» - case «VisualIDRegistry.visualID(ol)»: -«ENDFOR» - org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest destroyRefReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest(outgoingLink.getSource().getElement(), null, outgoingLink.getTarget().getElement(), false); - cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(destroyRefReq)); - cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink)); - break; -«ENDIF» -«IF !genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet].empty» -«FOR ol : genOutgoingLinks.filter[l | l.modelFacet instanceof TypeLinkModelFacet]» - case «VisualIDRegistry.visualID(ol)»: -«ENDFOR» - org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest destroyEltReq = new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(outgoingLink.getElement(), false); - cmd.add(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(destroyEltReq)); - cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), outgoingLink)); - break; -«ENDIF» - } - } - } -«ENDIF» - ''' - - - - private def static <T> Iterable<T> union(Iterable<? extends T> listA, Iterable<? extends T> listB) { - var List<T> result = newLinkedList(); - result.addAll(listA); - result.addAll(listB); - return result; - } - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend deleted file mode 100644 index a0fa5e6fdf1..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/OpenDiagram.xtend +++ /dev/null @@ -1,77 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Artem Tikhomirov (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.OpenDiagramBehaviour -import xpt.Common -import xpt.editor.DiagramEditorUtil - -@Singleton class OpenDiagram extends xpt.diagram.editpolicies.OpenDiagram { - @Inject extension Common; - - - @Inject DiagramEditorUtil xptDiagramEditorUtil; - - - - override openCommandClass_intializeNewDiagram(OpenDiagramBehaviour it) ''' - «generatedMemberComment» - protected org.eclipse.gmf.runtime.notation.Diagram intializeNewDiagram() throws org.eclipse.core.commands.ExecutionException { - org.eclipse.gmf.runtime.notation.Diagram d = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint()); - if (d == null) { - throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind"); - } - diagramFacet.setDiagramLink(d); - «_assert('diagramFacet.eResource() != null')» - diagramFacet.eResource().getContents().add(d); - org.eclipse.emf.ecore.EObject container = diagramFacet.eContainer(); - while (container instanceof org.eclipse.gmf.runtime.notation.View) { - ((org.eclipse.gmf.runtime.notation.View) container).persist(); - container = container.eContainer(); - } - try { - «IF null == subject.diagram.editorGen.application» - new org.eclipse.ui.actions.WorkspaceModifyOperation() { - protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, java.lang.reflect.InvocationTargetException, InterruptedException { - try { - «ENDIF» - for (java.util.Iterator<?> it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next(); - if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) { - nextResource.save(«xptDiagramEditorUtil.qualifiedClassName(subject.diagram)».getSaveOptions()); - } - } - «IF null == subject.diagram.editorGen.application» - } catch (java.io.IOException ex) { - throw new java.lang.reflect.InvocationTargetException(ex, "Save operation failed"); - } - } - }.run(null); - } catch (java.lang.reflect.InvocationTargetException e) { - throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e); - } catch (InterruptedException e) { - throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e); - } - «ELSE» - } catch (java.io.IOException ex) { - throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", ex); - } - «ENDIF» - return d; - } - ''' - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend deleted file mode 100644 index 2487fbd04ec..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextNonResizableEditPolicy.xtend +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST and other. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime - *****************************************************************************/ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Common - -/** - * FIXME: [MG] - reverse the calls? call common code from here and TextelectionEP and not vice versa -*/ -@Singleton class TextNonResizableEditPolicy extends xpt.diagram.editpolicies.TextNonResizableEditPolicy { - - @Inject extension Common; - - override TextNonResizableEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy''' - - override def TextNonResizableEditPolicy_createSelectionHandles(GenDiagram it) ''' - «generatedMemberComment» - protected java.util.List<?> createSelectionHandles() { - org.eclipse.gef.handles.MoveHandle moveHandle = - new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost()); - moveHandle.setBorder(null); - moveHandle.setDragTracker(new org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx(getHost())); - return java.util.Collections.singletonList(moveHandle); - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend deleted file mode 100644 index f9eeda69216..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/TextSelectionEditPolicy.xtend +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST and other. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime - *****************************************************************************/ -package aspects.xpt.diagram.editpolicies - -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import com.google.inject.Inject -import xpt.Common -import com.google.inject.Singleton -import xpt.CodeStyle - -@Singleton class TextSelectionEditPolicy extends xpt.diagram.editpolicies.TextSelectionEditPolicy { - - @Inject extension Common - @Inject extension CodeStyle - - // rebranch to the tooling runtime in the release train. - override TextSelectionEditPolicy_implementsClause(GenDiagram it) '''implements org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.labels.IRefreshableFeedbackEditPolicy''' - - override textFeedback_createFocusFeedbackFigure(GenDiagram it) ''' - «generatedMemberComment» - protected org.eclipse.draw2d.IFigure createFocusFeedbackFigure() { - return new org.eclipse.draw2d.Figure() { - - «overrideC» - protected void paintFigure(org.eclipse.draw2d.Graphics graphics) { - graphics.drawFocus(getBounds().getResized(-1, -1)); - } - }; - } - ''' - - override textFeedback_getHostPositionListener(GenDiagram it) ''' - «generatedMemberComment» - private org.eclipse.draw2d.FigureListener getHostPositionListener() { - if (hostPositionListener == null) { - hostPositionListener = new org.eclipse.draw2d.FigureListener() { - «overrideI» - public void figureMoved(org.eclipse.draw2d.IFigure source) { - refreshFeedback(); - } - }; - } - return hostPositionListener; - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/Utils_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/Utils_qvto.xtend deleted file mode 100644 index 4eb215bd4d6..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/Utils_qvto.xtend +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2007-2013 Borland Software Corporation && others - * - * All rights reserved. This program && the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, && is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alexander Shatalin (Borland) - initial API && implementation - * Michael Golubev (Borland) - [243151] explicit source/target for links - * - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenLinkEnd - -@Singleton class Utils_qvto extends xpt.diagram.editpolicies.Utils_qvto { - -def Boolean containsCreateStartLinkCommand(GenLinkEnd it){ - for (l : getAllPotentialLinks(it)){ - if(createStartLinkCommand(l, it)){ - return true; - } - } - - return false; -} - -def Boolean containsCreateCompleteLinkCommand(GenLinkEnd it){ - for (l : getAllPotentialLinks(it)){ - if(createCompleteLinkCommand(l, it)){ - return true; - } - } - - return false; -} - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend deleted file mode 100644 index b6edf38f735..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/childContainerCreateCommand.xtend +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright (c) 2007, 2009 Borland Software Corporation - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet -import org.eclipse.papyrus.papyrusgmfgenextension.GenerateUsingElementTypeCreationCommand -import xpt.Common -import xpt.providers.ElementTypes - -@Singleton class childContainerCreateCommand extends xpt.diagram.editpolicies.childContainerCreateCommand{ - - @Inject extension Common; - - @Inject extension ElementTypes; - - @Inject extension MetaModel; - - - override CharSequence childContainerCreateCommand(Iterable<? extends GenNode> nodes) ''' - «IF ! nodes.empty» - - «generatedMemberComment()» - protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) { - org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); - if(requestElementType == null) { - return super.getCreateCommand(req); - } - - - «FOR n : nodes» - «IF !n.sansDomain» - «childNodeCreateCommand(n.modelFacet, n)» - «ENDIF» - «ENDFOR» - return super.getCreateCommand(req); - } - «ENDIF» - ''' - - def childNodeCreateCommand(TypeModelFacet it,GenNode node)''' - if («accessElementType(node)» == requestElementType) { - «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» - // adjust the containment feature - org.eclipse.emf.ecore.EReference containmentFeature = «MetaFeature(it.childMetaFeature)»; - req.setContainmentFeature(containmentFeature); - «ENDIF» - - «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» - return getGEFWrapper(getSemanticCreationCommand(req)); - «ELSE» - return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req, org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getDiagramFrom(getHost()))); - «ENDIF» - - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend deleted file mode 100644 index 0b053d973f3..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/editpolicies/linkCommands.xtend +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Copyright (c) 2007-2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Dmitry Stadnik (Borland) - creation logic was moved in commands - * Michael Golubev (Borland) - [243151] explicit source/target for links - * - #386838 - migrate to Xtend2 - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - */ -package aspects.xpt.diagram.editpolicies - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.GenLinkEnd -import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingReorientService -import org.eclipse.papyrus.papyrusgmfgenextension.GenerateUsingElementTypeCreationCommand -import xpt.Common -import xpt.diagram.commands.CreateLinkCommand -import xpt.diagram.editpolicies.Utils_qvto -import xpt.editor.VisualIDRegistry -import xpt.providers.ElementTypes - -/** - * Start start of link creation. - * User click to this editpart and start dragging with link tool. - * Complete end of the command - * User points to this editpart as a link target and release mouse button. - * - * Outgoing the node is link source - * This element could be a source for this type of link. - * Incoming the node is link destination - * This element could be a target for this type of link. - * - * Parameters: - * - * diagram GenDiagram used to collect all defined links - * - * this Instance of GenLinkEnd for the element link could be creates to/from. - * This could be GenNode or GenLink in case of links to links, - * in the latter case it is assumed that its a TypeLink (so its model facet is LinkTypeModelFacet), - * because RefLinks don't have underlying semantic identity - * -*/ -@Singleton class linkCommands extends xpt.diagram.editpolicies.linkCommands { - @Inject extension Utils_qvto; - @Inject extension Common; - - @Inject aspects.xpt.diagram.editpolicies.Utils_qvto aspectsUtils_qvto - @Inject VisualIDRegistry xptVisualIDRegistry; - @Inject ElementTypes xptElementTypes; - @Inject CreateLinkCommand xptCreateLinkCommand; - - override createLinkCommands(GenLinkEnd it) ''' - - «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size <1» - - «generatedMemberComment()» - protected org.eclipse.gef.commands.Command getCreateRelationshipCommand( - org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { - org.eclipse.gef.commands.Command command = req.getTarget() == null ? - getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req); - return command != null ? command : super.getCreateRelationshipCommand(req); - } - «ENDIF» - - «generatedMemberComment()» - protected org.eclipse.gef.commands.Command getStartCreateRelationshipCommand( - org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { - org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); - if(requestElementType == null) { - return null; - } - org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType; - - «FOR l : getAllPotentialLinks(it)» - «startLinkCommands(l, it)» - «ENDFOR» - return null; - } - - «generatedMemberComment()» - protected org.eclipse.gef.commands.Command getCompleteCreateRelationshipCommand( - org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) { - org.eclipse.gmf.runtime.emf.type.core.IElementType requestElementType = req.getElementType(); - if(requestElementType == null) { - return null; - } - org.eclipse.gmf.runtime.emf.type.core.IElementType baseElementType = requestElementType; - - «FOR l : getAllPotentialLinks(it)» - «completeLinkCommands(l, it)» - «ENDFOR» - return null; - } - ''' - - override startLinkCommands(GenLink it, GenLinkEnd linkEnd) ''' - if («xptElementTypes.accessElementType(it)» == baseElementType) { - «IF createStartLinkCommand(it, linkEnd)» - - return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req, - «IF createStartIncomingLinkCommand(it, linkEnd)» - req.getTarget(), req.getSource() - «ELSE» - req.getSource(), req.getTarget() - «ENDIF» - )); - «ELSE» - return null; - «ENDIF» - ''' - - override completeLinkCommands(GenLink it, GenLinkEnd linkEnd) ''' - if («xptElementTypes.accessElementType(it)» == baseElementType) { - «IF createCompleteLinkCommand(it, linkEnd)» - - return getGEFWrapper(new «xptCreateLinkCommand.qualifiedClassName(it)»(req, - «IF createCompleteOutgoingLinkCommand(it, linkEnd)» - req.getTarget(), req.getSource() - «ELSE» - req.getSource(), req.getTarget() - «ENDIF» - )); - «ELSE» - return null; - «ENDIF» - ''' - - - // We overwrite the reorientTypeLinkCommands to manages the links which use the ReorientCommand provided by the EditService - override reorientTypeLinkCommands(GenLinkEnd it) ''' - «generatedMemberComment( - 'Returns command to reorient EClass based link. New link target or source\n' + 'should be the domain model element associated with this node.\n' - )» - protected org.eclipse.gef.commands.Command getReorientRelationshipCommand( - org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) { - String vid = getVisualID(req); - if (vid != null) { - switch (vid) { - «FOR link : getReroutableTypeLinks(it)» - «reorientLinkCommandWithService(link) » - «ENDFOR» - «callReorientCommand(it)» - «FOR link : getReroutableTypeLinks(it)» - «reorientLinkCommandWithoutService(link) » - «ENDFOR» - } - } - return super.getReorientRelationshipCommand(req); - } - ''' - - //This function writes only : "case myLinkEditPart.VISUAL_ID:" - //for the link which uses the ReorientCommand provided by the EditService - def reorientLinkCommandWithService(GenLink it) ''' - «IF it.eResource.allContents.filter(typeof(EditPartUsingReorientService)).filter[v| v.genView.contains(it)].size != 0» - «xptVisualIDRegistry.caseVisualID(it)» - «ENDIF» - ''' - - // This function writes the code to call the ReorientCommand provided by the ReorientService - def callReorientCommand(GenLinkEnd it) ''' - «var rServiceNodes = it.eResource.allContents.filter(typeof (EditPartUsingReorientService))» - «IF !rServiceNodes.empty» - «IF !rServiceNodes.filter[rServiceNode|(!(rServiceNode.genView.filter[view|getReroutableTypeLinks(it).toList.contains(view)].empty))].empty» - org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(req.getRelationship()); - if(provider == null) { - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - } - // Retrieve re-orient command from the Element Edit service - org.eclipse.gmf.runtime.common.core.command.ICommand reorientCommand = provider.getEditCommand(req); - if(reorientCommand == null) { - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - } - return getGEFWrapper(reorientCommand.reduce()); - «ENDIF» - «ENDIF» - ''' - - // This function writes the code for the Links which uses their own ReorientCommand (the initial code) - def reorientLinkCommandWithoutService(GenLink it) ''' - «IF it.eResource.allContents.filter(EditPartUsingReorientService).filter[v|v.genView.contains(it)].size == 0» - «reorientLinkCommand(it)» - «ENDIF» - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/PreferenceInitializer.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/PreferenceInitializer.xtend deleted file mode 100644 index fcfd307dae9..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/PreferenceInitializer.xtend +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Thibault Landre (Atos Origin) - initial API and implementation - * Patrick Tessier (CEA LIST) - */ -package aspects.xpt.diagram.preferences - -import com.google.inject.Inject -import com.google.inject.Singleton -import plugin.Activator -import xpt.Common - -@Singleton class PreferenceInitializer extends xpt.diagram.preferences.PreferenceInitializer { - @Inject extension Common; - - @Inject Activator xptActivator; - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend deleted file mode 100644 index 0e890118934..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/preferences/extensions.xtend +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Thibault Landre (Atos Origin) - initial API and implementation - */ -package aspects.xpt.diagram.preferences - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenStandardPreferencePage -import org.eclipse.gmf.codegen.gmfgen.StandardPreferencePages -import utils.PrefsConstant_qvto -import xpt.Common -import xpt.diagram.Utils_qvto - -@Singleton class extensions extends xpt.diagram.preferences.extensions { - @Inject extension Common; - @Inject extension Utils_qvto; - @Inject extension PrefsConstant_qvto; - - @Inject xpt.diagram.preferences.PreferenceInitializer xptPreferenceInitializer; - - override extensions(GenDiagram it) ''' - - «tripleSpace(1)»<extension point="org.eclipse.core.runtime.preferences" id="prefs"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<initializer class="«xptPreferenceInitializer.qualifiedClassName(it)»"/> - «tripleSpace(1)»</extension> - - «IF ! it.preferencePages.empty» - «tripleSpace(1)»<extension point="org.eclipse.ui.preferencePages" id="prefpages"> - «tripleSpace(2)»«xmlGeneratedTag» - «FOR pref : allPreferencePages(it)» - «IF pref instanceof GenStandardPreferencePage» - «papyrusPreferencePage(pref as GenStandardPreferencePage)» - «ENDIF» - «ENDFOR» - «tripleSpace(1)»</extension> - «ENDIF» - ''' - - def papyrusPreferencePage(GenStandardPreferencePage it) ''' - «IF StandardPreferencePages.GENERAL_LITERAL == kind» - <page - id="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»" - name="«getDiagram().editorGen.modelID» Diagram" - category="«getDiagramPreferencePageCategory()»" - class="«getQualifiedClassName()»"> - </page> - «ELSEIF StandardPreferencePages.PRINTING_LITERAL == kind || - StandardPreferencePages.RULERS_AND_GRID_LITERAL == kind» - <page - id="«getQualifiedClassName()»" - name="%prefpage.«ID»" - category="«getDiagramPreferencePageCategory()».«getDiagram().editorGen.modelID»" - class="«getQualifiedClassName()»"> - </page> - «ENDIF» - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend deleted file mode 100644 index 917f24898af..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/DiagramUpdater.xtend +++ /dev/null @@ -1,361 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2014 Borland Software Corporation, CEA, 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Borland) - [243151] explicit source/target for links - * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2 - * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter - */ -package aspects.xpt.diagram.updater - -import aspects.xpt.Common -import aspects.xpt.editor.VisualIDRegistry -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.gmf.codegen.gmfgen.FeatureLinkModelFacet -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenContainerBase -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenDiagramUpdater -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet -import org.eclipse.papyrus.papyrusgmfgenextension.CustomDiagramUpdaterSingleton -import org.eclipse.papyrus.papyrusgmfgenextension.SpecificDiagramUpdater -import xpt.Common_qvto -import xpt.GenModelUtils_qvto -import xpt.diagram.updater.UpdaterLinkType -import xpt.diagram.updater.Utils_qvto -import java.util.Set -import org.eclipse.emf.codegen.ecore.genmodel.GenFeature - -// we removed all static modifiers and all private methods becames protected to allow to override method. -//see bug421212: [Diagram] Papyrus should provide actions for Show/Hide related links in all diagrams -@Singleton class DiagramUpdater extends xpt.diagram.updater.DiagramUpdater { - @Inject extension Common; - @Inject extension Common_qvto; - @Inject extension Utils_qvto; - @Inject extension GenModelUtils_qvto; - @Inject xpt.diagram.updater.LinkDescriptor linkDescriptor; - @Inject VisualIDRegistry xptVisualIDRegistry; - @Inject xpt.diagram.updater.NodeDescriptor nodeDescriptor; - - @Inject MetaModel xptMetaModel; - - def diagramUpdaterInstanceToUse(GenDiagramUpdater it) ''' - «IF it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].size == - 1» - «it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].head. - singletonPath» - «ELSE» - «diagramUpdaterQualifiedClassName».INSTANCE - «ENDIF» - ''' - - protected def typeOfCrossReferenceAdapter() '''org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter''' - - override getSemanticChildrenMethodCall(GenContainerBase it) '''«diagramUpdaterInstanceToUse(it.diagramUpdater)».«getSemanticChildrenMethodName( - it)»''' - - override doGetSomeLinksMethodCall(GenCommonBase it, UpdaterLinkType linkType) '''«diagramUpdaterInstanceToUse( - it.getDiagram().diagramUpdater)».«linkGetterName(linkType)»''' - - // override runtimeTypedInstanceName(GenDiagramUpdater it) '''INSTANCE''' - // - // override runtimeTypedInstanceCall(GenDiagramUpdater it) '''«qualifiedClassName(it)».«runtimeTypedInstanceName(it)»''' - //protected constructor to allow overriding - def _constructor(GenDiagramUpdater it) ''' - «generatedMemberComment()» - protected «diagramUpdaterClassName»(){ - //to prevent instantiation allowing the override - } - ''' - - //create the singleton using custom class defined in GMFGen - public def classSingleton(GenDiagramUpdater it) ''' - «««we create the singleton only in the case where there is no custom diagram updater - «IF it.eResource.allContents.filter(typeof(CustomDiagramUpdaterSingleton)).filter[v|v.singletonPath != null].size != 1» - «generatedMemberComment()» - public static final «diagramUpdaterQualifiedClassName» INSTANCE = new «diagramUpdaterClassName»(); - «ENDIF» - ''' - - override DiagramUpdater(GenDiagramUpdater it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» implements org.eclipse.papyrus.infra.gmfdiag.common.updater.DiagramUpdater { - «classSingleton(it)» - «_constructor(it)» - «isShortcutOrphaned(it)» - «var semanticContainers = it.editorGen.diagram.allContainers.filter[container|hasSemanticChildren(container)]» - «getGenericSemanticChildrenOfView(it, semanticContainers)» - «FOR next : semanticContainers» - «getSemanticChildrenOfView(next)» - «ENDFOR» - - «getPhantomNodesIterator(it)» - - «getGenericConnectedLinks(it, getAllSemanticElements(editorGen.diagram), UpdaterLinkType::CONTAINED)» - - «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::INCOMING)» - - «getGenericConnectedLinks(it, getAllSemanticDiagramElements(editorGen.diagram), UpdaterLinkType::OUTGOING)» - «FOR e : getAllSemanticElements(editorGen.diagram)» - «getContainedLinks(e)» - «ENDFOR» - «FOR e : getAllSemanticDiagramElements(editorGen.diagram)» - «getIncomingLinks(e)» - «ENDFOR» - «FOR e : getAllSemanticDiagramElements(editorGen.diagram)» - «getOutgoingLinks(e)» - «ENDFOR» - «FOR link : getAllContainedLinks(editorGen.diagram)» - «getContainedLinksByTypeMethod(link)» - «ENDFOR» - «FOR link : getAllIncomingLinks(editorGen.diagram)» - «getIncomingLinksByTypeMethod(link)» - «ENDFOR» - «FOR link : getAllOutgoingLinks(editorGen.diagram)» - «getOutgoingLinksByTypeMethod(link)» - «ENDFOR» - - «runtimeTypedInstance(it)» - - «additions(it)» - } - ''' - - override def getConnectedLinks(GenCommonBase it, Iterable<GenLink> genLinks, UpdaterLinkType linkType, - boolean needCrossReferencer) ''' - - «generatedMemberComment» - «««remove static modifier - public «listOfLinkDescriptors(it)» «linkGetterName(it, linkType)»(org.eclipse.gmf.runtime.notation.View view) { - «IF genLinks.notEmpty» - «xptMetaModel.DeclareAndAssign(it.metaClass, 'modelElement', 'view.getElement()')» - «IF needCrossReferencer» - «typeOfCrossReferenceAdapter» crossReferencer = «typeOfCrossReferenceAdapter».getCrossReferenceAdapter(view.eResource().getResourceSet()); - «ENDIF» - «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»(); - «FOR link : genLinks» - «colectConnectedLinks(link, linkType, needCrossReferencer, isExternalInterface(it.metaClass))» - «ENDFOR» - return result; - «ELSE» - return «newEmptyList()»; - «ENDIF» - } - ''' - - override def colectConnectedLinks(GenLink it, UpdaterLinkType linkType, boolean needCrossReferencer, - boolean isExternalInterface) ''' - «IF it.modelFacet != null» - «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))» - if («xptMetaModel.IsInstance(it.modelFacet.getLinkEndType(linkType), 'modelElement')») { - «ENDIF» - result.addAll(«chooseConnectedLinksByTypeMethodName(it.modelFacet, linkType, it)»(« // - IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))»«xptMetaModel. - CastEObject(it.modelFacet.getLinkEndType(linkType), 'modelElement')»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferencer«ENDIF»)); - «IF isExternalInterface && !it.modelFacet.oclIsKindOf(typeof(FeatureLinkModelFacet))» - } - «ENDIF» - «ENDIF» - ''' - - override def getIncomingLinksByTypeMethod(GenLink it) ''' - «generatedMemberComment» - «««remove static modifier + private->protected - protected java.util.Collection<«linkDescriptor.qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName( - UpdaterLinkType::INCOMING)»(«xptMetaModel.QualifiedClassName(it.modelFacet.targetType)» target, «typeOfCrossReferenceAdapter» crossReferencer) { - «newLinkedListOfLinkDescriptors(it.diagramUpdater, 'result')»(); - java.util.Collection<org.eclipse.emf.ecore.EStructuralFeature.Setting> settings = crossReferencer.getInverseReferences(target); - for (org.eclipse.emf.ecore.EStructuralFeature.Setting setting : settings) { - «getIncomingLinksByTypeMethodBody(it.modelFacet, it)» - } - return result; - } - ''' - - def CharSequence getICustomDiagramUpdater(GenContainerBase it) '''org.eclipse.papyrus.uml.diagram.common.part.ICustomDiagramUpdater<«nodeDescriptor. - qualifiedClassName(it.diagramUpdater)»>''' - - override getSemanticChildrenOfView(GenContainerBase it) ''' - «««remove static modifier - «IF it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v|v.genNode == it && v.classpath != null]. - size != 0» - «generatedMemberComment» - «FOR updater : it.eResource.allContents.filter(typeof(SpecificDiagramUpdater)).filter[v| - v.genNode == it && v.classpath != null].toIterable» - public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - «getICustomDiagramUpdater(it)» customUpdater = new «updater.classpath»(); - return customUpdater.getSemanticChildren(view); - } - «ENDFOR» - «ELSE» - «generatedMemberComment» - public «listOfNodeDescriptors» «getSemanticChildrenMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - «IF getSemanticChildrenChildFeatures(it).notEmpty || it.getPhantomNodes().notEmpty» - «defineModelElement(it)» - «newLinkedListOfNodeDescriptors(it.diagramUpdater, 'result')»(); - «/* childMetaFeature can be null here! */FOR childMetaFeature : getSemanticChildrenChildFeatures(it)» - «IF null == childMetaFeature» - { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = - /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/; - «ELSEIF childMetaFeature.listType» - for (java.util.Iterator<?> it = «xptMetaModel.getFeatureValue(childMetaFeature, 'modelElement', it.getModelElementType())».iterator(); it.hasNext();) { - «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'it.next()', true)» - «ELSE» - { «xptMetaModel.DeclareAndAssign(childMetaFeature.typeGenClass, 'childElement', 'modelElement', - it.getModelElementType(), childMetaFeature)» - «ENDIF» - String visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it.diagram)»(view, «xptMetaModel. - DowncastToEObject(childMetaFeature.typeGenClass, 'childElement')»); - «FOR next : getSemanticChildren(it, childMetaFeature)» - «checkChildElementVisualID(next, null != childMetaFeature && childMetaFeature.listType)» - «ENDFOR» - } - «ENDFOR» - «IF it.getPhantomNodes.notEmpty» - org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource(); - for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = getPhantomNodesIterator(resource); it.hasNext();) { - org.eclipse.emf.ecore.EObject childElement = it.next(); - if (childElement == modelElement) { - continue; - } - «FOR phantom : it.phantomNodes» - «addNextIfPhantom(phantom)» - «ENDFOR» - } - «ENDIF» - return result; - «ELSE» - return «newEmptyList()»; - «ENDIF» - } - «ENDIF» - ''' - - - override defineLinkSource(TypeLinkModelFacet it, boolean inLoop) ''' - «IF sourceMetaFeature.listType» - java.util.List<?> sources = «xptMetaModel.getFeatureValue(sourceMetaFeature, 'link', metaClass)»; - Object theSource = sources.size() == 1 ? sources.get(0) : null; - if («xptMetaModel.NotInstance(it.sourceType, 'theSource')») { - «stopLinkProcessing(inLoop)» - } - «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'theSource', true)» - «ELSE» - «xptMetaModel.DeclareAndAssign(it.sourceType, 'src', 'link', metaClass, sourceMetaFeature)» - «ENDIF» - ''' - - def isDiagram(GenDiagram it) '''''' - - override defineLinkDestination(TypeLinkModelFacet it, Boolean inLoop) ''' - «IF targetMetaFeature.listType» - java.util.List<?> targets = «xptMetaModel.getFeatureValue(it.targetMetaFeature, 'link', metaClass)»; - Object theTarget = targets.size() == 1 ? targets.get(0) : null; - if («xptMetaModel.NotInstance(it.targetType, 'theTarget')») { - «stopLinkProcessing(inLoop)» - } - «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'theTarget', true)» - «ELSE» - «xptMetaModel.DeclareAndAssign(it.targetType, 'dst', 'link', metaClass, targetMetaFeature)» - «ENDIF» - ''' - - //remove static modifier + private->protected - override getOutgoingLinksByTypeMethodSignature(GenLink it) '''protected java.util.Collection<«linkDescriptor. - qualifiedClassName(it.diagramUpdater)»> «getConnectedLinksByTypeMethodName(UpdaterLinkType::OUTGOING)»(«xptMetaModel. - QualifiedClassName(it.modelFacet.sourceType)» source)''' - - override getGenericSemanticChildrenOfView(GenDiagramUpdater it, Iterable<GenContainerBase> semanticContainers) ''' - - «generatedMemberComment» - ««« remove static modifier - public «listOfNodeDescriptors» getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) { - «IF semanticContainers.notEmpty» - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(view); - if (vid != null) { - switch (vid) { - «FOR next : semanticContainers» - «getSemanticChildrenCase(next)» - «ENDFOR» - } - } - «ENDIF» - return «newEmptyList()»; - } - ''' - - override dispatch getContainedLinksByTypeMethod(TypeLinkModelFacet it, GenLink genLink) ''' - - «generatedMemberComment» - ««« remove static modifier + private->protected - protected java.util.Collection<«linkDescriptor.qualifiedClassName(genLink.diagramUpdater)»> «getConnectedLinksByTypeMethodName( - genLink, UpdaterLinkType::CONTAINED)»(«xptMetaModel.QualifiedClassName(childMetaFeature.genClass)» container) { - «getContainedLinksByTypeMethodBody(it, genLink, false)» - } - ''' - - override getGenericConnectedLinks(GenDiagramUpdater it, Iterable<? extends GenCommonBase> linkContainers, - UpdaterLinkType linkType) ''' - - «generatedMemberComment» - ««« remove static modifier - public «listOfLinkDescriptors» get«linkType.linkMethodSuffix»Links(org.eclipse.gmf.runtime.notation.View view) { - «IF linkContainers.notEmpty» - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view); - if (vid != null) { - switch (vid) { - «FOR next : linkContainers» - «getContainedLinksCase(next, linkType)» - «ENDFOR» - } - } - «ENDIF» - return «newEmptyList»; - } - ''' - - override runtimeTypedInstance(GenDiagramUpdater it) ''' - ''' - - /** - * XXX: [MG] suspicious code inside, EVEN after I moved ", " into the IF, there still may be problem if inner IF condition is not met. - * Need to check with case when it.modelFacet.childMetaFeature == null - */ - override def checkChildElementVisualID(GenNode it, Boolean inLoop) ''' - if («VisualIDRegistry::visualID(it)».equals(visualID)) { - result.add(new «nodeDescriptor.qualifiedClassName(it.getDiagram().diagramUpdater)»(«IF null != modelFacet.childMetaFeature»«xptMetaModel.DowncastToEObject(modelFacet.childMetaFeature.typeGenClass, 'childElement')», «ENDIF»visualID)); - «IF inLoop» - continue; - «ENDIF» - } - ''' - - override def checkLinkVisualID(TypeLinkModelFacet it, GenLink genLink, boolean inLoop) ''' - if (!«VisualIDRegistry::visualID(genLink)».equals(«xptVisualIDRegistry.getLinkWithClassVisualIDMethodCall(genLink.diagram)»(«xptMetaModel.DowncastToEObject(metaClass, 'link')»))) { - «stopLinkProcessing(inLoop)» - } - ''' - - override def getSemanticChildrenMethodName(GenContainerBase it) '''get«stringUniqueIdentifier()»_SemanticChildren''' - - override protected def linkGetterName(GenCommonBase it, UpdaterLinkType linkType) '''get«stringUniqueIdentifier()»_«linkType.linkMethodSuffix»Links''' - - override def getConnectedLinksByTypeMethodName(GenLink it, UpdaterLinkType linkType) '''get«linkType.linkMethodSuffix»«getConnectedLinksByTypeMethodFragment(modelFacet)»_«stringVisualID»''' - - override def dispatch getConnectedLinksByTypeMethodFragment(TypeLinkModelFacet it) '''TypeModelFacetLinks''' - - override def dispatch getConnectedLinksByTypeMethodFragment(FeatureLinkModelFacet it) '''FeatureModelFacetLinks''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/Extensions.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/Extensions.xtend deleted file mode 100644 index a402f262ff2..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/Extensions.xtend +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2007, 2009 Borland Software Corporation - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Alexander Shatalin (Borland) - initial API and implementation - * Gabriel Pascual (ALL4TEC) - Bug 372322 - */ -package aspects.xpt.diagram.updater - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagramUpdater - -@Singleton class Extensions extends xpt.diagram.updater.extensions{ - - override def extensions(GenDiagramUpdater it) { - // Override Refresh contribution - } - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend deleted file mode 100644 index d5ebb0ee871..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/LinkDescriptor.xtend +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2014 Borland Software Corporation, CEA, 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Borland) - [243151] explicit source/target for links - * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2 - * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter - */ -package aspects.xpt.diagram.updater - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagramUpdater -import xpt.Common - -@Singleton class LinkDescriptor extends xpt.diagram.updater.LinkDescriptor { - @Inject extension Common; - - override def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterLinkDescriptor''' - - override def refOnlyLinkConstructor(GenDiagramUpdater it) ''' - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) { - super(source, destination, elementType, linkVID); - } - ''' - - override def typeLinkConstructor(GenDiagramUpdater it) ''' - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, String linkVID) { - super(source, destination, linkElement, elementType, linkVID); - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend deleted file mode 100644 index 5dbb3e1e4ae..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/updater/NodeDescriptor.xtend +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2014 Borland Software Corporation, CEA, 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Borland) - [243151] explicit source/target for links - * Michael Golubev (Montages) - API extracted to gmf.tooling.runtime, template migrated to Xtend2 - * Christian W. Damus (CEA) - bug 426732: override the cross-reference searches for views to use the CrossReferenceAdapter - */ -package aspects.xpt.diagram.updater - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagramUpdater -import xpt.Common - -@Singleton class NodeDescriptor extends xpt.diagram.updater.NodeDescriptor { - @Inject extension Common; - - override def extendsList(GenDiagramUpdater it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.updater.UpdaterNodeDescriptor''' - - override def constructor(GenDiagramUpdater it) ''' - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.ecore.EObject modelElement, String visualID) { - super(modelElement, visualID); - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend deleted file mode 100644 index bc7e4fc26bb..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/diagram/views/ViewStyles.xtend +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) 2007, 2009 Borland Software Corporation - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Dmitry Stadnik (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.diagram.views - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel -import org.eclipse.gmf.codegen.gmfgen.GenLabel -import xpt.diagram.Utils_qvto -import xpt.diagram.ViewmapAttributesUtils_qvto - -/** - * Renamed from xpt::diagram::views::Utils.xpt - * in order to have consistent naming between Xtend files migrated from _qvto helpers and xpt templates - */ -@Singleton class ViewStyles extends xpt.diagram.views.ViewStyles{ - @Inject extension Common; - @Inject extension ViewmapAttributesUtils_qvto; - @Inject extension Utils_qvto; - - - - override dispatch offset(GenExternalNodeLabel it, String viewVar) ''' - «IF labelOffsetX(viewmap, 0) != 0 || labelOffsetY(viewmap, 0) != 0» - «offset(it,viewVar, labelOffsetX(viewmap, 0), labelOffsetY(viewmap, 0))» - «ELSE» - «offset(it,viewVar, 0, 15)» - «ENDIF» - ''' - - override def offset(GenLabel it, String viewVar, int x, int y) ''' - «val location = stringUniqueIdentifier.toFirstLower+'_Location'» - org.eclipse.gmf.runtime.notation.Location «location» = (org.eclipse.gmf.runtime.notation.Location) «viewVar».getLayoutConstraint(); - «IF it.getDiagram().isPixelMapMode()» - «location».setX(«x»); - «location».setY(«y»); - «ELSE» - «location».setX(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«x»)); - «location».setY(org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(«viewVar».getDiagram().getMeasurementUnit()).DPtoLP(«y»)); - «ENDIF» - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend deleted file mode 100644 index a9b3fa8ab2d..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ActionBarContributor.xtend +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.editor - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenEditorView -import xpt.Common - -@Singleton class ActionBarContributor extends xpt.editor.ActionBarContributor { - @Inject extension Common; - @Inject Editor xptEditor; - - override def ActionBarContributor(GenEditorView it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» «extendsList(it)» { - - «generatedMemberComment» - - protected Class<«xptEditor.qualifiedClassName(it)»> getEditorClass() { - return «xptEditor.qualifiedClassName(it)».class; - } - - «generatedMemberComment» - protected String getEditorId() { - return «xptEditor.qualifiedClassName(it)».ID; - } - «initMethod(it)» - «additions(it)» - } - ''' - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend deleted file mode 100644 index 29754ba7811..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/CreationWizard.xtend +++ /dev/null @@ -1,174 +0,0 @@ -package aspects.xpt.editor - -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Common -import com.google.inject.Inject -import xpt.CodeStyle -import xpt.editor.GenDiagram_qvto -import xpt.editor.CreationWizardPage -import xpt.Externalizer -import plugin.Activator -import xpt.editor.DiagramEditorUtil -import xpt.ExternalizerUtils_qvto -import com.google.inject.Singleton - -@Singleton class CreationWizard extends xpt.editor.CreationWizard { - - @Inject extension Common - @Inject extension CodeStyle - @Inject extension ExternalizerUtils_qvto - @Inject extension GenDiagram_qvto - - @Inject Activator xptActivator - @Inject CreationWizardPage xptCreationWizardPage - @Inject DiagramEditorUtil xptDiagramEditorUtil - @Inject Externalizer xptExternalizer - - override CreationWizard(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» - «extendsList(it)» «implementsList(it)» { - - «generatedMemberComment» - private org.eclipse.ui.IWorkbench workbench; - - «generatedMemberComment» - protected org.eclipse.jface.viewers.IStructuredSelection selection; - - «generatedMemberComment» - protected «xptCreationWizardPage.qualifiedClassName(it)» diagramModelFilePage; - - «IF standaloneDomainModel(it)» - «generatedMemberComment» - protected «xptCreationWizardPage.qualifiedClassName(it)» domainModelFilePage; - «ENDIF» - - «generatedMemberComment» - protected org.eclipse.emf.ecore.resource.Resource diagram; - - «generatedMemberComment» - private boolean openNewlyCreatedDiagramEditor = true; - - «generatedMemberComment» - public org.eclipse.ui.IWorkbench getWorkbench() { - return workbench; - } - - «generatedMemberComment» - public org.eclipse.jface.viewers.IStructuredSelection getSelection() { - return selection; - } - - «generatedMemberComment» - public final org.eclipse.emf.ecore.resource.Resource getDiagram() { - return diagram; - } - - «generatedMemberComment» - public final boolean isOpenNewlyCreatedDiagramEditor() { - return openNewlyCreatedDiagramEditor; - } - - «generatedMemberComment» - public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) { - this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor; - } - - «generatedMemberComment» - public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(«xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForCreationWizard(it)))»); - setDefaultPageImageDescriptor(«xptActivator.qualifiedClassName(editorGen.plugin)».getBundledImageDescriptor( - "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$ - setNeedsProgressMonitor(true); - } - - «generatedMemberComment» - public void addPages() { - diagramModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»( - "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$ - diagramModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForCreationWizardDiagramPage(it)))»); - diagramModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen, - descriptionKey(i18nKeyForCreationWizardDiagramPage(it)))»); - addPage(diagramModelFilePage); - «IF standaloneDomainModel(it)» - - domainModelFilePage = new «xptCreationWizardPage.qualifiedClassName(it)»( - "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$ - - «overrideC» - public void setVisible(boolean visible) { - if (visible) { - String fileName = diagramModelFilePage.getFileName(); - fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$ - setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName( - getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$ - } - super.setVisible(visible); - } - }; - domainModelFilePage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForCreationWizardDomainPage(it)))»); - domainModelFilePage.setDescription(«xptExternalizer.accessorCall(editorGen, - descriptionKey(i18nKeyForCreationWizardDomainPage(it)))»); - addPage(domainModelFilePage); - «ENDIF» - } - - «generatedMemberComment» - public boolean performFinish() { - org.eclipse.jface.operation.IRunnableWithProgress op = - «IF editorGen.application == null» - new org.eclipse.ui.actions.WorkspaceModifyOperation(null) { - - «overrideC» - protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) - throws org.eclipse.core.runtime.CoreException, InterruptedException { - «ELSE» - new org.eclipse.jface.operation.IRunnableWithProgress() { - - public void run(org.eclipse.core.runtime.IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - «ENDIF» - diagram = «xptDiagramEditorUtil.qualifiedClassName(it)».createDiagram(diagramModelFilePage.getURI(), - «IF standaloneDomainModel(it)» - domainModelFilePage.getURI(), - «ENDIF» - monitor); - if (isOpenNewlyCreatedDiagramEditor() && diagram != null) { - try { - «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagram); - } catch (org.eclipse.ui.PartInitException e) { - org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(), - «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardOpenEditorError(it))», null, e.getStatus()); - } - } - } - }; - try { - getContainer().run(false, true, op); - } catch (InterruptedException e) { - return false; - } catch (java.lang.reflect.InvocationTargetException e) { - if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) { - org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(), - «xptExternalizer.accessorCall(editorGen, i18nKeyForCreationWizardCreationError(it))», null, - ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus()); - } else { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Error creating diagram", e.getTargetException()); //$NON-NLS-1$ - } - return false; - } - return diagram != null; - } - «additions(it)» - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend deleted file mode 100644 index dff428d05d8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DeleteElementAction.xtend +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2008, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2, use GMFT runtime - * Vincent Lorenzo (CEA LIST) - * - */ -package aspects.xpt.editor - -import com.google.inject.Singleton - -//This class is not used, now we use org.eclipse.papyrus.common.actions.DeleteFromModelAction -@Singleton class DeleteElementAction extends xpt.editor.DeleteElementAction { - - - -// override DeleteElementAction(GenDiagram it) ''' -// //This file is not used. -// //The DeleteElementAction is removed from the plugin and replaced by DeleteFromModelAction in the plugin org.eclipse.diagram.common. -// ''' - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend deleted file mode 100644 index 02b9853d772..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramContentInitializer.xtend +++ /dev/null @@ -1,30 +0,0 @@ -package aspects.xpt.editor - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenContainerBase -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -@Singleton class DiagramContentInitializer extends xpt.editor.DiagramContentInitializer { - @Inject extension Common; - - @Inject VisualIDRegistry xptVisualIDRegistry; - - override def getCompartment(GenDiagram it) ''' - «generatedMemberComment» - private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, String visualID) { - String type = «xptVisualIDRegistry.typeMethodCall(it, 'visualID')»; - for (java.util.Iterator it = node.getChildren().iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); - if (nextView instanceof org.eclipse.gmf.runtime.notation.Node && type.equals(nextView.getType())) { - return (org.eclipse.gmf.runtime.notation.Node) nextView; - } - } - return null; - } - ''' - - override def createChildrenMethodName(GenContainerBase it) '''create«it.stringUniqueIdentifier»_Children''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend deleted file mode 100644 index 07c5e97ef5f..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorContextMenuProvider.xtend +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright (c) 2008, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Vincent Lorenzo (CEA LIST) - */ -package aspects.xpt.editor - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import plugin.Activator -import xpt.Common
import xpt.CodeStyle - -//We remove the dependance with DeleteElementAction. Now this action is added to the popup menu with the extension point org.eclipse.ui.popup -//in org.eclipse.papyrus.uml.diagram.common -@Singleton class DiagramEditorContextMenuProvider extends xpt.editor.DiagramEditorContextMenuProvider { - @Inject extension Common; - @Inject extension CodeStyle - - @Inject Activator xptActivator; - - - override DiagramEditorContextMenuProvider(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» extends org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider { - - «generatedMemberComment» - private org.eclipse.ui.IWorkbenchPart part; - - ««« «generatedMemberComment» - ««« private «xptDeleteElementAction.qualifiedClassName(it)» deleteAction; - - «generatedMemberComment» - public DiagramEditorContextMenuProvider(org.eclipse.ui.IWorkbenchPart part, org.eclipse.gef.EditPartViewer viewer) { - super(part, viewer); - this.part = part; - ««« deleteAction = new «xptDeleteElementAction.qualifiedClassName(it)»(part); - ««« deleteAction.init(); - } - - ««« «generatedMemberComment» - ««« public void dispose() { - ««« if (deleteAction != null) { - ««« deleteAction.dispose(); - ««« deleteAction = null; - ««« } - ««« super.dispose(); - ««« } - - «generatedMemberComment» - public void buildContextMenu(final org.eclipse.jface.action.IMenuManager menu) { - getViewer().flush(); - try { - org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain( - (org.eclipse.emf.ecore.EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() { - - «overrideI(it.editorGen.diagram)» - public void run() { - org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService.getInstance().contributeToPopupMenu( - DiagramEditorContextMenuProvider.this, part); - menu.remove(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL); - ««« menu.appendToGroup("editGroup", deleteAction); - } - }); - } catch (Exception e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Error building context menu", e); - } - } - «additions(it)» - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend deleted file mode 100644 index 0fa3f092235..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DiagramEditorUtil.xtend +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST and other. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - #510281 change dependency to replace gmft-runtime - *****************************************************************************/ -package aspects.xpt.editor - -import com.google.inject.Inject -import xpt.Common -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Externalizer -import xpt.CodeStyle -import metamodel.MetaModel -import plugin.Activator -import xpt.editor.GenDiagram_qvto -import com.google.inject.Singleton - -@Singleton class DiagramEditorUtil extends xpt.editor.DiagramEditorUtil { - - @Inject extension Common - @Inject extension CodeStyle - @Inject extension GenDiagram_qvto - - @Inject Activator xptActivator - @Inject Externalizer xptExternalizer - @Inject MetaModel xptMetaModel - - override def getUniqueFileNameMethod(GenDiagram it) ''' - «generatedMemberComment» - public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) { - return org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.getUniqueFileName(containerFullPath, fileName, extension, «» - org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultDiagramEditorUtil.«IF editorGen.application == null»EXISTS_IN_WORKSPACE«ELSE»EXISTS_AS_IO_FILE«ENDIF»); - } - ''' - - override createDiagramMethod(GenDiagram it) ''' - «generatedMemberComment( - (if(editorGen.application == null) 'This method should be called within a workspace modify operation since it creates resources.' else ''))» - public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel( - it)» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) { - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain(); - progressMonitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForCreateDiagramProgressTask(it))», 3); - final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI); - «IF standaloneDomainModel(it)» - final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI); - «ELSEIF domainDiagramElement != null && hasDocumentRoot(it)/*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/» - ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE); - «ENDIF» - final String diagramName = diagramURI.lastSegment(); - org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «xptExternalizer. - accessorCall(editorGen, i18nKeyForCreateDiagramCommandLabel(it))», java.util.Collections.EMPTY_LIST) { - «overrideC» - protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { - «IF domainDiagramElement != null» - «xptMetaModel.QualifiedClassName(domainDiagramElement)» model = createInitialModel(); - attachModelToResource(model, «IF standaloneDomainModel(it)»model«ELSE»diagram«ENDIF»Resource); - «ENDIF» - «extraLineBreak» - org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram( - «IF domainDiagramElement != null» - «xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')», - «ENDIF» - «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»); - if (diagram != null) { - diagramResource.getContents().add(diagram); - diagram.setName(diagramName); - «IF domainDiagramElement != null» - diagram.setElement(«xptMetaModel.DowncastToEObject(domainDiagramElement, 'model')»); - «ENDIF» - } - - try { - «IF standaloneDomainModel(it)»modelResource.save(«callGetSaveOptions(it)»);«ENDIF» - diagramResource.save(«callGetSaveOptions(it)»); - } catch (java.io.IOException e) { - «/* - * TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx? - * */ - extraLineBreak» - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to store model and diagram resources", e); «nonNLS(1)» - } - return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(); - } - }; - try { - org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.SubProgressMonitor(progressMonitor, 1), null); - } catch (org.eclipse.core.commands.ExecutionException e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Unable to create model and diagram", e); «nonNLS( - 1)» - } - «IF editorGen.application == null» - «IF standaloneDomainModel(it)»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF» - setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource)); - «ENDIF» - return diagramResource; - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend deleted file mode 100644 index 5d809566671..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/DocumentProvider.xtend +++ /dev/null @@ -1,336 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.editor - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import plugin.Activator -import xpt.Common -import xpt.Externalizer -import xpt.CodeStyle -import xpt.editor.DiagramEditorUtil - -@Singleton class DocumentProvider extends xpt.editor.DocumentProvider { - @Inject extension Common; - @Inject extension CodeStyle - - @Inject Activator xptActivator; - @Inject Externalizer xptExternalizer; - @Inject DiagramEditorUtil xptDiagramEditorUtil - - - - override setDocumentContent(GenDiagram it) ''' - «generatedMemberComment» - protected void setDocumentContent(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, org.eclipse.ui.IEditorInput element) throws org.eclipse.core.runtime.CoreException { - org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document; - org.eclipse.emf.transaction.TransactionalEditingDomain domain = diagramDocument.getEditingDomain(); - «IF null == it.editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») { - org.eclipse.core.resources.IStorage storage = ((«fileEditorInputClassFQName(it)») element).getStorage(); - org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil.load(domain, storage, true, getProgressMonitor()); - document.setContent(diagram); - } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») { - org.eclipse.emf.common.util.URI uri = ((«uriEditorInputClassFQName(it)») element).getURI(); - org.eclipse.emf.ecore.resource.Resource resource = null; - try { - resource = domain.getResourceSet().getResource(uri.trimFragment(), false); - if (resource == null) { - resource = domain.getResourceSet().createResource(uri.trimFragment()); - } - if (!resource.isLoaded()) { - try { - @SuppressWarnings({ "rawtypes", "unchecked" }) - java.util.Map<?,?> options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions()); - // @see 171060 - // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); - resource.load(options); - } catch (java.io.IOException e) { - resource.unload(); - throw e; - } - } - if (uri.fragment() != null) { - org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment()); - if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) { - document.setContent(rootElement); - return; - } - } else { - for (java.util.Iterator<org.eclipse.emf.ecore.EObject> it = resource.getContents().iterator(); it.hasNext();) { - Object rootElement = it.next(); - if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) { - document.setContent(rootElement); - return; - } - } - } - throw new RuntimeException(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderNoDiagramInResourceError(it))»); - } catch (Exception e) { - org.eclipse.core.runtime.CoreException thrownExcp = null; - if (e instanceof org.eclipse.core.runtime.CoreException) { - thrownExcp = (org.eclipse.core.runtime.CoreException) e; - } else { - String msg = e.getLocalizedMessage(); - thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(it.editorGen.plugin)».ID, 0, - msg != null ? msg : «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentProviderDiagramLoadingError(it))», e)); - } - throw thrownExcp; - } - } else { - «throwIncorrectInputException(it)» - } - } - ''' - - override createEditingDomain(GenDiagram it) ''' - «generatedMemberComment» - private org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() { - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory.getInstance().createEditingDomain(); - editingDomain.setID("«editingDomainID»"); «nonNLS(1)» - final org.eclipse.emf.transaction.NotificationFilter diagramResourceModifiedFilter = org.eclipse.emf.transaction.NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()).and(org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.ADD)).and(org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.ResourceSet.class, org.eclipse.emf.ecore.resource.ResourceSet.RESOURCE_SET__RESOURCES)); - editingDomain.getResourceSet().eAdapters().add(new org.eclipse.emf.common.notify.Adapter() { - - private org.eclipse.emf.common.notify.Notifier myTarger; - - «overrideI» - public org.eclipse.emf.common.notify.Notifier getTarget() { - return myTarger; - } - - «overrideI» - public boolean isAdapterForType(Object type) { - return false; - } - - «overrideI» - public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) { - if (diagramResourceModifiedFilter.matches(notification)) { - Object value = notification.getNewValue(); - if (value instanceof org.eclipse.emf.ecore.resource.Resource) { - ((org.eclipse.emf.ecore.resource.Resource) value).setTrackingModification(true); - } - } - } - - «overrideI» - public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) { - myTarger = newTarget; - } - - }); - - return editingDomain; - } - ''' - - override doSaveDocument(GenDiagram it) ''' - «generatedMemberComment» - protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor, Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, boolean overwrite) throws org.eclipse.core.runtime.CoreException { - ResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - if (!overwrite && !info.isSynchronized()) { - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, - «IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF», - «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentUnsynchronizedFileSaveError(it))», - null)); - } - «IF null == editorGen.application» - info.stopResourceListening(); - «ENDIF» - fireElementStateChanging(element); - try { - monitor.beginTask(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveDiagramTask(it))», info.getResourceSet().getResources().size() + 1); //"Saving diagram" - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - monitor.setTaskName(org.eclipse.osgi.util.NLS.bind( - «xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveNextResourceTask(it))», - nextResource.getURI())); - if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) { - try { - nextResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); - } catch (java.io.IOException e) { - fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null)); - } - } - monitor.worked(1); - } - monitor.done(); - info.setModificationStamp(computeModificationStamp(info)); - } catch (RuntimeException x) { - fireElementStateChangeFailed(element); - throw x; - } «IF null == editorGen.application» finally { - info.startResourceListening(); - } «ENDIF» - } else { - org.eclipse.emf.common.util.URI newResoruceURI; - java.util.List<org.eclipse.core.resources.IFile> affectedFiles = null; - «IF null == editorGen.application»if (element instanceof «fileEditorInputClassFQName(it)») { - org.eclipse.core.resources.IFile newFile = ((«fileEditorInputClassFQName(it)») element).getFile(); - affectedFiles = java.util.Collections.singletonList(newFile); - newResoruceURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true); - } else «ENDIF»if(element instanceof «uriEditorInputClassFQName(it)») { - newResoruceURI = ((«uriEditorInputClassFQName(it)») element).getURI(); - } else { - fireElementStateChangeFailed(element); - «throwIncorrectInputException(it)» - } - if (false == document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) { - fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, - "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); «nonNLS(1)» «nonNLS(2)» - } - org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document; - final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI); - final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram()); - try { - new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«xptExternalizer.accessorCall(editorGen, i18nKeyForDocumentSaveAs(it))», diagramCopy.getName()), affectedFiles) { - «overrideC» - protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException { - newResource.getContents().add(diagramCopy); - return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(); - } - }.execute(monitor, null); - newResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); - } catch (org.eclipse.core.commands.ExecutionException e) { - fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null)); - } catch (java.io.IOException e) { - fireElementStateChangeFailed(element); - throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «xptActivator.qualifiedClassName(editorGen.plugin)».ID, 0, e.getLocalizedMessage(), null)); - } - newResource.unload(); - } - } - ''' - - override computeSchedulingRule(GenDiagram it) ''' - «generatedMemberComment» - private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.eclipse.core.resources.IResource toCreateOrModify) { - if (toCreateOrModify.exists()) { - return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify); - } - org.eclipse.core.resources.IResource parent = toCreateOrModify; - do {«/*FIXME [MG] the bug is closed long ago, still need? */» - /* - * XXX This is a workaround for - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601 - * IResourceRuleFactory.createRule should iterate the hierarchy - * itself. - */ - toCreateOrModify = parent; - parent = toCreateOrModify.getParent(); - } while (parent != null && !parent.exists()); - - return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify); - } - ''' - - override doValidateState(GenDiagram it) ''' - «generatedMemberComment» - protected void doValidateState(Object element, Object computationContext) throws org.eclipse.core.runtime.CoreException { - ResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - java.util.LinkedList<org.eclipse.core.resources.IFile> files2Validate = new java.util.LinkedList<org.eclipse.core.resources.IFile>(); - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource); - if (file != null && file.isReadOnly()) { - files2Validate.add(file); - } - } - org.eclipse.core.resources.ResourcesPlugin.getWorkspace().validateEdit(files2Validate.toArray(new org.eclipse.core.resources.IFile[files2Validate.size()]), computationContext); - } - - super.doValidateState(element, computationContext); - } - ''' - - override getResetRule(GenDiagram it) ''' - «generatedMemberComment» - protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object element) { - ResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> rules = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>(); - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file)); - } - } - return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()])); - } - return null; - } - ''' - - override getSaveRule(GenDiagram it) ''' - «generatedMemberComment» - protected org.eclipse.core.runtime.jobs.ISchedulingRule getSaveRule(Object element) { - ResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> rules = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>(); - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - rules.add(computeSchedulingRule(file)); - } - } - return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()])); - } - return null; - } - ''' - - override getSynchronizeRule(GenDiagram it) ''' - «generatedMemberComment» - protected org.eclipse.core.runtime.jobs.ISchedulingRule getSynchronizeRule(Object element) { - ResourceSetInfo info = getResourceSetInfo(element); - if (info != null) { - java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> rules = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>(); - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file)); - } - } - return new org.eclipse.core.runtime.jobs.MultiRule(rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()])); - } - return null; - } - ''' - - override getValidateStateRule(GenDiagram it) ''' - «generatedMemberComment» - protected org.eclipse.core.runtime.jobs.ISchedulingRule getValidateStateRule(Object element) { - ResourceSetInfo info = getResourceSetInfo(element); - if (info != null) {«/*FIXME: [MG] bad copy paste here, files should be <IFile>, its a miracle that it does not fail in runtime at toArray stage */» - java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule> files = new java.util.LinkedList<org.eclipse.core.runtime.jobs.ISchedulingRule>(); - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = info.getLoadedResourcesIterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource); - if (file != null) { - files.add(file); - } - } - return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule(files.toArray(new org.eclipse.core.resources.IFile[files.size()])); - } - return null; - } - ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend deleted file mode 100644 index 435690d4f88..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/Editor.xtend +++ /dev/null @@ -1,550 +0,0 @@ -/** - * Copyright (c) 2006, 2017 Borland Software Corporation, CEA, 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Emilien Perico (Atos Origin) - add code to refactor some classes - * Christian W. Damus (CEA) - bug 430648 - * Christian W. Damus (CEA) - bug 431023 - * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 512343 - */ -package aspects.xpt.editor - -import aspects.xpt.navigator.NavigatorLinkHelper -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenEditorView -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import org.eclipse.gmf.codegen.gmfgen.Palette -import xpt.Common -import xpt.navigator.Utils_qvto -import xpt.CodeStyle - -@Singleton class Editor extends xpt.editor.Editor { - @Inject extension Common; - @Inject NavigatorLinkHelper xptNavigatorLinkHelper; - @Inject extension Utils_qvto; - @Inject extension CodeStyle - - override extendsList(GenEditorView it) '''extends org.eclipse.papyrus.uml.diagram.common.part.UmlGmfDiagramEditor''' - - override attributes(GenEditorView it) ''' - «generatedMemberComment» - public static final String ID = "«ID»"; «nonNLS» - - «generatedMemberComment» -public static final String CONTEXT_ID = "«contextID»"; «nonNLS» - - - ««« Documentation. adds listener for papyrus editors - «generatedMemberComment» - private org.eclipse.gef.KeyHandler paletteKeyHandler = null; - - «generatedMemberComment» - private org.eclipse.swt.events.MouseListener paletteMouseListener = null; - - ««« Helps to handle correctly the dirty state - «generatedMemberComment» - private org.eclipse.papyrus.commands.util.OperationHistoryDirtyState dirtyState; - - «generatedMemberComment» - private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain; - - «generatedMemberComment» - private org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider documentProvider; - ''' - - override constructor(GenEditorView it) ''' - «generatedMemberComment» - public «className»(org.eclipse.papyrus.infra.core.services.ServicesRegistry servicesRegistry, org.eclipse.gmf.runtime.notation.Diagram diagram) throws org.eclipse.papyrus.infra.core.services.ServiceException{ - super(servicesRegistry, diagram); - - ««« Documentation. adds listener for papyrus palette service - // adds a listener to the palette service, which reacts to palette customizations - org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().addProviderChangeListener(this); - - «««Share the same editing domain - // Share the same editing provider - editingDomain = servicesRegistry.getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class); - documentProvider = new org.eclipse.papyrus.infra.gmfdiag.common.GmfMultiDiagramDocumentProvider(editingDomain); - - // overrides editing domain created by super constructor - setDocumentProvider(documentProvider); - - «««end of listeners addition - } - ''' - - override getNavigatorSelection(GenNavigator it) ''' - - «generatedMemberComment» - private org.eclipse.jface.viewers.ISelection getNavigatorSelection() { - «IF getDiagramTopReference(it) !=null» - org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument(); - «ENDIF» - «xptNavigatorLinkHelper.findSelectionBody(it)» - } - ''' - -override createPaletteRoot (Palette it)''' - «generatedMemberComment» - protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) { - org.eclipse.gef.palette.PaletteRoot paletteRoot; - if (existingPaletteRoot == null) { - paletteRoot = org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().createPalette(this, getDefaultPaletteContent()); - } else { - org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().updatePalette(existingPaletteRoot, this, getDefaultPaletteContent()); - paletteRoot = existingPaletteRoot; - } - applyCustomizationsToPalette(paletteRoot); - return paletteRoot; - } -''' - -def createPaletteCustomizer (GenEditorView it)''' - «generatedMemberComment» - protected org.eclipse.gef.ui.palette.PaletteCustomizer createPaletteCustomizer() { - return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteCustomizer(getPreferenceStore()); - } -''' - -override additions (GenEditorView it)''' - - «createEditingDomain(it)» - - « configureDiagramEditDomain(it)» - - « doSave(it)» - - « getDirtyState(it)» - - « setUndoContext(it)» - - « isDirty(it)» - - «««Documentation. adds method to handle palette changes - « handlePaletteChange(it)» - - « dispose(it)» - - « getPaletteViewer(it)» - - ««« Documentation: (RS) advanced customization abilities - ««« « createPaletteCustomizer» - - - « constructPaletteViewer(it)» - - « createPaletteviewerProvider(it)» - - «getGraphicalViewer(it)» - - «initializeGraphicalViewer(it)» - - «selectionChanged(it)» -''' - -def handlePaletteChange (GenEditorView it) ''' - «generatedMemberComment» - public void providerChanged(org.eclipse.gmf.runtime.common.core.service.ProviderChangeEvent event) { - // update the palette if the palette service has changed - if (org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().equals(event.getSource())) { - org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().updatePalette(getPaletteViewer().getPaletteRoot(), this, - getDefaultPaletteContent()); - } - } -''' - -def constructPaletteViewer (GenEditorView it) ''' - «generatedMemberComment» - protected org.eclipse.gef.ui.palette.PaletteViewer constructPaletteViewer() { - return new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteViewer(); - } -''' - -override dispose(GenEditorView it)''' - «generatedMemberComment» - public void dispose() { - // remove palette service listener - // remove preference listener - org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteService.getInstance().removeProviderChangeListener(this); - - if(dirtyState != null) { - dirtyState.dispose(); - dirtyState = null; - } - - super.dispose(); - } -''' - -def getPaletteViewer (GenEditorView it)''' - «generatedMemberComment» - protected org.eclipse.gef.ui.palette.PaletteViewer getPaletteViewer() { - return getEditDomain().getPaletteViewer(); - } -''' - -override implementsList(Iterable<String> it)''' - implements org.eclipse.gmf.runtime.common.core.service.IProviderChangeListener - «IF ! it.isEmpty», - «FOR string : it SEPARATOR ', '» - «implementsListEntry(string)» - «ENDFOR» - «ENDIF» -''' - -def implementsListEntry (String it)'''«it»''' - -def createPaletteviewerProvider (GenEditorView it)''' -«generatedMemberComment» -protected org.eclipse.gef.ui.palette.PaletteViewerProvider createPaletteViewerProvider() { - getEditDomain().setPaletteRoot(createPaletteRoot(null)); - return new org.eclipse.gef.ui.palette.PaletteViewerProvider(getEditDomain()) { - - /** - * Override to provide the additional behavior for the tools. Will intialize with a - * PaletteEditPartFactory that has a TrackDragger that understand how to handle the - * mouseDoubleClick event for shape creation tools. Also will initialize the palette - * with a defaultTool that is the SelectToolEx that undestands how to handle the enter - * key which will result in the creation of the shape also. - */ - «overrideC(it.editorGen.diagram)» - protected void configurePaletteViewer(org.eclipse.gef.ui.palette.PaletteViewer viewer) { - super.configurePaletteViewer(viewer); - - // customize menu... - viewer.setContextMenu(new org.eclipse.papyrus.infra.gmfdiag.common.service.palette.PapyrusPaletteContextMenuProvider(viewer)); - - viewer.getKeyHandler().setParent(getPaletteKeyHandler()); - viewer.getControl().addMouseListener(getPaletteMouseListener()); - - // Add a transfer drag target listener that is supported on - // palette template entries whose template is a creation tool. - // This will enable drag and drop of the palette shape creation - // tools. - viewer.addDragSourceListener(new org.eclipse.gmf.runtime.diagram.ui.internal.parts.PaletteToolTransferDragSourceListener(viewer)); - viewer.setCustomizer(createPaletteCustomizer()); - } - - «overrideC(it.editorGen.diagram)» - public org.eclipse.gef.ui.palette.PaletteViewer createPaletteViewer(org.eclipse.swt.widgets.Composite parent) { - org.eclipse.gef.ui.palette.PaletteViewer pViewer = constructPaletteViewer(); - pViewer.createControl(parent); - configurePaletteViewer(pViewer); - hookPaletteViewer(pViewer); - return pViewer; - } - - /** - * @return Palette Key Handler for the palette - */ - private org.eclipse.gef.KeyHandler getPaletteKeyHandler() { - - if (paletteKeyHandler == null) { - - paletteKeyHandler = new org.eclipse.gef.KeyHandler() { - - /** - * Processes a <i>key released </i> event. This method is called by the Tool - * whenever a key is released, and the Tool is in the proper state. Override - * to support pressing the enter key to create a shape or connection - * (between two selected shapes) - * - * @param event - * the KeyEvent - * @return <code>true</code> if KeyEvent was handled in some way - */ - «overrideC(it.editorGen.diagram)» - public boolean keyReleased(org.eclipse.swt.events.KeyEvent event) { - - if (event.keyCode == org.eclipse.swt.SWT.Selection) { - - org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool(); - - if (toolSupportsAccessibility(tool)) { - - tool.keyUp(event, getDiagramGraphicalViewer()); - - // deactivate current selection - getPaletteViewer().setActiveTool(null); - - return true; - } - - } - return super.keyReleased(event); - } - - }; - - } - return paletteKeyHandler; - } - - /** - * @return Palette Mouse listener for the palette - */ - private org.eclipse.swt.events.MouseListener getPaletteMouseListener() { - - if (paletteMouseListener == null) { - - paletteMouseListener = new org.eclipse.swt.events.MouseListener() { - - /** - * Flag to indicate that the current active tool should be cleared after a - * mouse double-click event. - */ - private boolean clearActiveTool = false; - - /** - * Override to support double-clicking a palette tool entry to create a - * shape or connection (between two selected shapes). - * - * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt.events.MouseEvent) - */ - «overrideI(it.editorGen.diagram)» - public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) { - org.eclipse.gef.Tool tool = getPaletteViewer().getActiveTool().createTool(); - - if (toolSupportsAccessibility(tool)) { - - tool.setViewer(getDiagramGraphicalViewer()); - tool.setEditDomain(getDiagramGraphicalViewer().getEditDomain()); - tool.mouseDoubleClick(e, getDiagramGraphicalViewer()); - - // Current active tool should be deactivated, - // but if it is down here it will get - // reactivated deep in GEF palette code after - // receiving mouse up events. - clearActiveTool = true; - } - } - - «overrideI(it.editorGen.diagram)» - public void mouseDown(org.eclipse.swt.events.MouseEvent e) { - // do nothing - } - - «overrideI(it.editorGen.diagram)» - public void mouseUp(org.eclipse.swt.events.MouseEvent e) { - // Deactivate current active tool here if a - // double-click was handled. - if (clearActiveTool) { - getPaletteViewer().setActiveTool(null); - clearActiveTool = false; - } - - } - }; - - } - return paletteMouseListener; - } - - }; - } -''' - -//Not used -override performSaveAs (GenEditorView it)''' - «generatedMemberComment» -protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) { - // Nothing -} -''' - -//Share the same editing domain -override getEditingDomain (GenEditorView it)''' - «generatedMemberComment» - public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() { - return editingDomain; - } -''' - -def createEditingDomain (GenEditorView it)''' -«generatedMemberComment» - protected org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() { - // Already configured - return editingDomain; - } -''' - - -def configureDiagramEditDomain (GenEditorView it)''' -«generatedMemberComment» - protected void configureDiagramEditDomain() { - super.configureDiagramEditDomain(); - getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new org.eclipse.gef.commands.CommandStackListener() { - - «overrideI(it.editorGen.diagram)» - public void commandStackChanged(java.util.EventObject event) { - if (org.eclipse.swt.widgets.Display.getCurrent() == null) { - org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable() { - - @Override - public void run() { - firePropertyChange(org.eclipse.ui.IEditorPart.PROP_DIRTY); - } - }); - } else { - firePropertyChange(org.eclipse.ui.IEditorPart.PROP_DIRTY); - } - } - }); - } -''' - -def doSave (GenEditorView it)''' -«generatedMemberComment» - public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor) { - // The saving of the resource is done by the CoreMultiDiagramEditor - getDirtyState().saved(); - } -''' - -def getDirtyState (GenEditorView it)''' -«generatedMemberComment» - protected org.eclipse.papyrus.commands.util.OperationHistoryDirtyState getDirtyState() { - if(dirtyState == null) { - dirtyState = org.eclipse.papyrus.commands.util.OperationHistoryDirtyState.newInstance(getUndoContext(), getOperationHistory()); - } - return dirtyState; - } -''' - -def setUndoContext (GenEditorView it)''' -«generatedMemberComment» - protected void setUndoContext(org.eclipse.core.commands.operations.IUndoContext context) { - if(dirtyState != null) { - dirtyState.dispose(); - dirtyState = null; - } - - super.setUndoContext(context); - } -''' - -//Fix the dirty state -def isDirty (GenEditorView it)''' -«generatedMemberComment» - public boolean isDirty() { - return getDirtyState().isDirty(); - } -''' - -//Code refactoring moved in UMLDiagramEditor -override getDocumentProvider (GenEditorView it)''' - «generatedMemberComment» - protected final org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) { - return documentProvider; - } -''' - -override setDocumentProvider (GenEditorView it)''' - «generatedMemberComment» - protected final void setDocumentProvider(org.eclipse.ui.IEditorInput input) { - // Already set in the constructor - } -''' - -def getGraphicalViewer (GenEditorView it)''' -«generatedMemberComment» - @Override - public org.eclipse.gef.GraphicalViewer getGraphicalViewer() { - return super.getGraphicalViewer(); - } -''' - - -override initializeGraphicalViewer (GenEditorView it)''' -«generatedMemberComment» - @Override - protected void initializeGraphicalViewer() { - super.initializeGraphicalViewer(); - - // Enable Drop - getDiagramGraphicalViewer().addDropTargetListener( - new org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener(getDiagramGraphicalViewer(), org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()) { - - @Override - protected Object getJavaObject(org.eclipse.swt.dnd.TransferData data) { - // It is usual for the transfer data not to be set because it is available locally - return LocalSelectionTransfer.getTransfer().getSelection(); - } - - @Override - protected org.eclipse.emf.transaction.TransactionalEditingDomain getTransactionalEditingDomain() { - return getEditingDomain(); - } - }); - - } -''' - -def selectionChanged (GenEditorView it)''' -«generatedMemberComment» - @Override - public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) { - if (getSite().getPage().getActiveEditor() instanceof org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) { - org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor editor = (org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor) getSite().getPage().getActiveEditor(); - // If not the active editor, ignore selection changed. - if (this.equals(editor.getActiveEditor())) { - updateActions(getSelectionActions()); - super.selectionChanged(part, selection); - } else { - super.selectionChanged(part, selection); - } - } else { - super.selectionChanged(part, selection); - } - // from - // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor.selectionChanged(IWorkbenchPart, - // ISelection) - if (part == this) { - rebuildStatusLine(); - } - } -''' - -override getContextID (GenEditorView it)''' - «generatedMemberComment» -protected String getContextID() { - return CONTEXT_ID; -} -''' - - override getAdapter(GenEditorView it) ''' - «IF !hasPropertySheet(it) || hasNavigator(it)» - - «generatedMemberComment» - @SuppressWarnings("rawtypes") - public Object getAdapter(Class type) { - «IF !hasPropertySheet(it)» - if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) { - return null; - } - «ENDIF» - «IF hasNavigator(it)» - if (type == org.eclipse.ui.part.IShowInTargetList.class) { - return new org.eclipse.ui.part.IShowInTargetList() { - - «overrideI(it.editorGen.diagram)» - public String[] getShowInTargetIds() { - return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID }; - } - }; - } - «ENDIF» - return super.getAdapter(type); - } - «ENDIF» - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend deleted file mode 100644 index af515676fe1..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/InitDiagramFileAction.xtend +++ /dev/null @@ -1,81 +0,0 @@ -package aspects.xpt.editor - -import xpt.Common -import com.google.inject.Inject -import plugin.Activator -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Externalizer -import xpt.ExternalizerUtils_qvto -import com.google.inject.Singleton - -@Singleton class InitDiagramFileAction extends xpt.editor.InitDiagramFileAction { - - @Inject extension Common - @Inject extension ExternalizerUtils_qvto - - @Inject Activator xptActivator - @Inject xpt.editor.DiagramEditorUtil xptDiagramEditorUtil - @Inject Externalizer xptExternalizer - - override classBody_PDE(GenDiagram it) ''' - «generatedMemberComment» - private org.eclipse.ui.IWorkbenchPart targetPart; - - «generatedMemberComment» - private org.eclipse.emf.common.util.URI domainModelURI; - - «generatedMemberComment» - public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) { - this.targetPart = targetPart; - } - - «generatedMemberComment» - public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) { - domainModelURI = null; - action.setEnabled(false); - if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) { - return; - } - org.eclipse.core.resources.IFile file = - (org.eclipse.core.resources.IFile) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement(); - domainModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true); - action.setEnabled(true); - } - - «generatedMemberComment» - private org.eclipse.swt.widgets.Shell getShell() { - return targetPart.getSite().getShell(); - } - - «generatedMemberComment» - public void run(org.eclipse.jface.action.IAction action) { - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = - org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain(); - «IF editorGen.sameFileForDiagramAndModel» - org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl(); - «ELSE» - org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet(); - «ENDIF» - org.eclipse.emf.ecore.EObject diagramRoot = null; - try { - org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true); - diagramRoot = resource.getContents().get(0); - } catch (org.eclipse.emf.common.util.WrappedException ex) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Unable to load resource: " + domainModelURI, ex); «nonNLS(1)» - } - if (diagramRoot == null) { - org.eclipse.jface.dialogs.MessageDialog.openError(getShell(), - «xptExternalizer.accessorCall(editorGen, titleKey(i18nKeyForInitDiagramFileResourceErrorDialog()))», - «xptExternalizer.accessorCall(editorGen, messageKey(i18nKeyForInitDiagramFileResourceErrorDialog()))»); - return; - } - org.eclipse.jface.wizard.Wizard wizard = new «editorGen.diagram.getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain); - wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind( - «xptExternalizer.accessorCall(editorGen, i18nKeyForInitDiagramFileWizardTitle())», - «VisualIDRegistry::modelID(editorGen.diagram)»)); - «xptDiagramEditorUtil.qualifiedClassName(editorGen.diagram)».runWizard(getShell(), wizard, "InitDiagramFile"); «nonNLS( - 1)» - } - ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ModelElementSelectionPage.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ModelElementSelectionPage.xtend deleted file mode 100755 index d536a3b4df8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ModelElementSelectionPage.xtend +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation - *****************************************************************************/ -package aspects.xpt.editor - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -@Singleton class ModelElementSelectionPage extends xpt.editor.ModelElementSelectionPage{ - - override def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.part.DefaultModelElementSelectionPage''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend deleted file mode 100644 index 3e836230ef3..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/NewDiagramFileWizard.xtend +++ /dev/null @@ -1,212 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.editor - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Externalizer -import xpt.ExternalizerUtils_qvto -import xpt.Common -import xpt.editor.ModelElementSelectionPage -import plugin.Activator -import xpt.editor.DiagramContentInitializer -import xpt.CodeStyle - -@Singleton class NewDiagramFileWizard extends xpt.editor.NewDiagramFileWizard { - - @Inject extension Common - @Inject extension CodeStyle - @Inject extension ExternalizerUtils_qvto; - - @Inject Activator xptActivator - @Inject DiagramEditorUtil xptDiagramEditorUtil - @Inject Externalizer xptExternalizer; - @Inject DiagramContentInitializer xptDiagramContentInitializer - @Inject ModelElementSelectionPage xptModelElementSelectionPage - @Inject xpt.editor.VisualIDRegistry xptVisualIDRegistry - - override i18nValues(GenDiagram it) ''' - «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Initialize new diagram file')» - «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), 'Diagram file')» - «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)), - 'Create new diagram based on {0} model content')» - «xptExternalizer.messageEntry(nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), - 'Select diagram root element')» - «xptExternalizer.messageEntry(titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), 'Diagram root element')» - «xptExternalizer.messageEntry(descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)), - 'Select semantic model element to be depicted on diagram')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it), - 'Select diagram root element:')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it), - 'Diagram root element is not selected')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it), - 'Invalid diagram root element is selected')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardInitDiagramCommand(it), 'Initializing diagram contents')» - «xptExternalizer.messageEntry(i18nKeyForNewDiagramFileWizardIncorrectRootError(it), - 'Incorrect model object stored as a root resource object')» - ''' - - override NewDiagramFileWizard(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» extends org.eclipse.jface.wizard.Wizard { - - «generatedMemberComment» - private «creationPage(it)» myFileCreationPage; - - «generatedMemberComment» - private «xptModelElementSelectionPage.qualifiedClassName(it)» diagramRootElementSelectionPage; - - «generatedMemberComment» - private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain; - - «generatedMemberComment» - public «className(it)»(org.eclipse.emf.common.util.URI domainModelURI, - org.eclipse.emf.ecore.EObject diagramRoot, - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) { - «_assert('domainModelURI != null : \"Domain model uri must be specified\"')» - «_assert('diagramRoot != null : \"Doagram root element must be specified\"')» - «_assert('editingDomain != null : \"Editing domain must be specified\"')» - - myFileCreationPage = new «creationPage(it)»(«xptExternalizer.accessorCall(editorGen, - nameKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», org.eclipse.jface.viewers.StructuredSelection.EMPTY); - myFileCreationPage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))»); - myFileCreationPage.setDescription(org.eclipse.osgi.util.NLS.bind( - «xptExternalizer.accessorCall(editorGen, descriptionKey(i18nKeyForNewDiagramFileWizardCreationPage(it)))», - «VisualIDRegistry::modelID(it)»)); - org.eclipse.core.runtime.IPath filePath; - String fileName = org.eclipse.emf.common.util.URI.decode(domainModelURI.trimFileExtension().lastSegment()); - if (domainModelURI.isPlatformResource()) { - filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toPlatformString(true)); - } else if (domainModelURI.isFile()) { - filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toFileString()); - } else { - // TODO : use some default path - throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); «nonNLS(1)» - } - myFileCreationPage.setContainerFullPath(filePath); - myFileCreationPage.setFileName(«xptDiagramEditorUtil.qualifiedClassName(it)».getUniqueFileName( - filePath, fileName, "«editorGen.diagramFileExtension»")); «nonNLS(1)» - - diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(«xptExternalizer.accessorCall(editorGen, - nameKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); - diagramRootElementSelectionPage.setTitle(«xptExternalizer.accessorCall(editorGen, - titleKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); - diagramRootElementSelectionPage.setDescription(«xptExternalizer.accessorCall(editorGen, - descriptionKey(i18nKeyForNewDiagramFileWizardRootSelectionPage(it)))»); - diagramRootElementSelectionPage.setModelElement(diagramRoot); - - myEditingDomain = editingDomain; - } - - «generatedMemberComment» - public void addPages() { - addPage(myFileCreationPage); - addPage(diagramRootElementSelectionPage); - } - - «generatedMemberComment» - public boolean performFinish() { - java.util.LinkedList<org.eclipse.core.resources.IFile> affectedFiles = new java.util.LinkedList<org.eclipse.core.resources.IFile>(); - «IF null == editorGen.application» - org.eclipse.core.resources.IFile diagramFile = myFileCreationPage.createNewFile(); - «xptDiagramEditorUtil.callSetCharset(it, 'diagramFile')» - affectedFiles.add(diagramFile); - org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true); - «ELSE» - org.eclipse.core.runtime.IPath diagramModelPath = myFileCreationPage.getContainerFullPath().append(myFileCreationPage.getFileName()); - org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createFileURI(diagramModelPath.toString()); - «ENDIF» - org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet(); - final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(diagramModelURI); - org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = - new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand( - myEditingDomain, «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardInitDiagramCommand(it))», affectedFiles) { - - «overrideC» - protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult( - org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) - throws org.eclipse.core.commands.ExecutionException { - String diagramVID = «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(diagramRootElementSelectionPage.getModelElement()); - if (diagramVID.equals(«VisualIDRegistry::visualID(it)»)) { - return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult( - «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardIncorrectRootError(it))»); - } - org.eclipse.gmf.runtime.notation.Diagram diagram = - org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram( - diagramRootElementSelectionPage.getModelElement(), «VisualIDRegistry::modelID(it)», - «xptActivator.preferenceHintAccess(editorGen)»); - diagramResource.getContents().add(diagram); - «IF editorGen.sameFileForDiagramAndModel» - diagramResource.getContents().add(diagram.getElement()); - «ENDIF» - «IF !it.synchronized» - new «xptDiagramContentInitializer.qualifiedClassName(it)»().initDiagramContent(diagram); - «ENDIF» - return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(); - } - }; - try { - org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute( - command, new org.eclipse.core.runtime.NullProgressMonitor(), null); - diagramResource.save(«xptDiagramEditorUtil.callGetSaveOptions(it)»); - «xptDiagramEditorUtil.qualifiedClassName(it)».openDiagram(diagramResource); - } catch (org.eclipse.core.commands.ExecutionException e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Unable to create model and diagram", e); «nonNLS(1)» - } catch (java.io.IOException ex) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Save operation failed for: " + diagramModelURI, ex); «nonNLS(1)» - } catch (org.eclipse.ui.PartInitException ex) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError( - "Unable to open editor", ex); «nonNLS(1)» - } - return true; - } - - «generatedClassComment» - private static class DiagramRootElementSelectionPage extends «xptModelElementSelectionPage.qualifiedClassName(it)» { - - «generatedMemberComment» - protected DiagramRootElementSelectionPage(String pageName) { - super(pageName); - } - - «generatedMemberComment» - protected String getSelectionTitle() { - return «xptExternalizer.accessorCall(editorGen, i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(it))»; - } - - «generatedMemberComment» - protected boolean validatePage() { - if (getModelElement() == null) { - setErrorMessage(«xptExternalizer.accessorCall(editorGen, - i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(it))»); - return false; - } - boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides( - new org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation( - new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getModelElement()), - «VisualIDRegistry::modelID(it)», «xptActivator.preferenceHintAccess(editorGen)»)); - setErrorMessage(result ? null : «xptExternalizer.accessorCall(editorGen, - i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(it))»); - return result; - } - } - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend deleted file mode 100644 index bd5de605a1b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetInfo.xtend +++ /dev/null @@ -1,60 +0,0 @@ -package aspects.xpt.editor - -import com.google.inject.Inject -import xpt.Common -import xpt.CodeStyle -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import com.google.inject.Singleton - -@Singleton class ResourceSetInfo extends xpt.editor.ResourceSetInfo { - - @Inject extension Common - @Inject extension CodeStyle - - override handleResourceChangedSD(GenDiagram it) ''' - «generatedMemberComment» - public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) { - «updateSynchStateSD(it)» - org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() { - «overrideI» - public void run() { - handleElementChanged(ResourceSetInfo.this, resource, null); - } - }); - return true; - } - ''' - - override handleResourceDeletedSD(GenDiagram it) ''' - «generatedMemberComment» - public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) { - «updateSynchStateSD(it)» - org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() { - «overrideI» - public void run() { - fireElementDeleted(ResourceSetInfo.this.getEditorInput()); - } - }); - return true; - } - ''' - - override handleResourceMovedSD(GenDiagram it) ''' - «generatedMemberComment» - public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) { - «updateSynchStateSD(it)» - if (myDocument.getDiagram().eResource() == resource) { - org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() { - «overrideI» - public void run() { - handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI); - } - }); - } else { - handleResourceDeleted(resource); - } - return true; - } - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend deleted file mode 100644 index eaddf4da755..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ResourceSetModificationListener.xtend +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.editor - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Common - -@Singleton class ResourceSetModificationListener extends xpt.editor.ResourceSetModificationListener { - @Inject extension Common; - - - - override notifyChanged(GenDiagram it) ''' - «generatedMemberComment» - public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) { - if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) { - super.notifyChanged(notification); - } - if (!notification.isTouch() && myModifiedFilter.matches(notification)) { - if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.Resource) { - org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier(); - if (resource.isLoaded()) { - boolean modified = false; - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - if (nextResource.isLoaded()) { - modified = nextResource.isModified(); - } - } - boolean dirtyStateChanged = false; - synchronized (myInfo) { - if (modified != myInfo.fCanBeSaved) { - myInfo.fCanBeSaved = modified; - dirtyStateChanged = true; - } - «IF null == editorGen.application» - if (!resource.isModified()) { - myInfo.setSynchronized(resource); - } - «ENDIF» - } - if (dirtyStateChanged) { - fireElementDirtyStateChanged(myInfo.getEditorInput(), modified); - - if (!modified) { - myInfo.setModificationStamp(computeModificationStamp(myInfo)); - } - } - } - } - } - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend deleted file mode 100644 index c22da0057c8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/ValidateAction.xtend +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.editor - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Common -import xpt.editor.DiagramEditorUtil -import xpt.CodeStyle -import plugin.Activator -import xpt.providers.ValidationProvider - -@Singleton class ValidateAction extends xpt.editor.ValidateAction { - @Inject extension Common; - @Inject extension CodeStyle - - @Inject DiagramEditorUtil xptDiagramEditorUtil; - @Inject Activator xptActivator - @Inject ValidationProvider xptValidationProvider - - override runNonUIValidation(GenDiagram it) ''' - - «generatedMemberComment» - public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) { - org.eclipse.swt.widgets.Shell shell = org.eclipse.swt.widgets.Display.getCurrent().getActiveShell(); - if (shell == null) { - shell = new org.eclipse.swt.widgets.Shell(); - } - - org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart = - org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance().createDiagramEditPart( - view.getDiagram(),shell); - runValidation(diagramEditPart, view); - } - ''' - - override createMarkersForStatus(GenDiagram it) ''' - - «generatedMemberComment» - private static void createMarkers( - «IF editorGen.application == null»org.eclipse.core.resources.IFile - «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target, - org.eclipse.core.runtime.IStatus validationStatus, - org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) { - if (validationStatus.isOK()) { - return; - } - final org.eclipse.core.runtime.IStatus rootStatus = validationStatus; - java.util.List allStatuses = new java.util.ArrayList(); - «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = new «xptDiagramEditorUtil. - qualifiedClassName(it)».LazyElement2ViewMap( - diagramEditPart.getDiagramView(), - collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allStatuses)); - for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) { - org.eclipse.emf.validation.model.IConstraintStatus nextStatus = - (org.eclipse.emf.validation.model.IConstraintStatus) it.next(); - org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView( - diagramEditPart, nextStatus.getTarget(), element2ViewMap); - addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), - org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), - nextStatus.getMessage(), nextStatus.getSeverity()); - } - } - ''' - - override createMarkersForDiagnostic(GenDiagram it) ''' - - «generatedMemberComment» - private static void createMarkers( - «IF editorGen.application == null»org.eclipse.core.resources.IFile - «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target, - org.eclipse.emf.common.util.Diagnostic emfValidationStatus, - org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) { - if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) { - return; - } - final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus; - java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics = new java.util.ArrayList<org.eclipse.emf.common.util.Diagnostic>(); - «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap element2ViewMap = - new «xptDiagramEditorUtil.qualifiedClassName(it)».LazyElement2ViewMap( - diagramEditPart.getDiagramView(), - collectTargetElements(rootStatus, new java.util.HashSet<org.eclipse.emf.ecore.EObject>(), allDiagnostics)); - for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = emfValidationStatus.getChildren().iterator(); it.hasNext();) { - org.eclipse.emf.common.util.Diagnostic nextDiagnostic = it.next(); - java.util.List<?> data = nextDiagnostic.getData(); - if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) { - org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0); - org.eclipse.gmf.runtime.notation.View view = «xptDiagramEditorUtil.qualifiedClassName(it)».findView( - diagramEditPart, element, element2ViewMap); - addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), - org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(element, true), - nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity())); - } - } - } - ''' - - override collectTargetElementsFromStatus(GenDiagram it) ''' - - «generatedMemberComment» - private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.core.runtime.IStatus status, - java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.validation.model.IConstraintStatus> allConstraintStatuses) { - if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) { - targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget()); - allConstraintStatuses.add((org.eclipse.emf.validation.model.IConstraintStatus)status); - } - if (status.isMultiStatus()) { - org.eclipse.core.runtime.IStatus[] children = status.getChildren(); - for (int i = 0; i < children.length; i++) { - collectTargetElements(children[i], targetElementCollector, allConstraintStatuses); - } - } - return targetElementCollector; - } - ''' - - override collectTargetElementsFromDiagnostic(GenDiagram it) ''' - - «generatedMemberComment» - private static java.util.Set<org.eclipse.emf.ecore.EObject> collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic, - java.util.Set<org.eclipse.emf.ecore.EObject> targetElementCollector, java.util.List<org.eclipse.emf.common.util.Diagnostic> allDiagnostics) { - java.util.List<?> data = diagnostic.getData(); - org.eclipse.emf.ecore.EObject target = null; - if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) { - target = (org.eclipse.emf.ecore.EObject) data.get(0); - targetElementCollector.add(target); - allDiagnostics.add(diagnostic); - } - if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) { - for (java.util.Iterator<org.eclipse.emf.common.util.Diagnostic> it = diagnostic.getChildren().iterator(); it.hasNext();) { - collectTargetElements(it.next(), targetElementCollector, allDiagnostics); - } - } - return targetElementCollector; - } - ''' - - override run(GenDiagram it) ''' - - «generatedMemberComment» - public void run() { - org.eclipse.ui.IWorkbenchPart workbenchPart = page.getActivePart(); - if (workbenchPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) { - final org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart part = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) workbenchPart; - try { - «IF editorGen.application == null» - new org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation( - «ENDIF» - new org.eclipse.jface.operation.IRunnableWithProgress() { - - «overrideI» - public void run(org.eclipse.core.runtime.IProgressMonitor monitor) - throws InterruptedException, java.lang.reflect.InvocationTargetException { - runValidation(part.getDiagramEditPart(), part.getDiagram()); - } - } - «IF editorGen.application == null» - ) - «ENDIF» - .run(new org.eclipse.core.runtime.NullProgressMonitor()); - } catch (Exception e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation action failed", e); «nonNLS(1)» - } - } - } - ''' - - override runValidationWithEP(GenDiagram it) ''' - - «generatedMemberComment» - public static void runValidation(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.gmf.runtime.notation.View view) { - final org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart fpart = diagramEditPart; - final org.eclipse.gmf.runtime.notation.View fview = view; - org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view); - «xptValidationProvider.qualifiedClassName(it)».runWithConstraints(txDomain, new Runnable() { - - «overrideI» - public void run() { - validate(fpart, fview); - } - }); - } - ''' - - override runEMFValidator(GenDiagram it) ''' - - «generatedMemberComment» - private static org.eclipse.emf.common.util.Diagnostic runEMFValidator( - org.eclipse.gmf.runtime.notation.View target) { - if (target.isSetElement() && target.getElement() != null) { - return new org.eclipse.emf.ecore.util.Diagnostician() { - - «overrideC» - public String getObjectLabel(org.eclipse.emf.ecore.EObject eObject) { - return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(eObject, true); - } - }.validate(target.getElement()); - } - return org.eclipse.emf.common.util.Diagnostic.OK_INSTANCE; - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend deleted file mode 100644 index e5fe0afb9f3..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/VisualIDRegistry.xtend +++ /dev/null @@ -1,339 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #372479, #386838 - */ -package aspects.xpt.editor - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.emf.codegen.ecore.genmodel.GenClass -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenJavaExpressionProvider -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet -import org.eclipse.gmf.codegen.gmfgen.ValueExpression -import xpt.CodeStyle -import xpt.Common_qvto -import xpt.diagram.editpolicies.LinkUtils_qvto -import xpt.diagram.updater.Utils_qvto - -//XXX: [MG] decide what to do with @MetaDef methods -@Singleton class VisualIDRegistry extends xpt.editor.VisualIDRegistry { - @Inject extension MetaModel - @Inject extension Common - @Inject extension Common_qvto; - @Inject extension LinkUtils_qvto; - @Inject extension Utils_qvto; - - @Inject CodeStyle xptCodeStyle; - - override getDiagramVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getDiagramVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) { - if (domainElement == null) { - «unrecognizedVID(it)» - } - return «visualID(it)»; - } - ''' - - /** - * Support for extra contstraints to check about model element. - * Includes expression fields for interpreted constrains (like ocl or regexp). - * For each model element that has an associated constraint, there's a method is<DomainElement>_<UID>() - * that performs extra specification as defined by value expression - * - * FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator) - */ - override constraintMethods(GenDiagram it) ''' - «IF null != editorGen.expressionProviders» - «FOR topNode : topLevelNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod( - topNode)»«ENDFOR» - «FOR childNode : childNodes.filter[n|!n.sansDomain].filter[n|n.modelFacet.modelElementSelector != null]»«constraintMethod( - childNode)»«ENDFOR» - «FOR link : links.filter[n|!n.sansDomain]»«constraintMethod(link.modelFacet, link)»«ENDFOR» - «ENDIF» - ''' - //[ExtendedConstraint] Model selector constraint - override checkDomainElementConstraints(TypeModelFacet it, GenCommonBase commonBase) ''' -««« «IF null != modelElementSelector» -««« //«it.eContainer» -««« //->«modelElementSelector» -««« «ENDIF» - ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «IF null != modelElementSelector» - «IF commonBase instanceof GenLink || !(modelElementSelector.provider instanceof GenJavaExpressionProvider)» - ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - && «domainElementConstraintMethodName(commonBase)»(«CastEObject(metaClass,'domainElement')») - ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «ELSE» - && «domainElementConstraintMethodName(commonBase)»(containerView, «CastEObject(metaClass, 'domainElement')») - «ENDIF» - «ENDIF» - ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - ''' - -// override dispatch domainElementConstraintMethod(GenExpressionInterpreter it, GenCommonBase diagramElement, -// ValueExpression expression, GenClass context) ''' -// «generatedMemberComment()» -// «IF diagramElement instanceof GenLink» -// -// «ELSE» -// private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) { -// Object result = «xptGetExpression.getExpression(it, expression, context)».evaluate(domainElement); -// return result instanceof Boolean && ((Boolean)result).booleanValue(); -// } -// «ENDIF» -// -// ''' - - // [ExtendedConstraint] Model selector constraint - override dispatch domainElementConstraintMethod(GenJavaExpressionProvider it, GenCommonBase diagramElement, - ValueExpression expression, GenClass context) ''' - «generatedMemberComment» - ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «IF diagramElement instanceof GenLink» - ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - private static boolean «domainElementConstraintMethodName(diagramElement)»(«QualifiedClassName(context)» domainElement) { - ««« [ExtendedConstraint] START Testing the kind of ModelFacet (GenLink or Default case) - «ELSE» - private static boolean «domainElementConstraintMethodName(diagramElement)»(org.eclipse.gmf.runtime.notation.View containerView, «QualifiedClassName( - context)» domainElement) { - «ENDIF» - ««« [ExtendedConstraint] END Testing the kind of ModelFacet (GenLink or Default case) - «IF injectExpressionBody && (expression.body != null && expression.body.length() != 0)» - «expression.body» - «ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.length() == 0))» - // FIXME: implement this method - // Ensure that you remove @generated or mark it @generated NOT - throw new java.lang.UnsupportedOperationException("No java implementation provided in '« domainElementConstraintMethodName(diagramElement)»' operation");«nonNLS» - «ELSE» - return false; - «ENDIF» - } - ''' - - override runtimeTypedInstance(GenDiagram it) ''' - «generatedClassComment()» - public static final org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure «runtimeTypedInstanceName(it)» = new org.eclipse.papyrus.infra.gmfdiag.common.structure.DiagramStructure() { - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - return «getVisualIDMethodCall(it)»(view); - } - - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - return «getModelIDMethodCall(it)»(view); - } - - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) { - return «getNodeVisualIDMethodCall(it)»(containerView, domainElement); - } - - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) { - return «checkNodeVisualIDMethodCall(it)»(containerView, domainElement, candidate); - } - - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public boolean «isCompartmentVisualIDMethodName(it)»(String visualID) { - return «isCompartmentVisualIDMethodCall(it)»(visualID); - } - - «generatedMemberComment()» - «xptCodeStyle.overrideC(it)» - public boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) { - return «isSemanticLeafVisualIDMethodCall(it)»(visualID); - } - }; - ''' - - override getModelID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getModelIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - org.eclipse.gmf.runtime.notation.View diagram = view.getDiagram(); - while (view != diagram) { - org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «nonNLS(1)» - if (annotation != null) { - return annotation.getDetails().get("modelID"); «nonNLS(1)» - } - view = (org.eclipse.gmf.runtime.notation.View) view.eContainer(); - } - return diagram != null ? diagram.getType() : null; - } - ''' - - override def getType(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getTypeMethodName(it)»(String visualID) { - return visualID; - } - ''' - - override def getViewVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getVisualIdMethodName(it)»(org.eclipse.gmf.runtime.notation.View view) { - if (view instanceof org.eclipse.gmf.runtime.notation.Diagram) { - if («modelID(it)».equals(view.getType())) { - return «visualID(it)»; - } else { - «unrecognizedVID(it)» - } - } - return «getVisualIDMethodCall(it)»(view.getType()); - } - ''' - - override def unrecognizedVID(GenDiagram it) ''' - return ""; - ''' - - override def getVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getVisualIdMethodName(it)»(String type) { - return type; - } - ''' - - override def getNodeVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) { - if (domainElement == null) { - «unrecognizedVID(it)» - } - String containerModelID = «getModelIDMethodCall(it)»(containerView); - if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)» - «unrecognizedVID(it)» - } - String containerVisualID; - if («modelID(it)».equals(containerModelID)) { - containerVisualID = «getVisualIDMethodCall(it)»(containerView); - } else { - if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) { - containerVisualID = «visualID(it)»; - } else { - «unrecognizedVID(it)» - } - } - if (containerVisualID != null) { - switch (containerVisualID) { - «FOR container : allContainers» - «caseDomainContainerVisualID(container)» - «ENDFOR» - } - } - «unrecognizedVID(it)» - } - ''' - - override def getLinkWithClassVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static String «getLinkWithClassVisualIDMethodName(it)»(org.eclipse.emf.ecore.EObject domainElement) { - if (domainElement == null) { - «unrecognizedVID(it)» - } - «FOR typeLink : links.filter[l|isTypeLink(l)]»«returnVisualID(typeLink)»«ENDFOR» - «unrecognizedVID(it)» - } - ''' - - override def canCreateNode(GenDiagram it) ''' - «generatedMemberComment()» - public static boolean «canCreateNodeMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, String nodeVisualID) { - String containerModelID = «getModelIDMethodCall(it)»(containerView); - if (!«modelID(it)».equals(containerModelID)«FOR spf : shortcutsProvidedFor»«checkContainerModelID(spf)»«ENDFOR») { «nonNLS_All(shortcutsProvidedFor)» - return false; - } - String containerVisualID; - if («modelID(it)».equals(containerModelID)) { - containerVisualID = «getVisualIDMethodCall(it)»(containerView); - } else { - if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) { - containerVisualID = «visualID(it)»; - } else { - return false; - } - } - if (containerVisualID != null) { - switch (containerVisualID) { - «FOR container : allContainers.filter[e|getEssentialVisualChildren(e).notEmpty]»«checkEssentialChildren(container)»«ENDFOR» - «FOR link : links.filter[l|getEssentialVisualChildren(l).notEmpty]»«checkEssentialChildren(link)»«ENDFOR» - } - } - return false; - } - ''' - - override def checkEssentialChild(GenCommonBase it) ''' - if («visualID(it)».equals(nodeVisualID)) { - return true; - } - ''' - - override def isCompartmentVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static boolean «isCompartmentVisualIDMethodName(it)»(String visualID) { - «IF compartments.notEmpty» - if (visualID != null) { - switch (visualID) { - «FOR compartment : compartments»«caseVisualID(compartment)»«ENDFOR» - return true; - } - } - «ENDIF» - return false; - } - ''' - - override def isSemanticLeafVisualID(GenDiagram it) { - var leafs = it.allNodes.filter[n | getSemanticChildren(n).empty && n.compartments.forall[c | getSemanticChildren(c).empty]].sortBy[n|n.visualID] - return ''' - «generatedMemberComment()» - public static boolean «isSemanticLeafVisualIDMethodName(it)»(String visualID) { - if (visualID != null) { - switch (visualID) { - «/*We need to ensure at last one case, this is legitimate way*/ - caseVisualID(it)» - return false; - «IF leafs.notEmpty» - «FOR leaf : leafs»«caseVisualID(leaf)»«ENDFOR» - return true; - «ENDIF» - } - } - return false; - } - ''' - } - - override def checkNodeVisualID(GenDiagram it) ''' - «generatedMemberComment()» - public static boolean «checkNodeVisualIDMethodName(it)»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement, String candidate) { - if (candidate == null){ - //unrecognized id is always bad - return false; - } - String basic = «getNodeVisualIDMethodName(it)»(containerView, domainElement); - return candidate.equals(basic); - } - ''' - - override def domainElementConstraintMethodName(GenCommonBase it) '''is«stringUniqueIdentifier()»''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend deleted file mode 100644 index 5ed49a3255a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/extensions.xtend +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.editor - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator -import xpt.Common - -@Singleton class extensions extends xpt.editor.extensions { - @Inject extension Common; - - override extensions(GenEditorGenerator it) ''' - «extraLineBreak» - ««« YT (not used): - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.editors" id="gmf-editor"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<editor - ««« «tripleSpace(3)»id="«editor.ID»" - ««« «tripleSpace(3)»name="%editorName" - ««« «tripleSpace(3)»icon="«editor.iconPathX»" - ««« «tripleSpace(3)»extensions="«diagramFileExtension»" - ««« «tripleSpace(3)»default="true" - ««« «tripleSpace(3)»class="«xptEditor.qualifiedClassName(editor)»" - ««« «tripleSpace(3)»matchingStrategy="«xptMatching.qualifiedClassName(diagram)»" - ««« «tripleSpace(3)»contributorClass="«xptActionBarContributor.qualifiedClassName(editor)»"> - ««« «tripleSpace(2)»</editor> - ««« «tripleSpace(1)»</extension> - - «extraLineBreak»«outTab» - «tripleSpace(1)»<extension point="org.eclipse.ui.contexts" id="ui-context"> - «tripleSpace(2)»«xmlGeneratedTag()» - «tripleSpace(2)»<context - «tripleSpace(3)»description="%context.description" - «tripleSpace(3)»id="«editor.contextID»" - «tripleSpace(3)»name="%context.name" - «tripleSpace(3)»parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext"> - «tripleSpace(2)»</context> - «tripleSpace(1)»</extension> - - ««« YT (not used): - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.newWizards" id="creation-wizard"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<wizard - ««« «tripleSpace(3)»name="%newWizardName" - ««« «tripleSpace(3)»icon="«diagram.creationWizardIconPathX»" - ««« «tripleSpace(3)»category="«diagram.creationWizardCategoryID»" - ««« «tripleSpace(3)»class="«xptCreationWizard.qualifiedClassName(diagram)»" - ««« «tripleSpace(3)»id="«xptCreationWizard.qualifiedClassName(diagram)»ID"> - ««« «tripleSpace(3)»<description>%newWizardDesc</description> - ««« «tripleSpace(2)»</wizard> - ««« «tripleSpace(1)»</extension> - ««« - ««« «IF diagram.generateInitDiagramAction()» - ««« «IF null == application» - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.popupMenus" id="init-diagram-action"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<objectContribution - ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram" - ««« «tripleSpace(4)»nameFilter="*.«domainFileExtension»" - ««« «tripleSpace(4)»objectClass="org.eclipse.core.resources.IFile"> - ««« «tripleSpace(3)»<action - ««« «tripleSpace(5)»label="%initDiagramActionLabel" - ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»" - ««« «tripleSpace(5)»menubarPath="additions" - ««« «tripleSpace(5)»enablesFor="1" - ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction"> - ««« «tripleSpace(3)»</action> - ««« «tripleSpace(2)»</objectContribution> - ««« «tripleSpace(1)»</extension> - ««« «ELSE» - ««« «tripleSpace(1)»<extension point="org.eclipse.ui.actionSets" id="init-diagram-action"> - ««« «tripleSpace(2)»«xmlGeneratedTag()» - ««« «tripleSpace(2)»<actionSet - ««« «tripleSpace(4)»label="%initDiagramActionLabel" - ««« «tripleSpace(4)»visible="true" - ««« «tripleSpace(4)»id="«plugin.ID».InitDiagram"> - ««« «tripleSpace(3)»<action - ««« «tripleSpace(5)»label="%initDiagramActionLabel" - ««« «tripleSpace(5)»class="«xptInitDiagramFileAction.qualifiedClassName(diagram)»" - ««« «tripleSpace(5)»menubarPath="file/additions" - ««« «tripleSpace(5)»id="«plugin.ID».InitDiagramAction"> - ««« «tripleSpace(3)»</action> - ««« «tripleSpace(2)»</actionSet> - ««« «tripleSpace(1)»</extension> - ««« «ENDIF» - ««« «extraLineBreak» «tripleSpace(1)» - ««« «ENDIF» - ««« - ''' - - override outTab() { - return ' '; - } -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend deleted file mode 100644 index db9c8b642ca..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteConfiguration.xtend +++ /dev/null @@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST, ALL4TEC 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: - * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation - *****************************************************************************/ -package aspects.xpt.editor.palette - -import javax.inject.Inject -import javax.inject.Singleton -import org.eclipse.emf.ecore.xmi.XMLResource -import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry -import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator -import org.eclipse.gmf.codegen.gmfgen.ToolEntry -import org.eclipse.gmf.codegen.gmfgen.ToolGroup -import xpt.Common -import xpt.Common_qvto - -/** - * Template for generation of palette configuration model from gmfgen. - */ -@Singleton class PaletteConfiguration { - - @Inject extension Common - @Inject extension Common_qvto; - @Inject extension Utils_qvto; - - /** - * Generate a palette configuration. - */ - def PaletteConfiguration(GenEditorGenerator it) ''' -<?xml version="1.0" encoding="ASCII"?> -«xmlGeneratedTag» -<paletteconfiguration:PaletteConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:paletteconfiguration="http://www.eclipse.org/papyrus/diagram/paletteconfiguration/0.8" - xmlns:elementtypesconfigurations="http://www.eclipse.org/papyrus/infra/elementtypesconfigurations/1.2" - id="«plugin.ID».paletteconfiguration" - label="«plugin.name» Palette" - description="This is the palette of «plugin.name»"> - «FOR tool : diagram.palette.groups» - «addDrawerConfigurations(tool)» - «ENDFOR» -</paletteconfiguration:PaletteConfiguration> - ''' - - /** - * Generate drawer configurations. - */ - def addDrawerConfigurations(ToolGroup it) ''' -<drawerConfigurations - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - label="«it.title»" - description="«description»"> - <icon pluginID="«retrieveBundleId(smallIconPath,palette.diagram.editorGen.plugin.ID)»" iconPath="«retrieveLocalPath(smallIconPath)»"/> - «FOR entry : entries» - «IF entry instanceof ToolEntry && isValidTool(entry as AbstractToolEntry)» - «addToolConfiguration(entry as ToolEntry)» - «ENDIF» - «IF entry instanceof ToolGroup» - «addStackConfiguration(entry as ToolGroup)» - «ENDIF» - «ENDFOR» -</drawerConfigurations> -''' - - /** - * Add tool configuration. - */ - def addToolConfiguration(ToolEntry it) ''' -<ownedConfigurations xsi:type="paletteconfiguration:ToolConfiguration" - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - label="«title»" - «IF null!=qualifiedToolName && !qualifiedToolName.empty» - toolClassName="«qualifiedToolName»" - «ENDIF» - description="«description»"«IF genNodes.empty && !genLinks.empty» kind="ConnectionTool"«ENDIF»> - <icon pluginID="«retrieveBundleId(smallIconPath,group.palette.diagram.editorGen.plugin.ID)»" iconPath="«retrieveLocalPath(smallIconPath)»"/> - «IF elements.empty && (null==qualifiedToolName || qualifiedToolName.empty)» - «ERROR('No elements for tool generation (Palette):'+title)» - «ENDIF» - «FOR e : elements» - «val href = getElementTypeConfHRef(e.elementType.uniqueIdentifier,eResource as XMLResource)» - «IF null!=href && !href.empty» - <elementDescriptors> - <elementType - xsi:type="«getConfigurationXsiType(e.elementType.uniqueIdentifier,eResource as XMLResource)»" - href="«href»"/> - </elementDescriptors> - «ELSEIF null==qualifiedToolName || qualifiedToolName.empty» - «ERROR('No element type configuration or classToolName for tool generation (Palette):' + title)» - «ENDIF» - «ENDFOR» -</ownedConfigurations> - ''' - - /** - * Add stack configuration. - */ - def addStackConfiguration(ToolGroup it) ''' -<ownedConfigurations xsi:type="paletteconfiguration:StackConfiguration" id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» label="«title»"> - «FOR entry : entries» - «IF entry instanceof ToolEntry && isValidTool(entry as AbstractToolEntry)» - «addToolConfiguration(entry as ToolEntry)» - «ENDIF» - «ENDFOR» -</ownedConfigurations> - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend deleted file mode 100644 index 73366e5576e..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/PaletteFactory.xtend +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Artem Tikhomirov (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.editor.palette - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry -import org.eclipse.gmf.codegen.gmfgen.Palette -import org.eclipse.gmf.codegen.gmfgen.ToolEntry -import xpt.Common -import xpt.Common_qvto -import xpt.providers.ElementTypes - -@Singleton class PaletteFactory extends xpt.editor.palette.PaletteFactory { - @Inject extension Common; - @Inject extension Common_qvto; - @Inject extension Utils_qvto; - - @Inject ElementTypes xptElementTypes; - - - override PaletteFactory(Palette it) ''' - «copyright(diagram.editorGen)» - package «packageName»; - - «generatedClassComment» - public class «factoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.services.palette.PaletteFactory.Adapter { - //RS: New Palette generation - - //Generates the ID for the tool elements - //Generate the tool factory (if(ID) createtool...) - «FOR tool : collectTools(it)» - «generateIDAttribute(tool)» - «ENDFOR» - - «««Generates the default constructor - «generatedMemberComment» - public «factoryClassName»() { - - } - - «««Generates the main method to create tool - «generateCreateTool(it)» - - «««Generates the main method to create template - «generateGetTemplate(it)» - - «««Generates each method for tool creation - - «FOR tool : collectTools(it)» - «createTool(tool)» - «ENDFOR» - - } - ''' - - def generateCreateTool(Palette it) ''' - «generatedMemberComment» - public org.eclipse.gef.Tool createTool(String toolId) { - «FOR tool : collectTools(it)» - «checkToolID(tool)» - «ENDFOR» - // default return: null - return null; - } - ''' - - def checkToolID(AbstractToolEntry it) ''' - if (toolId.equals(«getConstantIDName(id)»)) { - return «createMethodName»(); - } - ''' - - def generateGetTemplate(Palette it) ''' - «generatedMemberComment» - public Object getTemplate(String templateId) { - - // default return: null - return null; - } - ''' - - def generateIDAttribute(AbstractToolEntry it) ''' - «generatedMemberComment» - private final static String «getConstantIDName(id)» = «id»;«IF isQuoted(id,'"')»«nonNLS»«ENDIF» - ''' - - def createTool(AbstractToolEntry it) ''' - «generatedMemberComment» - private org.eclipse.gef.Tool «createMethodName»() { - «newTool(it as ToolEntry, 'entry')» - } - ''' - - def newTool(ToolEntry it, String toolVarName) ''' - «IF elements.isEmpty()» - «ERROR('no elements for tool generation (Palette)')» - «ELSE» - java.util.List<org.eclipse.gmf.runtime.emf.type.core.IElementType> types = new java.util.ArrayList<org.eclipse.gmf.runtime.emf.type.core.IElementType>(«elements.size»); - «FOR e : elements» - types.add(«xptElementTypes.accessElementType(e)»); - «ENDFOR» - ««« RS: modified tool creation to have stereotypes-aware tools - org.eclipse.gef.Tool tool = new org.eclipse.papyrus.uml.diagram.common.service.«IF it.genNodes.isEmpty()»AspectUnspecifiedTypeConnectionTool«ELSE»AspectUnspecifiedTypeCreationTool«ENDIF»(types); - return tool; - «ENDIF» - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/Utils_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/Utils_qvto.xtend deleted file mode 100644 index 076d98204a9..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/editor/palette/Utils_qvto.xtend +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Copyright (c) 2006, 2017 Borland Software Corporation 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: - * Artem Tikhomirov (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Mickaël ADAM (ALL4TEC) - mickael.adam@all4tec.net - Bug 510587 - */ -package aspects.xpt.editor.palette - -import com.google.inject.Singleton -import org.eclipse.core.runtime.IPath -import org.eclipse.core.runtime.Path -import org.eclipse.emf.common.util.URI -import org.eclipse.emf.ecore.EObject -import org.eclipse.emf.ecore.xmi.XMLResource -import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl -import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry -import org.eclipse.gmf.codegen.gmfgen.Palette -import org.eclipse.gmf.codegen.gmfgen.ToolEntry -import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry -import org.eclipse.papyrus.infra.types.ExternallyRegisteredType -import org.eclipse.papyrus.infra.types.MetamodelTypeConfiguration -import org.eclipse.papyrus.infra.types.SpecializationTypeConfiguration -import org.eclipse.papyrus.infra.types.core.IConfiguredHintedElementType -import java.util.HashMap -import org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl - -@Singleton class Utils_qvto extends xpt.editor.palette.Utils_qvto { - - /** - * collect all tools availables and valid to generate the palette. A tool is not valid when it does not create either a link or a node - */ - override Iterable<AbstractToolEntry> collectTools(Palette palette) { - return collectGroups(palette).map[g|g.entries.filter(typeof(AbstractToolEntry))].flatten.filter [ tool | - isValidTool(tool) - ] - } - - def boolean isValidTool(AbstractToolEntry entry) { - - if (entry instanceof ToolEntry) { - if (null != entry.qualifiedToolName && !entry.qualifiedToolName.empty) { - return true; - } - - val links = (entry as ToolEntry).genLinks.size; - val nodes = (entry as ToolEntry).genNodes.size; - return nodes + links != 0; - } else { - return true; - } - } - - def String getToolPath(String it) { - var String result = null - - /** returns the '/' separator and then the id of the parent group path */ - if (isQuoted(it, '"')) { - result = it.substring(1, it.length - 1) - } else { - result = it - } - - return "/" + result; - } - - def boolean isQuoted(String source, String quoteStr) { - - if (quoteStr == null) { - return false; - } - - return source.length() >= (quoteStr.length() * 2) && source.startsWith(quoteStr) && source.endsWith(quoteStr); - - } - - def getConstantIDName(String it) { - if (isQuoted(it, '"')) { - return getUpperAndUnderscoreString(it.substring(1, it.length() - 1)) - } else { - return getUpperAndUnderscoreString(it) - } - } - - def String getUpperAndUnderscoreString(String value) { - return value.toUpperCase.replace(".", "_") - } - - /** - * The plateform protocol prefix. - */ - var static String PLUGIN_PROTOCOL = "platform:/plugin/" - - /** - * Retrieve the bundle id of a platform/plug-in path. - * - * @param initialValue - * The initial value from which the bundle has to be retrieved - * @param defaultValue - * The default bundle id value if bundle id not found - * @return the bundle id - */ - def String retrieveBundleId(String initialValue, String defaultValue) { - var String result = null - if (initialValue.startsWith(PLUGIN_PROTOCOL)) { - var String tmp = initialValue.substring(PLUGIN_PROTOCOL.length()) - var int bundleIdEndIndex = tmp.indexOf("/") - result = tmp.substring(0, bundleIdEndIndex) - } else { - result = defaultValue - } - return result - } - - /** - * Retrieve the local path of a platform/plug-in path. - * - * @param initialValue - * the initial value from which the local path has to be retrieved - * @return the local path - */ - def String retrieveLocalPath(String initialValue) { - var String result = "" - if (initialValue.startsWith(PLUGIN_PROTOCOL)) { - var String tmp = initialValue.substring(PLUGIN_PROTOCOL.length()) - var int bundleIdEndIndex = tmp.indexOf("/") - result = tmp.substring(bundleIdEndIndex) - } else { - result = initialValue - } - return result - } - - /** - * @return The relative path of the model's resource - * - * @param it - * the EObject to get the relative path - - */ - def String getRelativePath(EObject it) { - var String path = null; - var URI resourceURI = eResource().getURI() - if (resourceURI.isPlatformResource()) { - var String platformString = resourceURI.toPlatformString(true) - var IPath workspacePath = new Path(platformString) - workspacePath = workspacePath.removeFirstSegments(1) - workspacePath = workspacePath.removeLastSegments(1) - path = workspacePath.toString() - } else { - path = "model" - } - return path; - } - - /** - * Get the href string for the elementTypeConfiguration model of the unique identifier. - */ - def String getElementTypeConfHRef(String uniqueIdentifier, XMLResource resource) { - - //Load element type registry - org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry.getInstance().getClass() - - var String href = null - val type = ElementTypeRegistry.getInstance().getType(uniqueIdentifier) - - if (type instanceof IConfiguredHintedElementType) { - val xmlHelper = new XMLHelperImpl(resource) - val options = new HashMap<Object, Object>() - //Set option to have platform:/ sheme instead of ../../.. - options.put(XMLResource.OPTION_URI_HANDLER, new URIHandlerImpl.PlatformSchemeAware()) - xmlHelper.options = options; - href = xmlHelper.getHREF(type.configuration as EObject) - } - return href; - - } - - /** - * Get the href string for the elementTypeConfiguration model of the unique identifier. - */ - def String getConfigurationXsiType(String uniqueIdentifier, XMLResource resource) { - var String type = null - val eltype = ElementTypeRegistry.getInstance().getType(uniqueIdentifier) - if (eltype instanceof IConfiguredHintedElementType) { - var configuration = eltype.configuration - if (configuration instanceof SpecializationTypeConfiguration) { - type = "elementtypesconfigurations:SpecializationTypeConfiguration" - } else if (configuration instanceof MetamodelTypeConfiguration) { - type = "elementtypesconfigurations:MetamodelTypeConfiguration" - } else if (configuration instanceof ExternallyRegisteredType) { - type = "elementtypesconfigurations:ExternallyRegisteredType" - } - } - return type; - - } - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend deleted file mode 100644 index 0cd13c1a923..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/expressions/AbstractExpression.xtend +++ /dev/null @@ -1,64 +0,0 @@ -package aspects.xpt.expressions - -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import com.google.inject.Inject -import aspects.xpt.Common -import com.google.inject.Singleton - -@Singleton class AbstractExpression extends xpt.expressions.AbstractExpression { - - @Inject extension Common - - override performCast(GenDiagram it) ''' - «generatedMemberComment( - 'Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected')» - public static Object performCast(Object value, org.eclipse.emf.ecore.EDataType targetType) { - if (targetType instanceof org.eclipse.emf.ecore.EEnum) { - if (value instanceof org.eclipse.emf.ecore.EEnumLiteral) { - org.eclipse.emf.ecore.EEnumLiteral literal = (org.eclipse.emf.ecore.EEnumLiteral) value; - return (literal.getInstance() != null) ? literal.getInstance() : literal; - } - } - if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) { - return value; - } - Class<?> targetClass = targetType.getInstanceClass(); - Number num = (Number) value; - Class<?> valClass = value.getClass(); - Class<?> targetWrapperClass = targetClass; - if (targetClass.isPrimitive()) { - targetWrapperClass = org.eclipse.emf.ecore.util.EcoreUtil.wrapperClassFor(targetClass); - } - if (valClass.equals(targetWrapperClass)) { - return value; - } - if (Number.class.isAssignableFrom(targetWrapperClass)) { - if (targetWrapperClass.equals(Byte.class)) { - return new Byte(num.byteValue()); - } - if (targetWrapperClass.equals(Integer.class)) { - return new Integer(num.intValue()); - } - if (targetWrapperClass.equals(Short.class)) { - return new Short(num.shortValue()); - } - if (targetWrapperClass.equals(Long.class)) { - return new Long(num.longValue()); - } - if (targetWrapperClass.equals(java.math.BigInteger.class)) { - return java.math.BigInteger.valueOf(num.longValue()); - } - if (targetWrapperClass.equals(Float.class)) { - return new Float(num.floatValue()); - } - if (targetWrapperClass.equals(Double.class)) { - return new Double(num.doubleValue()); - } - if (targetWrapperClass.equals(java.math.BigDecimal.class)) { - return new java.math.BigDecimal(num.doubleValue()); - } - } - return value; - } - ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend deleted file mode 100644 index d729966b66b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/AbstractNavigatorItem.xtend +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.navigator - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import xpt.Common
import xpt.CodeStyle - -@Singleton class AbstractNavigatorItem extends xpt.navigator.AbstractNavigatorItem { - @Inject extension Common; - @Inject extension CodeStyle - - override def registerAdapterFactory(GenNavigator it) ''' - «generatedMemberComment()» - static { - @SuppressWarnings("rawtypes") - final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class }; - final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() { - «overrideI(it.editorGen.diagram)» - public String getContributorId() { - return "«editorGen.plugin.ID»"; «nonNLS(1)» - } - }; - org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() { - - «overrideI(it.editorGen.diagram)» - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof «qualifiedClassName(it)» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) { - return propertySheetPageContributor; - } - return null; - } - - «overrideI(it.editorGen.diagram)» - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { - return supportedTypes; - } - }, «qualifiedClassName(it)».class); - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend deleted file mode 100644 index 99bccffe2cb..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorContentProvider.xtend +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.navigator - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import plugin.Activator -import xpt.Common - -@Singleton class DomainNavigatorContentProvider extends xpt.navigator.DomainNavigatorContentProvider { - @Inject extension Common; - - @Inject Activator xptActivator - @Inject NavigatorContentProvider xptNavigatorContentProvider; - @Inject DomainNavigatorItem xptDomainNavigatorItem; - - override def wrapEObjects(GenNavigator it) ''' - «generatedMemberComment()» - public Object[] wrapEObjects(Object[] objects, Object parentElement) { - java.util.Collection<«xptDomainNavigatorItem.qualifiedClassName(it)»> result = new java.util.ArrayList<«xptDomainNavigatorItem.qualifiedClassName(it)»>(); - for (int i = 0; i < objects.length; i++) { - if (objects[i] instanceof org.eclipse.emf.ecore.EObject) { - result.add(new «xptDomainNavigatorItem.qualifiedClassName(it)»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier)); - } - } - return result.toArray(); - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend deleted file mode 100644 index e8e32303b09..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/DomainNavigatorItem.xtend +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.navigator - -import com.google.inject.Inject -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import xpt.Common -import xpt.CodeStyle - -@com.google.inject.Singleton class DomainNavigatorItem extends xpt.navigator.DomainNavigatorItem { - @Inject extension Common; - @Inject extension CodeStyle - - override def registerAdapterFactory(GenNavigator it) ''' - «generatedMemberComment()» - static { - @SuppressWarnings("rawtypes") - final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class }; - org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() { - - «overrideI(it.editorGen.diagram)» - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof «qualifiedClassName(it)») { - «qualifiedClassName(it)» domainNavigatorItem = («qualifiedClassName(it)») adaptableObject; - org.eclipse.emf.ecore.EObject eObject = domainNavigatorItem.getEObject(); - if (adapterType == org.eclipse.emf.ecore.EObject.class) { - return eObject; - } - if (adapterType == org.eclipse.ui.views.properties.IPropertySource.class) { - return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject); - } - } - - return null; - } - - «overrideI(it.editorGen.diagram)» - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { - return supportedTypes; - } - }, «qualifiedClassName(it)».class); - } - ''' - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend deleted file mode 100644 index 7a3a47a1c69..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorContentProvider.xtend +++ /dev/null @@ -1,391 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Modified by Patrick Tessier (CEA LIST) - * Emilien Perico (Atos Origin) - update template for GMF 2.2 compliance - */ -package aspects.xpt.navigator - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.emf.codegen.util.CodeGenUtil -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import org.eclipse.gmf.codegen.gmfgen.GenNavigatorReferenceType -import xpt.CodeStyle -import xpt.Common_qvto -import xpt.editor.VisualIDRegistry -import xpt.navigator.Utils_qvto - -@Singleton class NavigatorContentProvider extends xpt.navigator.NavigatorContentProvider { - @Inject extension Common; - @Inject extension Common_qvto; - @Inject extension Utils_qvto; - @Inject extension CodeStyle - - @Inject VisualIDRegistry xptVisualIDRegistry; - - - override NavigatorContentProvider(GenNavigator it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment()» - public class «className(it)» implements org.eclipse.ui.navigator.ICommonContentProvider { - - «attributes(it)» - - «constructor(it)» - - «genAllMethodNodeCase» - - «iContentProvider(it)» - - «iStructuredContentProvider(it)» - - «iMementoAware(it)» - - «iCommonContentProvider(it)» - - «iTreeContentProvider(it)» - - «additions(it)» - } - ''' - - - - override processChanges(GenNavigator it) ''' - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource nextResource = it.next(); - nextResource.unload(); - } - if (myViewer != null) { - myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable); - } - return true; - ''' - - override def initCommonAttributes(GenNavigator it) ''' - org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «createEditingDomain(it)»; - myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain; - @SuppressWarnings("serial") - java.util.Map<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean> map = new java.util.HashMap<org.eclipse.emf.ecore.resource.Resource, java.lang.Boolean>() { - - «overrideI(it.editorGen.diagram)» - public java.lang.Boolean get(java.lang.Object key) { - if (!containsKey(key)) { - if (key instanceof org.eclipse.emf.ecore.resource.Resource) { - put((org.eclipse.emf.ecore.resource.Resource) key, java.lang.Boolean.TRUE); - } - } - return super.get(key); - } - }; - myEditingDomain.setResourceToReadOnlyMap(map); - myViewerRefreshRunnable = new Runnable() { - - «overrideI(it.editorGen.diagram)» - public void run() { - if (myViewer != null) { - myViewer.refresh(); - } - } - }; - myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() { - - «overrideC(it.editorGen.diagram)» - public void dispose() { - } - - «overrideC(it.editorGen.diagram)» - public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) { - «processChanges(it)» - } - - «overrideC(it.editorGen.diagram)» - public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) { - «processChanges(it)» - } - - «overrideC(it.editorGen.diagram)» - public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) { - «processChanges(it)» - } - }); - ''' - - override def constructor(GenNavigator it) ''' - «generatedMemberComment()» - public «className(it)»() { - «initCommonAttributes(it)» - } - ''' - - override dispose(GenNavigator it) ''' - «generatedMemberComment()» - public void dispose() { - myWorkspaceSynchronizer.dispose(); - myWorkspaceSynchronizer = null; - myViewerRefreshRunnable = null; - - for (java.util.Iterator<org.eclipse.emf.ecore.resource.Resource> it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) { - org.eclipse.emf.ecore.resource.Resource resource = it.next(); - resource.unload(); - } - - ((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose(); - myEditingDomain = null; - } - ''' - - - - override getFileChildren(GenNavigator it) ''' - «var references = getChildReferencesFrom(it, null)» - «getFileResource(it)» - java.util.Collection<Object> result = new java.util.ArrayList<Object>(); - «FOR groupName : getGroupNames(references)» - «initGroupVariables(groupName, it, references, 'file', null)» - «ENDFOR» - java.util.List<org.eclipse.gmf.runtime.notation.View> topViews = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.View>(resource.getContents().size()); - for (org.eclipse.emf.ecore.EObject o : resource.getContents()) { - if (o instanceof org.eclipse.gmf.runtime.notation.View) { - topViews.add((org.eclipse.gmf.runtime.notation.View) o); - } - } - «FOR ref : references» - «addNavigatorItemsPrefix(ref)»selectViewsByType(resource.getContents(), «getChildViewType(ref.child)»)«addNavigatorItemsSuffix(ref, 'file', false)» - «ENDFOR» - «FOR groupName : getGroupNames(references)» - «addGroups(groupName, references)» - «ENDFOR» - return result.toArray(); - ''' - - - - override getViewChildren(GenNavigator it) ''' - «generatedMemberComment()» - private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) { - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it.editorGen.diagram)»(view); - if (vid != null) { - switch (vid) { - ««« BEGIN: PapyrusGenCode - ««« Restructuration of the case - «FOR node : getNavigatorContainerNodes(it)» - «caseNavigatorNode(node, it)» - «ENDFOR» - «««BEGIN: PapyrusGenCode - } - } - return EMPTY_ARRAY; - } - ''' - - override utilityMethods(GenNavigator it) ''' - «IF getNavigatorContainerNodes(it).notEmpty» - «generatedMemberComment» - private java.util.Collection getLinksSourceByType(java.util.Collection edges, String type) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = edges.iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next(); - org.eclipse.gmf.runtime.notation.View nextEdgeSource = nextEdge.getSource(); - if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) { - result.add(nextEdgeSource); - } - } - return result; - } - - «generatedMemberComment» - private java.util.Collection getLinksTargetByType(java.util.Collection edges, String type) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = edges.iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next(); - org.eclipse.gmf.runtime.notation.View nextEdgeTarget = nextEdge.getTarget(); - if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) { - result.add(nextEdgeTarget); - } - } - return result; - } - «generatedMemberComment» - private java.util.Collection getOutgoingLinksByType(java.util.Collection nodes, String type) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = nodes.iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next(); - result.addAll(selectViewsByType(nextNode.getSourceEdges(), type)); - } - return result; - } - - «generatedMemberComment» - private java.util.Collection getIncomingLinksByType(java.util.Collection nodes, String type) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = nodes.iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next(); - result.addAll(selectViewsByType(nextNode.getTargetEdges(), type)); - } - return result; - } -««« - «generatedMemberComment» - private java.util.Collection getChildrenByType(java.util.Collection nodes, String type) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = nodes.iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next(); - result.addAll(selectViewsByType(nextNode.getChildren(), type)); - } - return result; - } - - «generatedMemberComment» - private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams, String type) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = diagrams.iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.Diagram nextDiagram = (org.eclipse.gmf.runtime.notation.Diagram) it.next(); - result.addAll(selectViewsByType(nextDiagram.getEdges(), type)); - } - return result; - } - «generatedMemberComment» - private java.util.Collection selectViewsByType(java.util.Collection views, String type) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = views.iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); - if (type.equals(nextView.getType()) && isOwnView(nextView)) { - result.add(nextView); - } - } - return result; - } - - «generatedMemberComment» - private java.util.Collection createNavigatorItems(java.util.Collection views, Object parent, boolean isLeafs) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = views.iterator(); it.hasNext();) { - result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs)); - } - return result; - } - «ENDIF» - - «generatedMemberComment()» - private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) { - return «VisualIDRegistry::modelID(editorGen.diagram)».equals(«xptVisualIDRegistry. - getModelIDMethodCall(editorGen.diagram)»(view)); - } - - - «getForeignShortcuts(it)» - ''' - - override getForeignShortcuts(GenNavigator it) ''' - «IF editorGen.diagram.generateCreateShortcutAction() && getChildReferencesFrom(it, editorGen.diagram).notEmpty» - - «generatedMemberComment()» - private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) { - java.util.Collection result = new java.util.ArrayList(); - for (java.util.Iterator it = diagram.getChildren().iterator(); it.hasNext();) { - org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next(); - if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «nonNLS» - result.add(nextView); - } - } - return createNavigatorItems(result, parent, false); - } - «ENDIF» - ''' - - - - override caseNavigatorNode(GenCommonBase it, GenNavigator navigator) ''' - - case «VisualIDRegistry::visualID(it)»: { - «««BEGIN: PapyrusGenCode - ««« this code has been modified to call directly submethods - //modification of the template to avoid mistake of 65kb. - return getViewChildrenFor«it.editPartClassName»(view, parentElement); - «««END: PapyrusGenCode - } - ''' - - override createEditingDomain(GenNavigator it) '''org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain()''' - -//BEGIN: PapyrusGenCode -//Loop to call generator of each method -def genAllMethodNodeCase(GenNavigator it)''' -«FOR container :getNavigatorContainerNodes(it)» -« caseMethodNodeNode(container,it) » -«ENDFOR» - -''' -//END: PapyrusGenCode -//BEGIN: PapyrusGenCode -//this template has been modified to fixe bug generation by GMF framework. -//Is avoid generated method that are greater than 64Kb -def caseMethodNodeNode(GenCommonBase it, GenNavigator navigator) ''' -/** - * - *Papyrus Template - *this method is a modification of gmf code in order to avoid getViewChidreen() method becoming greater than 64kb. - *@generated -**/ -private Object[] getViewChildrenFor«it.editPartClassName»(org.eclipse.gmf.runtime.notation.View view, Object parentElement){ - java.util.Collection result = new java.util.ArrayList(); - «addForeignShortcuts(it)» - «var _references = getChildReferencesFrom(navigator, it)» - «FOR groupNames : getGroupNames(_references)» - «initGroupVariables(groupNames,navigator, _references, 'parentElement', it)» - «ENDFOR» - - - - «IF ! _references.empty» - «FOR referencesIterator : 1.._references.size» - «var reference = _references.get(referencesIterator-1)» - «IF ! reference.findConnectionPaths.empty» - «FOR pathsIterator : 1..reference.findConnectionPaths.size» - «var path = reference.findConnectionPaths.get(pathsIterator-1)» - «IF ! path.segments.empty» - «FOR segmentsIterator : 1..path.segments.size» - «var segment = path.segments.get(segmentsIterator-1)» - «IF referencesIterator==1 && pathsIterator==1 && segmentsIterator==1»java.util.Collection «ENDIF» - connectedViews = «childrenMethodName(segment.from,reference.referenceType, segment) » - («IF segmentsIterator==1»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF» - , «xptVisualIDRegistry.typeMethodCall(segment.to)»); - - «ENDFOR» - «ENDIF» - «addNavigatorItemsPrefix(reference)»connectedViews«addNavigatorItemsSuffix(reference,'parentElement', reference.referenceType != GenNavigatorReferenceType.CHILDREN_LITERAL) » - «ENDFOR» - «ENDIF» - «ENDFOR» - «ENDIF» - - «FOR groupNames : getGroupNames(_references)» - « addGroups(groupNames,_references) » - «ENDFOR» - - - return result.toArray(); -} -''' - -override def String i18nKeyForGroup(String groupName, GenCommonBase contextElement) { - return 'NavigatorGroupName.' + (if(null != contextElement) contextElement.stringUniqueIdentifier else 'File') + '.' + - CodeGenUtil::validJavaIdentifier(groupName) -} - -//END: PapyrusGenCod -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend deleted file mode 100644 index a700b38c498..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorGroup.xtend +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.navigator - -import com.google.inject.Inject -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import xpt.Common - -@com.google.inject.Singleton class NavigatorGroup extends xpt.navigator.NavigatorGroup { - @Inject extension Common; - - override def attributes(GenNavigator it) ''' - «generatedMemberComment()» - private String myGroupName; - - «generatedMemberComment()» - private String myIcon; - - «generatedMemberComment()» - private java.util.Collection<java.lang.Object> myChildren = new java.util.LinkedList<java.lang.Object>(); - ''' - - override def addChildren(GenNavigator it) ''' - «generatedMemberComment()» - public void addChildren(java.util.Collection<java.lang.Object> children) { - myChildren.addAll(children); - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend deleted file mode 100644 index 8f3292085b9..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorItem.xtend +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.navigator - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import xpt.Common
import xpt.CodeStyle - -@Singleton class NavigatorItem extends xpt.navigator.NavigatorItem { - @Inject extension Common; - @Inject extension CodeStyle - - override def registerAdapterFactory(GenNavigator it) ''' - «generatedMemberComment()» - static { - @SuppressWarnings("rawtypes") - final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class }; - org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() { - - «overrideI(it.editorGen.diagram)» - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof «qualifiedClassName(it)» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) { - return ((«qualifiedClassName(it)») adaptableObject).getView(); - } - return null; - } - - «overrideI(it.editorGen.diagram)» - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { - return supportedTypes; - } - }, «qualifiedClassName(it)».class); - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend deleted file mode 100644 index 828e09e6396..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLabelProvider.xtend +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2006, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Modified by Patrick Tessier (CEA LIST) - * Emilien Perico (Atos Origin) - update template for GMF 2.2 compliance - */ -package aspects.xpt.navigator - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import metamodel.MetaModel -import org.eclipse.emf.codegen.ecore.genmodel.GenClass -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.LabelModelFacet -import parsers.ParserProvider -import plugin.Activator -import xpt.navigator.Utils_qvto - -@Singleton class NavigatorLabelProvider extends xpt.navigator.NavigatorLabelProvider { - @Inject extension Common; - @Inject extension Utils_qvto; - - @Inject Activator xptActivator; - @Inject ParserProvider xptParserProvider; - @Inject MetaModel xptMetaModel; - - override def getTextMethodName(GenCommonBase it) '''get«stringUniqueIdentifier»Text''' - - override def CharSequence getDiagramLabelText(GenCommonBase it, GenCommonBase elementTypeHolder, LabelModelFacet labelModelFacet) ''' - org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = «xptParserProvider.accessorCall(it, elementTypeHolder, labelModelFacet, 'view.getElement() != null ? view.getElement() : view')»; - if (parser != null) { - return parser.getPrintString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(view.getElement() != null ? view.getElement() : view), org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue()); - } else { - «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("Parser was not found for label «stringVisualID»"); «nonNLS(1)» - «returnEmptyString()» - } - ''' - - override def getLabelFeatureText(GenCommonBase it, GenClass genClass) ''' - «IF null != genClass && null != genClass.labelFeature» - «xptMetaModel.DeclareAndAssign(genClass, 'domainModelElement', 'view.getElement()')» - if (domainModelElement != null) { - return «IF !isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»UMLLabelInternationalization.getInstance().getLabel(domainModelElement)«IF !isStringFeature(genClass.labelFeature)»)«ENDIF»; - } else { - «xptActivator.qualifiedClassName(getDiagram().editorGen.plugin)».getInstance().logError("No domain element for view with visualID = «stringVisualID»"); «nonNLS(1)» - «returnEmptyString()» - } - «ELSE» - «returnEmptyString()» - «ENDIF» - ''' - - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend deleted file mode 100644 index 58f11dd415f..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorLinkHelper.xtend +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.navigator - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import xpt.Common -import xpt.navigator.Utils_qvto - -@Singleton class NavigatorLinkHelper extends xpt.navigator.NavigatorLinkHelper { - @Inject extension Common; - @Inject extension Utils_qvto; - - - override findSelection(GenNavigator it) ''' - «generatedMemberComment()» - public org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput anInput) { - «IF getDiagramTopReference(it) !=null» - «defineDiagramDocument(editorGen.plugin)» - «ENDIF» - «findSelectionBody(it)» - } - ''' - - override findSelectionBody(GenNavigator it) ''' - «IF getDiagramTopReference(it) !=null» - «getDiagramSelection(getDiagramTopReference(it))» - «ENDIF» - return org.eclipse.jface.viewers.StructuredSelection.EMPTY; - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend deleted file mode 100644 index 1bb05d61ecc..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/navigator/NavigatorSorter.xtend +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.navigator - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNavigator -import xpt.Common -import xpt.editor.VisualIDRegistry - -@Singleton class NavigatorSorter extends xpt.navigator.NavigatorSorter { - @Inject extension Common; - - @Inject VisualIDRegistry xptVisualIDRegistry; - @Inject NavigatorItem xptNavigatorItem; - - override def category(GenNavigator it) ''' - «generatedMemberComment()» - public int category(Object element) { - if (element instanceof «xptNavigatorItem.qualifiedClassName(it)») { - «xptNavigatorItem.qualifiedClassName(it)» item = («xptNavigatorItem.qualifiedClassName(it)») element; - «IF editorGen.diagram.generateCreateShortcutAction()» - if (item.getView().getEAnnotation("Shortcut") != null) { «nonNLS(1)» - return SHORTCUTS_CATEGORY; - } - «ENDIF» - return «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»(item.getView()).hashCode(); - } - return GROUP_CATEGORY; - } - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend deleted file mode 100644 index 124ae49cc9a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/ActivatorImpl.xtend +++ /dev/null @@ -1,163 +0,0 @@ -package aspects.xpt.plugin - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator -import org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter -import org.eclipse.gmf.codegen.gmfgen.GenPlugin -import plugin.Activator -import xpt.Common -import xpt.editor.DocumentProvider -import xpt.providers.ElementInitializers -import xpt.expressions.getExpression - -@Singleton class ActivatorImpl extends xpt.plugin.ActivatorImpl { - @Inject extension Common; - - @Inject Activator xptActivator; - @Inject DocumentProvider xptDocProvider; - @Inject ElementInitializers xptElementInitializers; - @Inject getExpression xptExpr; - - override ActivatorImpl(GenPlugin it)''' - «copyright(editorGen)» - package «xptActivator.packageName(it)»; - - «generatedClassComment» - public class «xptActivator.className(it)» extends org.eclipse.ui.plugin.AbstractUIPlugin { - - «attrs(it)» - «constructor(it)» - «start(it)» - «stop(editorGen)» - «getInstance(it)» - - «getPreferenceStore» - - «getItemProvidersAdaptorFactory(it)» - «getItemImageDescriptor(it)» - «getBundleDescriptorImage(it)» - «findImageDescriptor(it)» - «getBundleImage(it)» - «getString(it)» - «documentProviderGetter(editorGen.diagram)» - «linkConstraint(editorGen.diagram)» - «initializerGetter(editorGen.diagram)» - «initializerSetter(editorGen.diagram)» - «providersAccessMethods(it)» - «logError(it)» - «logInfo(it)» - «getLogError(it)» - «additions(it)» - } -''' - -override attrs(GenPlugin it)''' - «generatedMemberComment» - public static final String ID = "«ID»"; //$NON-NLS-1$ - - «generatedMemberComment» - private org.eclipse.papyrus.infra.core.log.LogHelper myLogHelper; - - «generatedMemberComment» - public static final org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint DIAGRAM_PREFERENCES_HINT = - new org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint(ID); - - «generatedMemberComment» - private static «xptActivator.className(it)» instance; - - «generatedMemberComment» - private org.eclipse.emf.common.notify.AdapterFactory adapterFactory; - - «generatedMemberComment» - private «xptDocProvider.qualifiedClassName(editorGen.diagram)» documentProvider; - - «IF editorGen.diagram.links.exists(l| !l.sansDomain)» - «generatedMemberComment» - private «editorGen.diagram.getLinkCreationConstraintsQualifiedClassName()» linkConstraints; - «ENDIF» - - «generatedMemberComment» - private «xptElementInitializers.qualifiedClassName(editorGen.diagram)» initializers; - - «IF it.editorGen.expressionProviders != null» - «FOR p : it.editorGen.expressionProviders.providers.filter(typeof(GenExpressionInterpreter))» - «generatedMemberComment» - private «xptExpr.getExpressionInterpriterQualifiedClassName(p)» «p.language»Factory; - «ENDFOR» - «ENDIF» -''' - - -override start(GenPlugin it)''' - «generatedMemberComment» - public void start(org.osgi.framework.BundleContext context) throws Exception { - super.start(context); - instance = this; - myLogHelper = new org.eclipse.papyrus.infra.core.log.LogHelper(this); - org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore()); - adapterFactory = org.eclipse.papyrus.infra.gmfdiag.common.Activator.getInstance().getItemProvidersAdapterFactory(); - «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer diagramPreferenceInitializer = new «it.editorGen.diagram.preferencesPackageName».DiagramPreferenceInitializer(); - diagramPreferenceInitializer.initializeDefaultPreferences(); - - } -''' - -override stop(GenEditorGenerator it)''' - «generatedMemberComment» - public void stop(org.osgi.framework.BundleContext context) throws Exception { - adapterFactory = null; - «IF diagram.links.exists(l| !l.sansDomain)» - linkConstraints = null; - «ENDIF» - initializers = null; - «IF expressionProviders != null» - «FOR p : expressionProviders.providers.filter(typeof(GenExpressionInterpreter))» - «p.language»Factory = null; - «ENDFOR» - «ENDIF» - instance = null; - super.stop(context); - } -''' - -def getPreferenceStore()''' - «generatedMemberComment» - public org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() { - org.eclipse.jface.preference.IPreferenceStore store=org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - return store; - } - -''' - - override logError(GenPlugin it) ''' - «generatedMemberComment» - public void logError(String error) { - getLogHelper().warn(error); - } - - «generatedMemberComment» - public void logError(String error, Throwable throwable) { - getLogHelper().error(error, throwable); - } - ''' - - override logInfo(GenPlugin it) ''' - «generatedMemberComment» - public void logInfo(String message) { - getLogHelper().info(message); - } - - «generatedMemberComment» - public void logInfo(String message, Throwable throwable) { - getLogHelper().error(message, throwable); - } - ''' - - override getLogError(GenPlugin it) ''' - «generatedMemberComment» - public org.eclipse.papyrus.infra.core.log.LogHelper getLogHelper() { - return myLogHelper; - } - ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend deleted file mode 100644 index 143ecf9318b..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/manifest.xtend +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2007, 2015 Borland Software Corporation, 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Thibault Landre (Atos Origin) - add Papyrus dependencies to Papyrus GMF diagram* - * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr : add the dependencyorg.eclipse.papyrus.infra.services.edit - * Christian W. Damus - bug 477384 - */ -package aspects.xpt.plugin - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenPlugin -import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingDeleteService -import org.eclipse.papyrus.papyrusgmfgenextension.EditPartUsingReorientService -import xpt.Common - -@Singleton class manifest extends xpt.plugin.manifest{ - -@Inject extension Common - -override requireBundle(GenPlugin it)''' -Require-Bundle: org.eclipse.core.runtime, -«IF editorGen.application == null» org.eclipse.core.resources, -«ENDIF» -«IF editorGen.diagram.generateShortcutIcon() || (editorGen.navigator != null && editorGen.navigator.generateDomainModelNavigator)» org.eclipse.core.expressions, -«ENDIF» org.eclipse.jface, -«IF editorGen.application == null» org.eclipse.ui.ide, -«ENDIF» org.eclipse.ui.views, -«IF editorGen.navigator != null» org.eclipse.ui.navigator, - org.eclipse.ui.navigator.resources, -«ENDIF» org.eclipse.emf.ecore, - org.eclipse.emf.ecore.xmi, - org.eclipse.emf.edit.ui, - org.eclipse.gmf.runtime.emf.core, - org.eclipse.gmf.runtime.emf.commands.core, - org.eclipse.gmf.runtime.emf.ui.properties, - org.eclipse.gmf.runtime.diagram.ui, - org.eclipse.papyrus.uml.diagram.common, - org.eclipse.papyrus.infra.gmfdiag.common, - org.eclipse.papyrus.uml.service.types, - org.eclipse.papyrus.infra.widgets, - org.eclipse.papyrus.infra.ui, - org.eclipse.papyrus.infra.core.sashwindows.di, -«IF printingEnabled» org.eclipse.gmf.runtime.diagram.ui.printing, - org.eclipse.gmf.runtime.diagram.ui.printing.render, -«ENDIF» -«IF editorGen.propertySheet != null» org.eclipse.gmf.runtime.diagram.ui.properties, -«ENDIF» org.eclipse.gmf.runtime.diagram.ui.providers, -«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.providers.ide, -«ENDIF» org.eclipse.gmf.runtime.diagram.ui.render, - org.eclipse.gmf.runtime.diagram.ui.resources.editor, -«IF editorGen.application == null» org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide, -«ENDIF» -«var reqPlugins = getAllRequiredPlugins()» -«IF !reqPlugins.contains('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')» -«var notUsetBooleanVar = reqPlugins.add('org.eclipse.papyrus.infra.gmfdiag.tooling.runtime')» -«ENDIF» -«FOR reqId : reqPlugins» «reqId»;visibility:=reexport,«extraLineBreak» -«ENDFOR» org.eclipse.gef, - org.eclipse.papyrus.infra.gmfdiag.preferences, - «IF it.eResource.allContents.filter(typeof (EditPartUsingDeleteService)).size != 0 || it.eResource.allContents.filter(typeof (EditPartUsingReorientService)).size != 0» - org.eclipse.papyrus.extensionpoints.editors, - org.eclipse.papyrus.infra.services.edit - «ELSE» - org.eclipse.papyrus.extensionpoints.editors -«ENDIF» -''' - - override def executionEnvironment(GenPlugin it) ''' - Bundle-RequiredExecutionEnvironment: JavaSE-1.8 - ''' - -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend deleted file mode 100644 index a9070fe132a..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/plugin/plugin.xtend +++ /dev/null @@ -1,292 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST, ALL4TEC and others. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - initial API and implementation - * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 510587: the palette must not be generated by using GMF gen - *****************************************************************************/ -package aspects.xpt.plugin - -import aspects.xpt.Common -import aspects.xpt.editor.palette.Utils_qvto -import com.google.inject.Inject -import com.google.inject.Singleton -import java.util.Iterator -import java.util.List -import org.eclipse.emf.ecore.EObject -import org.eclipse.gmf.codegen.gmfgen.AbstractToolEntry -import org.eclipse.gmf.codegen.gmfgen.GenCompartment -import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel -import org.eclipse.gmf.codegen.gmfgen.GenPlugin -import org.eclipse.gmf.codegen.gmfgen.ToolEntry -import org.eclipse.gmf.codegen.gmfgen.ToolGroup -import org.eclipse.papyrus.papyrusgmfgenextension.ExtendedGenView -import org.eclipse.papyrus.papyrusgmfgenextension.LabelVisibilityPreference -import xpt.editor.extensions -import xpt.plugin.pluginUtils -import java.io.File - -@Singleton class plugin extends xpt.plugin.plugin { - - @Inject extension Common - @Inject extension pluginUtils - @Inject extension Utils_qvto - - @Inject extensions xptEditorExtension - @Inject xpt.diagram.preferences.extensions xptPreferencesExtension - @Inject xpt.propsheet.extensions xptPropsheetExtension - @Inject xpt.navigator.extensions xptNavigatorExtension - @Inject xpt.application.extensions xptApplicationExtension - @Inject xpt.diagram.updater.extensions xptUpdaterExtension - @Inject impl.actions.extensions xptActionExtension - @Inject xpt.providers.extensions xptProvidersExtension - - override plugin(GenPlugin it) ''' - <?xml version="1.0" encoding="UTF-8"?> - <?eclipse version="3.0"?> - «xcopyright(it.editorGen)» - <plugin> - ««««fileTypes()» - ««««extension_parser()» - «xptEditorExtension.extensions(it.editorGen)» - «««global actions handled in the diagram.common plugin - ««««pluginMenu()» - «validation(it.editorGen.diagram)» - «IF it.editorGen.metrics != null»«metrics(it.editorGen.metrics)»«ENDIF» - «««RS: redefine palette generation -««« «palettePredefinedEntries(editorGen)» -««« «paletteEntries(editorGen)» - «xptPreferencesExtension.extensions(it.editorGen.diagram)» - «IF it.editorGen.propertySheet != null»«xptPropsheetExtension.extensions(it.editorGen.propertySheet)»«ENDIF» - «xptProvidersExtension.extensions(it.editorGen.diagram)» - «IF it.editorGen.navigator != null»«xptNavigatorExtension.extensions(it.editorGen.navigator)»«ENDIF» - «IF it.editorGen.application != null»«xptApplicationExtension.extensions(it.editorGen.application)»«ENDIF» - «extensionsConstraintProviders(it.editorGen)» - «xptUpdaterExtension.extensions(it.editorGen.diagramUpdater)» - «xptActionExtension.Main(it.editorGen)» - «additions(it)» - «notationTypesMap(editorGen)» -««« «paletteConfiguration(editorGen)» - </plugin> - ''' - - - /** - * deprecated: palette configuration are now declared through architecture model. - */ - def paletteConfiguration(GenEditorGenerator it) ''' -<extension point="org.eclipse.papyrus.infra.gmfdiag.common.paletteDefinition"> - «xmlGeneratedTag» - <paletteDefinition - ID="«plugin.ID».paletteconfiguration" - class="org.eclipse.papyrus.infra.gmfdiag.common.service.palette.ExtendedPluginPaletteProvider" - name="«plugin.name» Palette" - path="«relativePath»/«modelID».paletteconfiguration" - provider="Eclipse Modeling Project"> - <Priority - name="Lowest"> - </Priority> - <!-- Specify diagram to which this palette tool relates --> - <editor - id="«plugin.ID»"> - </editor> - </paletteDefinition> -</extension> - ''' - - override additions(GenPlugin it) '''''' - - // def category(GenDiagram it) '''«getDiagramPreferencePageCategory()».«editorGen.modelID»''' - - //RS: redefine palette generation, using predefined entries - def palettePredefinedEntries(GenEditorGenerator it) ''' - «xmlGeneratedTag» - <extension - id="«plugin.name».palettedefinition" - name="«plugin.name» Predefined Entries" - point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"> - - «xmlGeneratedTag» - <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider"> - <Priority name="Lowest"/> - <contribution - factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»"> - <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/> - <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/> - <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/> - - «FOR tool : collectTools(diagram.palette)» - «predefinedEntryDefinition(tool)» - «ENDFOR» - - </contribution> - </paletteProvider> - - </extension> - ''' - - //RS: redefine palette generation, using predefined entries - def paletteEntries(GenEditorGenerator it) ''' - «xmlGeneratedTag» - <extension - id="«plugin.name».standard" - name="«plugin.name» Standard Palette" - point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"> - - «xmlGeneratedTag» - <paletteProvider class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider"> - <Priority name="Low"/> - <contribution - factoryClass="«it.diagram.palette.packageName».«it.diagram.palette.factoryClassName»"> - <predefinedEntry id="standardGroup/noteStack/noteTool" remove="true"/> - <predefinedEntry id="standardGroup/noteStack/textTool" remove="true"/> - <predefinedEntry id="standardGroup/noteStack/noteattachmentTool" remove="true"/> - - «FOR tool : diagram.palette.groups» - «groupUsage(tool)» - «ENDFOR» - </contribution> - <editor id="«plugin.ID»"/> - </paletteProvider> - - </extension> - ''' - - def groupUsage(ToolGroup it) ''' - <entry - description="«it.description»" - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - kind="«IF it.stack && it.toolsOnly»stack«ELSE»drawer«ENDIF»" - label="«it.title»" - large_icon="«largeIconPath»" - path="«getPath(it)»" - small_icon="«smallIconPath»"> - <expand - force="true"> - </expand> - </entry> - ««« TODO: call sub entries... - «FOR entry : it.entries.filter[e| e instanceof ToolEntry]» - «toolUsage(entry, it)» - «ENDFOR» - «FOR entry : it.entries.filter[e| e instanceof ToolGroup]» - «toolUsage(entry, it)» - «ENDFOR» - ''' - - private def getPath(ToolEntry it) { - return buildPath(it.eContainer); - } - - private def getPath(ToolGroup it) { - return buildPath(it.eContainer); - } - - private def buildPath(EObject it) { - var path = new StringBuilder(); - var container = it; - while (container instanceof ToolGroup) { - path.insert(0, getToolPath((container as ToolGroup).id)); - container = container.eContainer; - } - return if(path.length() != 0) path.toString else "/" ; - } - - def dispatch toolUsage(ToolEntry it, ToolGroup group) ''' - <predefinedEntry - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - path="«getPath(it)»"> - </predefinedEntry> - ''' - - def dispatch toolUsage(ToolGroup it, ToolGroup group) ''' - «groupUsage(it)» - ''' - - def predefinedEntryDefinition(AbstractToolEntry it) ''' - <entry - defineOnly="true" - description="«it.description»" - id=«IF isQuoted(id,'"')»«id»«ELSE»"«id»"«ENDIF» - kind="tool" - label="«it.title»" - large_icon="«largeIconPath»" - path="" - small_icon="«smallIconPath»"> - </entry> - ''' - - // set notation type mapping extension point - def notationTypesMap(GenEditorGenerator it) ''' -«tripleSpace(0)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping"> -«tripleSpace(1)»«xmlGeneratedTag» -«tripleSpace(1)»<diagramMappings diagramID="«modelID»"> -«tripleSpace(1)» <mapping type="«modelID»" humanReadableType="«modelID.replaceAll('Papyrus|UML|Diagram', '')»Diagram"/> - «FOR compartment : diagram.compartments» - «compartmentToTypeMap(compartment)» - «ENDFOR» - «FOR link : diagram.links» - «linksToTypeMap(link)» - «ENDFOR» - «FOR externalLabel : diagram.eResource.allContents.filter(typeof (GenExternalNodeLabel)).toIterable» - «floatingLabelToTypeMap(externalLabel)» - «externalNodeLabelToTypeMap(externalLabel)» - «ENDFOR» -«tripleSpace(1)»</diagramMappings> -«tripleSpace(0)»</extension> - ''' - def compartmentToTypeMap(GenCompartment it) ''' - <mapping - humanReadableType="«title.replaceAll('Compartment', '')»" - type="«stringVisualID»"> - </mapping> - ''' - - def linksToTypeMap(GenLink it) ''' - «FOR label : labels» - «linkLabelToTypeMap(label)» - «ENDFOR» - ''' - - def linkLabelToTypeMap(GenLinkLabel it)''' - ««« it is used on a LabelVisibilityPreference... - «LabelVisibilityPreferenceToTypeMap(it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.linkLabels != null && v.linkLabels.contains(it) && v.role != null], stringVisualID)» - ''' - - def externalNodeLabelToTypeMap(GenExternalNodeLabel it)''' - «LabelVisibilityPreferenceToTypeMap(it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[v | v.externalNodeLabels != null && v.externalNodeLabels.contains(it) && v.role != null],stringVisualID)» - ''' - - def LabelVisibilityPreferenceToTypeMap(Iterator<LabelVisibilityPreference> it, String visualID)''' - «var List<LabelVisibilityPreference> links = it.toList» - «IF links.size != 0» - <mapping - humanReadableType="«links.get(0).role»" - type="«visualID»"> - </mapping> - «ENDIF» - ''' - - def floatingLabelToTypeMap(GenExternalNodeLabel it)''' - ««« it is used on a ExtensionGenView... - «IF it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v | v.genView.contains(it) && v.superOwnedEditPart != null].size != 0» - «FOR extendedObject : it.eResource.allContents.filter(typeof (ExtendedGenView)).filter[v|v.genView.contains(it) && v.superOwnedEditPart != null].toIterable» - «««...to be extended as floatingLabel - «IF "FloatingLabelEditPart".equals(extendedObject.name) » - <mapping - humanReadableType="Floating Label" - type="«stringVisualID»"> - </mapping> - «ENDIF» - «ENDFOR» - «ENDIF» - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend deleted file mode 100644 index 4a89c0aa92c..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/LabelProvider.xtend +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.propsheet - -import aspects.xpt.Common -import aspects.xpt.editor.VisualIDRegistry -import aspects.xpt.providers.ElementTypes -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenPropertySheet - -@Singleton class LabelProvider extends xpt.propsheet.LabelProvider { - @Inject extension Common; - - @Inject ElementTypes xptElementTypes; - @Inject VisualIDRegistry visualId; - - override def unwrapMethods(GenPropertySheet it) ''' - «generatedMemberComment» - private Object unwrap(Object element) { - if (element instanceof org.eclipse.jface.viewers.IStructuredSelection) { - return ((org.eclipse.jface.viewers.IStructuredSelection) element).getFirstElement(); - } - return element; - } - - «generatedMemberComment» - private org.eclipse.gmf.runtime.notation.View getView(Object element) { - if (element instanceof org.eclipse.gmf.runtime.notation.View) { - return (org.eclipse.gmf.runtime.notation.View) element; - } - if (element instanceof org.eclipse.core.runtime.IAdaptable) { - return (org.eclipse.gmf.runtime.notation.View) - ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class); - } - return null; - } - - «generatedMemberComment» - private org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(org.eclipse.gmf.runtime.notation.View view) { - // For intermediate views climb up the containment hierarchy to find the one associated with an element type. - while (view != null) { - String vid = «visualId.qualifiedClassName(editorGen.diagram)».getVisualID(view); - org.eclipse.gmf.runtime.emf.type.core.IElementType etype = - «xptElementTypes.qualifiedClassName(editorGen.diagram)».getElementType(vid); - if (etype != null) { - return etype; - } - view = view.eContainer() instanceof org.eclipse.gmf.runtime.notation.View ? - (org.eclipse.gmf.runtime.notation.View) view.eContainer() : null; - } - return null; - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/PropertySection.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/PropertySection.xtend deleted file mode 100755 index 7bac07d23da..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/propsheet/PropertySection.xtend +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2017 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation - *****************************************************************************/ -package aspects.xpt.propsheet - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCustomPropertyTab - -@Singleton class PropertySection extends xpt.propsheet.PropertySection { - - override extendsList(GenCustomPropertyTab it) '''extends org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.sheet.DefaultPropertySection''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/EditPartProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/EditPartProvider.xtend deleted file mode 100644 index e09576f2734..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/EditPartProvider.xtend +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Thibault Landre (Atos Origin) - initial API and implementation - * Vincent Lorenzo (CEA-LIST) Add a line to initialize the display of the compartments to true - * Vincent Lorenzo (CEA-LIST) - Add lines to initialize the display of the labels - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels - */ -package aspects.xpt.providers - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -@Singleton class EditPartProvider extends xpt.providers.EditPartProvider { - - override def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.providers.DefaultEditPartProvider''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend deleted file mode 100644 index 71386368974..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers.xtend +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model - * [221347] Got rid of generated interfaces - * (IObjectInitializer, IFeatureInitializer) and implementation thereof - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Christian W. Damus (CEA) - bug 440263 - */ -package aspects.xpt.providers - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import java.util.List -import metamodel.MetaModel -import org.eclipse.emf.codegen.ecore.genmodel.GenClass -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenFeatureSeqInitializer -import org.eclipse.gmf.codegen.gmfgen.GenFeatureValueSpec -import org.eclipse.gmf.codegen.gmfgen.GenLanguage -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet -import plugin.Activator -import xpt.expressions.AbstractExpression -import xpt.providers.ElementInitializers_qvto - -/** - * XXX should generate this class only when there is initialization logic defined in the model - */ -@Singleton class ElementInitializers extends xpt.providers.ElementInitializers { - - @Inject extension Common; - @Inject extension ElementInitializers_qvto; - - @Inject Activator xptActivator - @Inject AbstractExpression xptAbstractExpression; - @Inject MetaModel xptMetaModel - - ///////////////////////////////// - override dispatch CharSequence javaMethod(GenNode it) ''' - «IF !it.sansDomain» - «javaMethod(it.modelFacet, it)» - «ENDIF» - ''' - - override dispatch CharSequence javaMethod(GenLink it) ''' - «IF !it.sansDomain» - «javaMethod(it.modelFacet, it)» - «ENDIF» - ''' - - override dispatch CharSequence performInit(GenFeatureValueSpec it, GenCommonBase diagramElement, String instanceVar, - GenClass instanceClass, List<Integer> counters) ''' - «IF it.value.provider.getLanguage() == GenLanguage::LITERAL_LITERAL» - «xptMetaModel.modifyFeature(feature, instanceVar, instanceClass, value.body)» - «extraLineBreak» - «ELSE» - «var expressionVarName = getVariableName('value', counters)» - Object «expressionVarName» = «evaluateExpr(value.provider, diagramElement, it, instanceVar)»; - «IF feature.listType» - if («expressionVarName» instanceof java.util.Collection) { - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».clear(); - «IF feature.typeGenClassifier.expressionResultNeedsCast()» - for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) { - Object next = «xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(it.next(), «xptMetaModel. - MetaClass(feature.typeGenClassifier)»); - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel. - QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») next); - } - «ELSE» - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».addAll(((java.util.Collection) «expressionVarName»)); - «ENDIF» - } else if(«expressionVarName» != null) { - «IF feature.typeGenClassifier.expressionResultNeedsCast()» - «expressionVarName» = «xptAbstractExpression - .qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass( - feature.typeGenClassifier)»); - «ENDIF» - «xptMetaModel.getFeatureValue(feature, instanceVar, instanceClass, true)».add((«xptMetaModel. - QualifiedClassName(feature.typeGenClassifier/*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/)») «expressionVarName»); - } - «ELSE» - if(«expressionVarName» != null) { - «IF feature.typeGenClassifier.expressionResultNeedsCast()» - «extraLineBreak» - «expressionVarName» = « - xptAbstractExpression.qualifiedClassName(diagramElement.getDiagram())».performCast(«expressionVarName», «xptMetaModel.MetaClass( - feature.typeGenClassifier)»); - «ENDIF» - «xptMetaModel.setFeatureValue(feature, instanceVar, instanceClass, expressionVarName, true)»; - } - «ENDIF/*isListType*/» - «ENDIF/*is literal expression*/» - ''' - - override dispatch CharSequence initMethod(GenFeatureSeqInitializer it, GenCommonBase diagramElement) ''' - «generatedMemberComment» - public void init_«diagramElement.stringUniqueIdentifier()»(«xptMetaModel.QualifiedClassName(elementClass)» instance) { - try { - «FOR i : it.initializers» - «performInit(i, diagramElement, 'instance', elementClass, <Integer>newLinkedList(initializers.indexOf(i)))» - «ENDFOR» - } catch(RuntimeException e) { - «xptActivator.qualifiedClassName(diagramElement.getDiagram().editorGen.plugin)».getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ - } - } - ''' - - override def initMethodCall(GenCommonBase linkOrNode, TypeModelFacet modelFacet, String newElementVar) ''' - «IF modelFacet.modelElementInitializer != null» - «elementInitializersInstanceCall(linkOrNode)».init_«linkOrNode.stringUniqueIdentifier»(«newElementVar»); - «ENDIF» - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers_qvto.xtend deleted file mode 100644 index a080481eabc..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementInitializers_qvto.xtend +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model - * [221347] Got rid of generated interfaces - * (IObjectInitializer, IFeatureInitializer) and implementation thereof - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Christian W. Damus (CEA) - bug 440263 - */ -package aspects.xpt.providers - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenFeatureValueSpec - -@Singleton class ElementInitializers_qvto extends xpt.providers.ElementInitializers_qvto { - @Inject extension Common - - override def String javaMethodName(GenCommonBase de, GenFeatureValueSpec valueSpec) { - var middlePart = '' - if (valueSpec.featureSeqInitializer.creatingInitializer != null) { - middlePart = valueSpec.featureSeqInitializer.creatingInitializer.feature.ecoreFeature.name + '_' - } - return valueSpec.feature.ecoreFeature.name + '_' + middlePart + de.stringUniqueIdentifier - } - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend deleted file mode 100644 index acdc1f41c32..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ElementTypes.xtend +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Copyright (c) 2006, 2014 Borland Software Corporation, 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Christian W. Damus - bug 451230 - * Benoit Maggi (CEA LIST) -#510281 change dependency to replace gmft-runtime - */ -package aspects.xpt.providers - -import aspects.xpt.CodeStyle -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.diagram.Utils_qvto -import xpt.editor.VisualIDRegistry -import plugin.Activator - -@Singleton class ElementTypes extends xpt.providers.ElementTypes { - @Inject extension Common; - @Inject extension Utils_qvto; - - @Inject CodeStyle xptCodeStyle; - @Inject VisualIDRegistry xptVisualIDRegistry; - - @Inject Activator xptActivator; - - override def attributes(GenDiagram it) ''' - «generatedMemberComment» - private static java.util.Map<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement> elements; - - «generatedMemberComment» - private static org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages elementTypeImages = new org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.providers.DiagramElementTypeImages(« // - xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().getItemProvidersAdapterFactory()); - - «generatedMemberComment» - private static java.util.Set<org.eclipse.gmf.runtime.emf.type.core.IElementType> KNOWN_ELEMENT_TYPES; - ''' - - override def getElement(GenDiagram it) ''' - «generatedMemberComment('Returns \'type\' of the ecore object associated with the hint.\n')» - public static synchronized org.eclipse.emf.ecore.ENamedElement getElement(org.eclipse.core.runtime.IAdaptable hint) { - Object type = hint.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class); - if (elements == null) { - elements = new java.util.IdentityHashMap<org.eclipse.gmf.runtime.emf.type.core.IElementType, org.eclipse.emf.ecore.ENamedElement>(); - «IF domainDiagramElement != null»«bindUniqueIdentifierToNamedElement(domainDiagramElement, stringUniqueIdentifier())»«ENDIF» - «FOR node : getAllNodes()» - «IF node.modelFacet != null»«bindUniqueIdentifierToNamedElement(node.modelFacet, node.stringUniqueIdentifier())»«ENDIF» - «ENDFOR» - «FOR link : it.links» - «IF link.modelFacet != null»«bindUniqueIdentifierToNamedElement(link.modelFacet, link.stringUniqueIdentifier())»«ENDIF» - «ENDFOR» - } - return elements.get(type); - } - ''' - - override def isKnownElementType(GenDiagram it) ''' - «generatedMemberComment» - public static synchronized boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) { - if (KNOWN_ELEMENT_TYPES == null) { - KNOWN_ELEMENT_TYPES = new java.util.HashSet<org.eclipse.gmf.runtime.emf.type.core.IElementType>(); - «FOR e : it.getAllTypedElements()» - «addKnownElementType(e)» - «ENDFOR» - } - - boolean result = KNOWN_ELEMENT_TYPES.contains(elementType); - - if (!result) { - org.eclipse.gmf.runtime.emf.type.core.IElementType[] supertypes = elementType.getAllSuperTypes(); - for (int i = 0; !result && (i < supertypes.length); i++) { - result = KNOWN_ELEMENT_TYPES.contains(supertypes[i]); - } - } - - return result; - } - ''' - - override def additions(GenDiagram it) ''' - «super.additions(it)» - - «generatedMemberComment» - public static boolean isKindOf(org.eclipse.gmf.runtime.emf.type.core.IElementType subtype, org.eclipse.gmf.runtime.emf.type.core.IElementType supertype) { - boolean result = subtype == supertype; - - if (!result) { - org.eclipse.gmf.runtime.emf.type.core.IElementType[] supertypes = subtype.getAllSuperTypes(); - for (int i = 0; !result && (i < supertypes.length); i++) { - result = supertype == supertypes[i]; - } - } - - return result; - } - ''' - - override def getElementTypeByVisualID(GenDiagram it) ''' - «generatedMemberComment» - public static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(String visualID) { - if (visualID != null) { - switch (visualID) { - «FOR e : it.getAllTypedElements().filter[el|el.elementType != null]» - «caseElementType(e)» - «ENDFOR» - } - } - return null; - } - ''' - - override def getElementType(GenDiagram it) ''' - «generatedMemberComment» - private static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeByUniqueId(String id) { - return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType(id); - } - ''' - - override def elementTypeField(GenCommonBase it) ''' - «IF null != elementType» - «generatedMemberComment» - public static final org.eclipse.gmf.runtime.emf.type.core.IElementType «stringUniqueIdentifier» = getElementTypeByUniqueId("«elementType. - uniqueIdentifier»"); «nonNLS(1)» - «ENDIF» - ''' - - override def typedInstance(GenDiagram it) ''' - «generatedClassComment» - public static final org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes TYPED_INSTANCE - = new org.eclipse.papyrus.infra.gmfdiag.common.providers.DiagramElementTypes(elementTypeImages) { - - «generatedMemberComment» - «xptCodeStyle.overrideC(it)» - public boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) { - return «qualifiedClassName(it)».isKnownElementType(elementType); - } - - «generatedMemberComment» - «xptCodeStyle.overrideC(it)» - public org.eclipse.gmf.runtime.emf.type.core.IElementType getElementTypeForVisualId(String visualID) { - return «qualifiedClassName(it)».getElementType(visualID); - } - - «generatedMemberComment» - «xptCodeStyle.overrideC(it)» - public org.eclipse.emf.ecore.ENamedElement getDefiningNamedElement(org.eclipse.core.runtime.IAdaptable elementTypeAdapter) { - return «qualifiedClassName(it)».getElement(elementTypeAdapter); - } - }; - ''' - - override def accessElementType(GenCommonBase it) '''«it.diagram.elementTypesQualifiedClassName».«stringUniqueIdentifier»''' - - override def caseElementType(GenCommonBase it) ''' - «xptVisualIDRegistry.caseVisualID(it)» - return «stringUniqueIdentifier()»; - ''' - - override def addKnownElementType(GenCommonBase it) ''' - «IF null != elementType» - KNOWN_ELEMENT_TYPES.add(«stringUniqueIdentifier()»); - «ENDIF» - ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/IconProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/IconProvider.xtend deleted file mode 100644 index 3117626b436..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/IconProvider.xtend +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model - * [221347] Got rid of generated interfaces - * (IObjectInitializer, IFeatureInitializer) and implementation thereof - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Christian W. Damus (CEA) - bug 440263 - */ -package aspects.xpt.providers - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram - -@Singleton class IconProvider extends xpt.providers.IconProvider { - - override def extendsList(GenDiagram it) '''extends org.eclipse.papyrus.infra.gmfdiag.common.providers.DefaultElementTypeIconProvider''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend deleted file mode 100644 index 75f9fd4cd94..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/MarkerNavigationProvider.xtend +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.providers - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Common - -@Singleton class MarkerNavigationProvider extends xpt.providers.MarkerNavigationProvider { - @Inject extension Common; - - override def MarkerNavigationProvider(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» - extends org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider { - - «generatedMemberComment» - public static final String MARKER_TYPE = - «editorGen.plugin.activatorQualifiedClassName».ID + ".«getValidationDiagnosticMarkerType()»"; «nonNLS(1)» - - «generatedMemberComment» - protected void doGotoMarker(org.eclipse.core.resources.IMarker marker) { - String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null); - if (elementId == null || !(getEditor() instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor)) { - return; - } - org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor editor = - (org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) getEditor(); - java.util.Map<?, ?> editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry(); - org.eclipse.emf.ecore.EObject targetView = editor.getDiagram().eResource().getEObject(elementId); - if (targetView == null) { - return; - } - org.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart) editPartRegistry.get(targetView); - if (targetEditPart != null) { - «getDiagramEditorUtilQualifiedClassName()».selectElementsInDiagram( - editor, java.util.Arrays.asList(new org.eclipse.gef.EditPart[] { targetEditPart })); - } - } - - «generatedMemberComment» - public static void deleteMarkers(org.eclipse.core.resources.IResource resource) { - try { - resource.deleteMarkers(MARKER_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_ZERO); - } catch (org.eclipse.core.runtime.CoreException e) { - «editorGen.plugin.activatorQualifiedClassName».getInstance().logError( - "Failed to delete validation markers", e); «nonNLS(1)» - } - } - - «generatedMemberComment» - public static org.eclipse.core.resources.IMarker addMarker(org.eclipse.core.resources.IFile file, - String elementId, String location, String message, int statusSeverity) { - org.eclipse.core.resources.IMarker marker = null; - try { - marker = file.createMarker(MARKER_TYPE); - marker.setAttribute(org.eclipse.core.resources.IMarker.MESSAGE, message); - marker.setAttribute(org.eclipse.core.resources.IMarker.LOCATION, location); - marker.setAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, elementId); - int markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_INFO; - if (statusSeverity == org.eclipse.core.runtime.IStatus.WARNING) { - markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_WARNING; - } else if (statusSeverity == org.eclipse.core.runtime.IStatus.ERROR || - statusSeverity == org.eclipse.core.runtime.IStatus.CANCEL) { - markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_ERROR; - } - marker.setAttribute(org.eclipse.core.resources.IMarker.SEVERITY, markerSeverity); - } catch (org.eclipse.core.runtime.CoreException e) { - «editorGen.plugin.activatorQualifiedClassName».getInstance().logError( - "Failed to create validation marker", e); «nonNLS(1)» - } - return marker; - } - «additions(it)» - } - ''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ParserUtils_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ParserUtils_qvto.xtend deleted file mode 100644 index 67ccb8b081d..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ParserUtils_qvto.xtend +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) 2007, 2014 Borland Software Corporation, CEA, 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model - * [221347] Got rid of generated interfaces - * (IObjectInitializer, IFeatureInitializer) and implementation thereof - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Christian W. Damus (CEA) - bug 440263 - */ -package aspects.xpt.providers - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase - -@Singleton class ParserUtils_qvto extends xpt.providers.ParserUtils_qvto { - @Inject extension Common - - override def String parserFieldName(GenCommonBase element) { - return element.stringUniqueIdentifier.toFirstLower + '_Parser' - } - - override def String parserAccessorName(GenCommonBase element) { - return 'get' + element.stringUniqueIdentifier.toFirstUpper + '_Parser' - } - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend deleted file mode 100644 index 746fe141cf9..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationDecoratorProvider.xtend +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) 2007, 2009, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Ansgar Radermacher (CEA LIST) - added support for EMF validation - */ -package aspects.xpt.providers - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import xpt.Common -import xpt.editor.Editor -import xpt.editor.VisualIDRegistry - -/** - * FIXME: [MG] monolithic template with most of the code "same-generated". - * Unfortunately, a lot of the logic is based around «IF editorGen.application == null» and we don't have a good ways to deal with taht in GMFT-runtimw - */ -@Singleton class ValidationDecoratorProvider extends xpt.providers.ValidationDecoratorProvider{ - @Inject extension Common; - - - @Inject Editor xptEditor; - @Inject VisualIDRegistry xptVisualIDRegistry; - - - -override ValidationDecoratorProvider(GenDiagram it) ''' -«copyright(editorGen)» -package «packageName(it)»; - -«generatedClassComment» -public class «className(it)» - extends org.eclipse.papyrus.uml.diagram.common.providers.ValidationDecoratorProvider - implements org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider { - - «generatedMemberComment» - public void createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) { - org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) decoratorTarget.getAdapter(org.eclipse.gef.EditPart.class); - if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart || - editPart instanceof org.eclipse.gef.editparts.AbstractConnectionEditPart) { - Object model = editPart.getModel(); - if ((model instanceof org.eclipse.gmf.runtime.notation.View)) { - org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model; - if (!(view instanceof org.eclipse.gmf.runtime.notation.Edge) && !view.isSetElement()) { - return; - } - } - org.eclipse.gef.EditDomain ed = editPart.getViewer().getEditDomain(); - if (!(ed instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain)) { - return; - } - if (((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain) ed).getEditorPart() instanceof - «xptEditor.qualifiedClassName(editorGen.editor)») { - decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget)); - } - } - } - - «generatedMemberComment» - public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) { - if (!(operation instanceof org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation)) { - return false; - } - org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget = - ((org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation) operation).getDecoratorTarget(); - org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) decoratorTarget.getAdapter( - org.eclipse.gmf.runtime.notation.View.class); - return view != null && «VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(view)); - } - - - «additions(it)» -} -''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend deleted file mode 100644 index 88db7f9eeed..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ValidationProvider.xtend +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - introduced GenAuditContext entity - * straightforward and simple #validate() implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - */ -package aspects.xpt.providers - -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenAuditRoot -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenDiagramElementTarget -import xpt.Common -import xpt.Common_qvto -import xpt.GenAuditRoot_qvto -import xpt.editor.VisualIDRegistry -import plugin.Activator -import xpt.CodeStyle - -@Singleton class ValidationProvider extends xpt.providers.ValidationProvider { - @Inject extension Common; - @Inject extension Common_qvto; - @Inject extension GenAuditRoot_qvto; - @Inject extension CodeStyle - - @Inject VisualIDRegistry xptVisualIDRegistry; - @Inject Activator xptActivator - - - override selectors(GenAuditRoot it) ''' - «IF it !=null» - «IF it.clientContexts !=null» - «FOR ctx : it.clientContexts» - «generatedMemberComment» - public static class «ctx.className» implements org.eclipse.emf.validation.model.IClientSelector { - - «generatedMemberComment» - public boolean selects(Object object) { - «IF ctx.ruleTargets.filter(typeof(GenDiagramElementTarget)).notEmpty» - if (isInDefaultEditorContext(object) && object instanceof org.eclipse.gmf.runtime.notation.View) { - final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) object); - boolean result = false; - «FOR e : getTargetDiagramElements(ctx)» - result = result || «VisualIDRegistry::visualID(e)».equals(id); - «ENDFOR» - return result; - } - return false; - «ELSE» - return isInDefaultEditorContext(object); - «ENDIF» - } - } - «ENDFOR» - «ENDIF» - «ENDIF» - ''' - - override constraintAdapters(GenAuditRoot it, GenDiagram diagram) ''' - «IF it !=null» - «IF diagram.editorGen.expressionProviders != null» - «FOR next : it.rules.filter[a | a.requiresConstraintAdapter]» - «constraintAdapter(next, diagram.editorGen.expressionProviders)» - «ENDFOR» - - «IF it.rules.exists[a | a.requiresConstraintAdapter]» - «constraintAdapters_formatMethod(it)» - «ENDIF» - «ENDIF» - «ENDIF» - ''' - - override runWithActiveConstraints(GenDiagram it) ''' - «generatedMemberComment» - public static void runWithConstraints(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, Runnable operation) { - final Runnable op = operation; - Runnable task = new Runnable() { - «overrideI» - public void run() { - try { - constraintsActive = true; - op.run(); - } finally { - constraintsActive = false; - } - } - }; - if(editingDomain != null) { - try { - editingDomain.runExclusive(task); - } catch (Exception e) { - «xptActivator.qualifiedClassName(editorGen.plugin)».getInstance().logError("Validation failed", e); «nonNLS(1)» - } - } else { - task.run(); - } - } - ''' - - override def strategy_support(GenDiagram it) ''' - «IF hasDiagramElementTargetRule(editorGen.audits)» - «generatedMemberComment» - public static org.eclipse.emf.validation.service.ITraversalStrategy getNotationTraversalStrategy( - org.eclipse.emf.validation.service.IBatchValidator validator) { - return new CtxSwitchStrategy(validator); - } - - «generatedMemberComment» - private static class CtxSwitchStrategy implements org.eclipse.emf.validation.service.ITraversalStrategy { - - «generatedMemberComment» - private org.eclipse.emf.validation.service.ITraversalStrategy defaultStrategy; - - «generatedMemberComment» - private String currentSemanticCtxId; - - «generatedMemberComment» - private boolean ctxChanged = true; - - «generatedMemberComment» - private org.eclipse.emf.ecore.EObject currentTarget; - - «generatedMemberComment» - private org.eclipse.emf.ecore.EObject preFetchedNextTarget; - - «generatedMemberComment» - private final String[] contextSwitchingIdentifiers; - - «generatedMemberComment» - CtxSwitchStrategy(org.eclipse.emf.validation.service.IBatchValidator validator) { - this.defaultStrategy = validator.getDefaultTraversalStrategy(); - this.contextSwitchingIdentifiers = new String[] { - «FOR e : getAllTargetDiagramElements(editorGen.audits) SEPARATOR ','»«VisualIDRegistry::visualID(e)»«ENDFOR» - }; - java.util.Arrays.sort(this.contextSwitchingIdentifiers); - } - - «generatedMemberComment» - public void elementValidated(org.eclipse.emf.ecore.EObject element, - org.eclipse.core.runtime.IStatus status) { - defaultStrategy.elementValidated(element, status); - } - - «generatedMemberComment» - public boolean hasNext() { - return defaultStrategy.hasNext(); - } - - «generatedMemberComment» - public boolean isClientContextChanged() { - if (preFetchedNextTarget == null) { - preFetchedNextTarget = next(); - prepareNextClientContext(preFetchedNextTarget); - } - return ctxChanged; - } - - «generatedMemberComment» - public org.eclipse.emf.ecore.EObject next() { - org.eclipse.emf.ecore.EObject nextTarget = preFetchedNextTarget; - if (nextTarget == null) { - nextTarget = defaultStrategy.next(); - } - this.preFetchedNextTarget = null; - return this.currentTarget = nextTarget; - } - - «generatedMemberComment» - public void startTraversal(java.util.Collection traversalRoots, org.eclipse.core.runtime.IProgressMonitor monitor) { - defaultStrategy.startTraversal(traversalRoots, monitor); - } - - «generatedMemberComment» - private void prepareNextClientContext(org.eclipse.emf.ecore.EObject nextTarget) { - if (nextTarget != null && currentTarget != null) { - if (nextTarget instanceof org.eclipse.gmf.runtime.notation.View) { - final String id = «xptVisualIDRegistry.getVisualIDMethodCall(editorGen.diagram)»((org.eclipse.gmf.runtime.notation.View) nextTarget); - String nextSemanticId = (id != null && java.util.Arrays.binarySearch(contextSwitchingIdentifiers, id) >= 0) ? id : null; - if ((currentSemanticCtxId != null && currentSemanticCtxId != nextSemanticId) - || (nextSemanticId != null && nextSemanticId != currentSemanticCtxId)) { - this.ctxChanged = true; - }«/*[artem] not sure why not ctxChanged = <expr>, is it intentional not to reset ctxChanged if condition did not match? I doubt. FIXME?*/» - currentSemanticCtxId = nextSemanticId; - } else { - // context of domain model - this.ctxChanged = currentSemanticCtxId != null; - currentSemanticCtxId = null; - } - } else { - this.ctxChanged = false; - } - } - } - «ENDIF» - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend deleted file mode 100644 index bb610d57672..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/ViewProvider.xtend +++ /dev/null @@ -1,684 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013, 2017 Borland Software Corporation 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: - * Alexander Shatalin (Borland) - initial API and implementation - * Artem Tikhomirov (Borland) - [257119] Create views directly, not through ViewFactories - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Thibault Landre (Atos Origin) - initial API and implementation - * Vincent Lorenzo (CEA-LIST) Add a line to initialize the display of the compartments to true - * Vincent Lorenzo (CEA-LIST) - Add lines to initialize the display of the labels - Bug 335987 [General][Enhancement] Show/Hide Connectors Labels and External Nodes Labels - * Vincent Lorenzo (CEA-LIST) - Bug 520733 - */ -package aspects.xpt.providers - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenChildLabelNode -import org.eclipse.gmf.codegen.gmfgen.GenChildNode -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenCompartment -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel -import org.eclipse.gmf.codegen.gmfgen.GenLabel -import org.eclipse.gmf.codegen.gmfgen.GenLink -import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.GenTopLevelNode -import org.eclipse.gmf.codegen.gmfgen.MetamodelType -import org.eclipse.gmf.codegen.gmfgen.NotationType -import org.eclipse.gmf.codegen.gmfgen.SpecializationType -import org.eclipse.papyrus.papyrusgmfgenextension.LabelVisibilityPreference -import xpt.Common_qvto -import xpt.diagram.Utils_qvto -import xpt.diagram.ViewmapAttributesUtils_qvto -import xpt.diagram.editpolicies.LinkUtils_qvto -import xpt.diagram.views.ViewStyles -import xpt.editor.VisualIDRegistry - -@Singleton class ViewProvider extends xpt.providers.ViewProvider { - @Inject extension Common; - @Inject extension Common_qvto; - - @Inject extension Utils_qvto; - @Inject extension LinkUtils_qvto; - @Inject extension ViewmapAttributesUtils_qvto; - @Inject extension VisualIDRegistry; - - @Inject VisualIDRegistry xptVisualIDRegistry; - @Inject ViewStyles xptViewStyles; - - override ViewProvider(GenDiagram it) ''' - «copyright(editorGen)» - package «packageName(it)»; - - «generatedClassComment» - public class «className(it)» «extendsList(it)»«implementsList(it)» { - - «generatedMemberComment» - public final boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) { - if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) { - return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation) operation); - } - «_assert('operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation')» - - /* we check this view provider is the good one for the currently edited diagram */ - if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateChildViewOperation) { - View container = ((org.eclipse.gmf.runtime.diagram.core.services.view.CreateChildViewOperation) operation).getContainerView(); - Diagram diagram = container.getDiagram(); - if(!getDiagramProvidedId().equals(diagram.getType())) { - return false; - } - } - - if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) { - return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation) operation); - } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) { - return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation) operation); - } else if (operation instanceof org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) { - return provides((org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation) operation); - } - return false; - } - - «generatedMemberComment» - protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation op) { - /* - if (op.getViewKind() == Node.class) - return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null; - if (op.getViewKind() == Edge.class) - return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()) != null; - */ - - // check Diagram Type should be the class diagram - String modelID = «getModelIDMethodCall(it)»(op.getContainerView()); - if(!getDiagramProvidedId().equals(modelID)) { - return false; - } - - String visualID = «getVisualIDMethodCall(it)»(op.getSemanticHint()); - if(org.eclipse.gmf.runtime.notation.Node.class.isAssignableFrom(op.getViewKind())) { - return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID); - } - - return true; - } - - «generatedMemberComment» - protected String getDiagramProvidedId() { - /* - * Indicates for which diagram this provider works for. - * <p> - * This method can be overloaded when diagram editor inherits from another one, but should never be <code>null</code> - * </p> - * - * @return the unique identifier of the diagram for which views are provided. - */ - return «VisualIDRegistry::modelID(it)»; - } - - «generatedMemberComment»«/* When diagram domain element is null only diagram kind is checked */» - protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation op) { - return «VisualIDRegistry::modelID(it)».equals(op.getSemanticHint())«IF domainDiagramElement != null» && «xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())) != null && !«xptVisualIDRegistry.getDiagramVisualIDMethodCall(it)»(getSemanticElement(op.getSemanticAdapter())).isEmpty()«ENDIF»; - } - - «generatedMemberComment» - protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation op) { - if (op.getContainerView() == null) { - return false; - } - org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter()); - org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter()); - String visualID; - if (op.getSemanticHint() == null) { - // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy. - // In this situation there should be NO elementType, visualID will be determined - // by VisualIDRegistry.getNodeVisualID() for domainElement. - if (elementType != null || domainElement == null) {«/* XXX Perhaps, better to fix CanonicalEP instead of this hack? */» - return false; - } - visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement); - } else { - visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(op.getSemanticHint()); - if (elementType != null) {«/* - Semantic hint is specified together with element type. - Both parameters should describe exactly the same diagram element. - In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for - domainElement (if specified) is the same as in element type. */» - - if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) { - return false; // foreign element type - } - - String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint(); - if (!op.getSemanticHint().equals(elementTypeHint)) { - return false; // if semantic hint is specified it should be the same as in element type - } - //if (domainElement != null && !visualID.equals(«getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) { - // return false; // visual id for node EClass should match visual id from element type - //} - } else {«/* - Element type is not specified. Domain element should be present (except pure design elements). - This method is called with EObjectAdapter as parameter from: - - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint) - - generated ViewFactory.decorateView() for parent element */» - «IF ! getAllTypedElements(it).filter[e|e.elementType != null].empty» - if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(op.getContainerView()))) { - return false; // foreign diagram - } - if (visualID != null) { - switch (visualID) { - «IF getAllNodes().exists[e|e.elementType instanceof NotationType]» - «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(NotationType))» - «localCaseVisualID(e)» - «ENDFOR» - break; // pure design element - «ENDIF» - «IF getAllNodes().exists[e|e.elementType instanceof MetamodelType || e.elementType instanceof SpecializationType]» - «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(MetamodelType))» - «localCaseVisualID(e)» - «ENDFOR» - «FOR e : getAllNodes().map[e|e.elementType].filter(typeof(SpecializationType))» - «localCaseVisualID(e)» - «ENDFOR» - if (domainElement == null || !visualID.equals(«xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(op.getContainerView(), domainElement))) { - return false; // visual id in semantic hint should match visual id for domain element - } - break;«/*FIXME: Perhaps, can return true or false right away, without any further check?*/» - «ENDIF» - default: - return false; - } - } - «ELSE» - return false; - «ENDIF» - } - } - - return «canCreateNodeMethodCall(it)»(op.getContainerView(), visualID); - } - - «generatedMemberComment»«/* XXX: unlike createNode, we don't check op.containerView() for null here. On purpose? */» - protected boolean provides(org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation op) { - org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(op.getSemanticAdapter()); - - if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType) || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) { - return false; // foreign element type - } - - String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint(); - if (elementTypeHint == null || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) { - return false; // our hint is visual id and must be specified, and it should be the same as in element type - } - //String visualID = «getVisualIDMethodCall(it)»(elementTypeHint); - //org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(op.getSemanticAdapter()); - //if (domainElement != null && !visualID.equals(«getLinkWithClassVisualIDMethodCall(it)»(domainElement))) { - // return false; // visual id for link EClass should match visual id from element type - //} - return true; «««Does it make sense to check visualID here, like we did for nodes? - } - - - «generatedMemberComment» - @SuppressWarnings("unchecked") - public org.eclipse.gmf.runtime.notation.Diagram createDiagram(org.eclipse.core.runtime.IAdaptable semanticAdapter, String diagramKind, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();«/* FIXME instantiate diagramRunTimeClass instead */» - org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils.stampCurrentVersion(diagram);«/* Papyrus specific diagram versioning */» - diagram.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle()); - «xptViewStyles.addCustomStyles(it, 'diagram.getStyles()')» - diagram.setType(«VisualIDRegistry::modelID(it)»); - diagram.setElement(«IF domainDiagramElement != null»getSemanticElement(semanticAdapter)«ELSE»null«ENDIF»); - «IF units != null» - diagram.setMeasurementUnit(org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase»_LITERAL); - «ENDIF» - «IF ! styles.empty» - // initializeFromPreferences - org.eclipse.jface.preferences.IPreferenceStore store = (org.eclipse.jface.preferences.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initializeStyles(it, 'diagram', 'store', false, false, false)» - «ENDIF» - return diagram; - } - - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Node createNode(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - final org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter); - final String visualID; - if (semanticHint == null) { - visualID = «xptVisualIDRegistry.getNodeVisualIDMethodCall(it)»(containerView, domainElement); - } else { - visualID = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(semanticHint); - } - if (visualID != null) { - switch(visualID) { - «FOR n : getAllNodes()» - «xptVisualIDRegistry.caseVisualID(n)» - return create«n.stringUniqueIdentifier»(domainElement, containerView, index, persisted, preferencesHint); - «ENDFOR» - } - } - // can't happen, provided #provides(CreateNodeViewOperation) is correct - return null; - } - - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Edge createEdge(org.eclipse.core.runtime.IAdaptable semanticAdapter, org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter); - String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint(); - String vid = «xptVisualIDRegistry.getVisualIDMethodCall(it)»(elementTypeHint); - if (vid != null) { - switch (vid) { - «FOR link : links» - «xptVisualIDRegistry.caseVisualID(link)» - return create«link.stringUniqueIdentifier»(«IF isTypeLink(link)» getSemanticElement(semanticAdapter), «ENDIF»containerView, index, persisted, preferencesHint); - «ENDFOR» - } - } - // can never happen, provided #provides(CreateEdgeViewOperation) is correct - return null; - } - - «FOR next : getAllNodes()» - «createNodeMethod(next)» - «ENDFOR» - «FOR next : links» - «createEdgeMethod(next)» - «ENDFOR» - - «IF ! topLevelNodes.empty» - «generatedMemberComment» - protected void stampShortcut(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.Node target) { - if (!«VisualIDRegistry::modelID(it)».equals(«xptVisualIDRegistry.getModelIDMethodCall(it)»(containerView))) { - «addShortcutAnnotation(it, 'target')» - } - } - «ENDIF» - - «IF links.map[l|l.labels].flatten.notEmpty || topLevelNodes.map[n|n.labels].flatten.notEmpty || childNodes.map[n|n.labels].flatten.notEmpty» - «generatedMemberComment» - protected org.eclipse.gmf.runtime.notation.Node createLabel(org.eclipse.gmf.runtime.notation.View owner, String hint) { - org.eclipse.gmf.runtime.notation.DecorationNode rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDecorationNode(); - rv.setType(hint); - org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true); - return rv; - } - «ENDIF» - - «IF getAllNodes().map[n|n.compartments].flatten.notEmpty» - «generatedMemberComment» - protected org.eclipse.gmf.runtime.notation.Node createCompartment(org.eclipse.gmf.runtime.notation.View owner, String hint, boolean canCollapse, boolean hasTitle, boolean canSort, boolean canFilter) { - //SemanticListCompartment rv = NotationFactory.eINSTANCE.createSemanticListCompartment(); - //rv.setShowTitle(showTitle); - //rv.setCollapsed(isCollapsed); - org.eclipse.gmf.runtime.notation.Node rv = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBasicCompartment(); - - rv.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds()); - - if (hasTitle) { - org.eclipse.gmf.runtime.notation.TitleStyle ts = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle(); - rv.getStyles().add(ts); - } - if (canSort) { - rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle()); - } - if (canFilter) { - rv.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle()); - } - rv.setType(hint); - org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(owner, rv, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true); - return rv; - } - «ENDIF» - - «getSemanticElementMethod(it)» - «getSemanticElementTypeMethod(it)» - «additions(it)» - } - ''' - - - - override dispatch createNodeMethod(GenNode it) ''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - «IF canUseShapeStyle(viewmap)» - org.eclipse.gmf.runtime.notation.Shape node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape(); - «ELSE» - org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode(); - node.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());«/* FIXME Contionally add this style, whether toolsmith needs Notes or not */» - «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, 'node.getStyles()')» - «ENDIF» - «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')» - «xptViewStyles.addCustomStyles(it, 'node.getStyles()')» - node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds()); - node.setType(«xptVisualIDRegistry.typeMethodCall(it)»); - org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted); - node.setElement(domainElement); - «IF it instanceof GenTopLevelNode» - stampShortcut(containerView, node); - «ENDIF» - // initializeFromPreferences «/* XXX Perhaps, do init only once, for complete figure? */» - final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initializeStyles(it, 'node', 'prefStore', !isFixedForeground(viewmap), !isFixedBackground(viewmap), !isFixedFont(viewmap))» - «FOR label : it.labels» - «initLabel(label, 'node', 'prefStore')» - «ENDFOR» - «FOR comp : it.compartments» - «initCompartment(comp, 'node', 'prefStore')» - «ENDFOR» - ««« BEGIN Papyrus Modification - «IF compartments.size != 0» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(«'node'», «'prefStore'», "«elementType.displayName»"); - «ENDIF» - ««« END Papyrus Modification - «initLabelVisibility(it,'node', 'prefStore')» - return node; - } - ''' - - // Location as layoutConstraint, no children - override dispatch createNodeMethod(GenChildLabelNode it) ''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Node create«stringUniqueIdentifier»(org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShape(); - node.setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation());«/* [artem] XXX not sure, why LabelNode needs location */» - «xptViewStyles.addLinkedDiagramStyle(it, 'node.getStyles()')» - «xptViewStyles.addCustomStyles(it, 'node.getStyles()')» - node.setType(«xptVisualIDRegistry.typeMethodCall(it)»); - org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, node, index, persisted); - node.setElement(domainElement); - - final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initFontFromPrefs(it,'node', 'prefStore')» - «initForegroundFromPrefs(it,'node', 'prefStore')» - return node; - } - ''' - - override createEdgeMethod(GenLink it) ''' - «generatedMemberComment» - public org.eclipse.gmf.runtime.notation.Edge create«stringUniqueIdentifier»(«IF isTypeLink(it)»org.eclipse.emf.ecore.EObject domainElement, «ENDIF»org.eclipse.gmf.runtime.notation.View containerView, int index, boolean persisted, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) { - «IF isFixedForeground(viewmap)» - org.eclipse.gmf.runtime.notation.Edge edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createEdge(); - edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle()); - «ELSE» - org.eclipse.gmf.runtime.notation.Connector edge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnector(); - «ENDIF» - «IF !isFixedFont(viewmap)» - edge.getStyles().add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle()); - «ENDIF» - «xptViewStyles.addCustomStyles(it, 'edge.getStyles()')» - org.eclipse.gmf.runtime.notation.RelativeBendpoints bendpoints = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRelativeBendpoints(); - java.util.List<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint> points = new java.util.ArrayList<org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint>(2); - points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint()); - points.add(new org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint()); - bendpoints.setPoints(points); - edge.setBendpoints(bendpoints); - org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.insertChildView(containerView, edge, index, persisted); - edge.setType(«xptVisualIDRegistry.typeMethodCall(it)»); - edge.setElement(«IF isTypeLink(it)»domainElement«ELSE»null«ENDIF»); - // initializePreferences - final org.eclipse.jface.preference.IPreferenceStore prefStore = (org.eclipse.jface.preference.IPreferenceStore) preferencesHint.getPreferenceStore(); - «initializeStyles(it, 'edge', 'prefStore', !isFixedForeground(viewmap), false, !isFixedFont(viewmap))» - //org.eclipse.gmf.runtime.notation.Routing routing = org.eclipse.gmf.runtime.notation.Routing.get(prefStore.getInt(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE)); - //if (routing != null) { - // org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(edge, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); - //} - «initRountingFromPrefs(it,'edge', 'prefStore')» - «FOR label : it.labels» - «initLabel(label, 'edge', 'prefStore')» - «ENDFOR» - «initLabelVisibility(it,'edge', 'prefStore')» - return edge; - } - ''' - - override getSemanticElementMethod(GenDiagram it) ''' - «generatedMemberComment» - protected org.eclipse.emf.ecore.EObject getSemanticElement(org.eclipse.core.runtime.IAdaptable semanticAdapter) { - if (semanticAdapter == null) { - return null; - } - org.eclipse.emf.ecore.EObject eObject = (org.eclipse.emf.ecore.EObject) semanticAdapter.getAdapter(org.eclipse.emf.ecore.EObject.class); - if (eObject != null) { - return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.resolve(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(eObject), eObject); - } - return null; - } - ''' - - override getSemanticElementTypeMethod(GenDiagram it) ''' - «generatedMemberComment» - protected org.eclipse.gmf.runtime.emf.type.core.IElementType getSemanticElementType(org.eclipse.core.runtime.IAdaptable semanticAdapter) { - if (semanticAdapter == null) { - return null; - } - return (org.eclipse.gmf.runtime.emf.type.core.IElementType) semanticAdapter.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class); - } - ''' - override initLabel(GenLabel it, String nodeVar, String prefStoreVar) ''' - «var String labelVar = it.stringUniqueIdentifier.toFirstLower» - org.eclipse.gmf.runtime.notation.Node «labelVar» = createLabel(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)»); - «IF it.modelFacet !=null» - «xptViewStyles.addTextStyle(it.modelFacet, labelVar + '.getStyles()')» - «ENDIF» - «xptViewStyles.addCustomStyles(it, labelVar + '.getStyles()')» - «IF it.oclIsKindOf(typeof(GenExternalNodeLabel)) || it.oclIsKindOf(typeof(GenLinkLabel))» - «labelVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation()); - «xptViewStyles.offset(it, labelVar)» - «ENDIF» - «initializeStyles(it, labelVar, prefStoreVar, false, false, false)» - ''' - - override def initCompartment(GenCompartment it, String nodeVar, String prefStoreVar) ''' - «var String compartmentVar= it.stringUniqueIdentifier.toFirstLower» - «IF it.styles.notEmpty || isStoringChildPositions(it.layoutType)»org.eclipse.gmf.runtime.notation.Node «compartmentVar» = «ENDIF»createCompartment(«nodeVar», «xptVisualIDRegistry.typeMethodCall(it)», «canCollapse», «needsTitle», «listLayout», «listLayout»); - «xptViewStyles.addCustomStyles(it, compartmentVar + '.getStyles()')» - «IF isStoringChildPositions(it.layoutType)» - «IF viewmap.canUseShapeStyle()» - «compartmentVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle()); - «ELSE /* Intentionally not adding Description style, as it deemed to be useless for compartments (can't avoid for ShapeStyle - benefits of a single style overwheight drawbacks of Description presence) */» - «xptViewStyles.addFontLineFillStylesConditionally(it.viewmap, compartmentVar + '.getStyles()')» - «ENDIF» - «compartmentVar».setLayoutConstraint(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds()); - «initializeStyles(it, compartmentVar, prefStoreVar, !viewmap.isFixedForeground(), !viewmap.isFixedBackground(), !viewmap.isFixedFont())» - «ELSE» - «initializeStyles(it, compartmentVar, prefStoreVar, false, false, false)» - «ENDIF» - ''' - -override additions(GenDiagram it)''' - - «generatedMemberComment» - private void initFontStyleFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName) - { - String fontConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.FONT); - String fontColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FONT); - - org.eclipse.gmf.runtime.notation.FontStyle viewFontStyle = (org.eclipse.gmf.runtime.notation.FontStyle) view.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FONT_STYLE); - if (viewFontStyle != null) - { - org.eclipse.swt.graphics.FontData fontData = org.eclipse.jface.preference.PreferenceConverter.getFontData(store, fontConstant); - viewFontStyle.setFontName(fontData.getName()); - viewFontStyle.setFontHeight(fontData.getHeight()); - viewFontStyle.setBold((fontData.getStyle() & org.eclipse.swt.SWT.BOLD) != 0); - viewFontStyle.setItalic((fontData.getStyle() & org.eclipse.swt.SWT.ITALIC) != 0); - - org.eclipse.swt.graphics.RGB fontRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fontColorConstant); - viewFontStyle.setFontColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fontRGB).intValue()); - } - } - - «generatedMemberComment» - private void initForegroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName) - { - String lineColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE); - org.eclipse.swt.graphics.RGB lineRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, lineColorConstant); - org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(lineRGB)); - } - - «generatedMemberComment» - private void initBackgroundFromPrefs(org.eclipse.gmf.runtime.notation.View view, final org.eclipse.jface.preference.IPreferenceStore store, String elementName) - { - String fillColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL); - String gradientColorConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT); - String gradientPolicyConstant = org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName,org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.GRADIENT_POLICY); - - - org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store, fillColorConstant); - org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(), org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB)); - - - org.eclipse.gmf.runtime.notation.FillStyle fillStyle = (org.eclipse.gmf.runtime.notation.FillStyle) view - .getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.Literals.FILL_STYLE); - fillStyle - .setFillColor(org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB).intValue()); - - ; - if (store.getBoolean(gradientPolicyConstant)) { - org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter( - store.getString(gradientColorConstant)); - fillStyle.setGradient(gradientPreferenceConverter.getGradientData()); - fillStyle - .setTransparency(gradientPreferenceConverter.getTransparency()); - } - } - - -''' - -override initFontFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar)''' - «specificInitFontFromPrefs(it,viewVar, prefStoreVar)» -''' - - -def specificInitFontFromPrefs(GenNode it,String viewVar, String prefStoreVar)''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitFontFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' -«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitFontFromPrefs(GenLink it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitFontFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' -«IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initFontStyleFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - - - -override initForegroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' - «specificInitForegroundFromPrefs(it,viewVar, prefStoreVar)» -''' - -def specificInitForegroundFromPrefs(GenNode it,String viewVar, String prefStoreVar)''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitForegroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitForegroundFromPrefs(GenLink it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initForegroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitForegroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' -''' - - - - - -override initBackgroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' - « specificInitBackgroundFromPrefs(it,viewVar, prefStoreVar) » -''' - -def specificInitBackgroundFromPrefs(GenNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitBackgroundFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitBackgroundFromPrefs(GenLink it, String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initBackgroundFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitBackgroundFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' -''' - - -def initRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' - « specificInitRountingFromPrefs(it,viewVar, prefStoreVar)» -''' - -def specificInitRountingFromPrefs(GenNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitRountingFromPrefs(GenChildNode it,String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitRountingFromPrefs(GenLink it, String viewVar, String prefStoreVar) ''' - «IF !"UNDEFINED".equals(elementType.displayName.toUpperCase())» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initRountingFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -def specificInitRountingFromPrefs(GenCommonBase it,String viewVar, String prefStoreVar) ''' -''' - -//write the line to initialize the property isVisible for the label of the link -def initLabelVisibility(GenLink it,String viewVar, String prefStoreVar) ''' - - «IF it.labels.filter(typeof (GenLinkLabel)).exists[lbl | - (it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[label | label.linkLabels.contains(lbl)]).size !=0]» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -//write the line to initialize the property isVisible for the label of the link -def initLabelVisibility(GenNode it,String viewVar, String prefStoreVar) ''' - «IF it.labels.filter(typeof (GenExternalNodeLabel)).exists[lbl | - (it.eResource.allContents.filter(typeof (LabelVisibilityPreference)).filter[label | label.externalNodeLabels.contains(lbl)]).size !=0]» - org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(«viewVar», «prefStoreVar», "«elementType.displayName»"); - «ENDIF» -''' - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend deleted file mode 100644 index 594db96b084..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/VisualTypeProvider.xtend +++ /dev/null @@ -1,98 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2015 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: - * Christian W. Damus - Initial API and implementation - * - *****************************************************************************/ - -package aspects.xpt.providers - -import javax.inject.Inject -import javax.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.papyrus.papyrusgmfgenextension.GenVisualTypeProvider -import xpt.CodeStyle -import xpt.Common -import xpt.editor.VisualIDRegistry -import xpt.providers.ElementTypes - -/** - * Template for the class that plugs in knowledge of the Visual IDs of this diagram - * into the {@code VisualTypeService}. - */ -@Singleton class VisualTypeProvider { - - @Inject extension Common - @Inject extension CodeStyle - @Inject VisualIDRegistry visualIDs - @Inject ElementTypes elementTypes - - def packageName(GenDiagram it) '''«it.providersPackageName»''' - - def className(GenDiagram it) '''«GenVisualTypeProvider.getClassName(it)»''' - - def qualifiedClassName(GenDiagram it) '''«packageName(it)».«className(it)»''' - - protected def constructor(GenDiagram it) ''' - «generatedMemberComment» - public «it.className»() { - super(); - } - ''' - - protected def getElementType_(GenDiagram it) ''' - «generatedMemberComment» - «overrideI» - public org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(org.eclipse.gmf.runtime.notation.Diagram diagram, String viewType) { - org.eclipse.gmf.runtime.emf.type.core.IElementType result = null; - - try { - result = «elementTypes.qualifiedClassName(it)».getElementType(viewType); - } catch (NumberFormatException e) { - // Not supported by this diagram - } - - return result; - } - ''' - - protected def getNodeType(GenDiagram it) ''' - «generatedMemberComment» - «overrideI» - public String getNodeType(org.eclipse.gmf.runtime.notation.View parentView, org.eclipse.emf.ecore.EObject element) { - return «visualIDs.getNodeVisualIDMethodCall(it)»(parentView, element); - } - ''' - - protected def getLinkType(GenDiagram it) ''' - «generatedMemberComment» - «overrideI» - public String getLinkType(org.eclipse.gmf.runtime.notation.Diagram diagram, org.eclipse.emf.ecore.EObject element) { - return «visualIDs.getLinkWithClassVisualIDMethodCall(it)»(element); - } - ''' - - public def VisualTypeProvider(GenDiagram it) ''' - «editorGen.copyright» - package «packageName»; - - «generatedClassComment» - public class «className» extends org.eclipse.papyrus.infra.gmfdiag.common.service.visualtype.AbstractVisualTypeProvider { - - «constructor» - - «getElementType_» - - «getNodeType» - - «getLinkType» - - } - ''' -}
\ No newline at end of file diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend deleted file mode 100644 index f8e6615941d..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/aspects/xpt/providers/extensions.xtend +++ /dev/null @@ -1,225 +0,0 @@ -/** - * Copyright (c) 2007, 2010, 2013, 2017 Borland Software Corporation 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: - * Dmitry Stadnik (Borland) - initial API and implementation - * Michael Golubev (Montages) - #386838 - migrate to Xtend2 - * Vincent Lorenzo (CEA-LIST) - Bug 520882 - */ -package aspects.xpt.providers - -import aspects.xpt.Common -import com.google.inject.Inject -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenCommonBase -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.gmf.codegen.gmfgen.MetamodelType -import org.eclipse.gmf.codegen.gmfgen.NotationType -import org.eclipse.gmf.codegen.gmfgen.SpecializationType -import parsers.ParserProvider -import xpt.diagram.Utils_qvto -import xpt.diagram.edithelpers.EditHelper -import xpt.diagram.edithelpers.EditHelperAdvice -import xpt.providers.ShortcutsDecoratorProvider - -@Singleton class extensions extends xpt.providers.extensions { - @Inject extension Common; - @Inject extension Utils_qvto; - - @Inject ViewProvider viewProvider; - @Inject xpt.providers.IconProvider iconProvider; - @Inject xpt.providers.EditPartProvider editPartProvider; - @Inject ParserProvider labelParsers; - @Inject ShortcutsDecoratorProvider shorcutProvider; - @Inject VisualTypeProvider visualTypeProvider; - @Inject EditHelper editHelper; - @Inject EditHelperAdvice editHelperAdvice; - - override extensions(GenDiagram it) ''' - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders" id="view-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<viewProvider class="«viewProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«notationViewProviderPriority»"/> - «IF ! shortcutsProvidedFor.empty/*allow provider activation when another diagram tries to create a node, perhaps ours*/» - «tripleSpace(3)»<object id="referencing-diagrams" class="org.eclipse.gmf.runtime.notation.Diagram"> - «tripleSpace(4)»<method name="getType()" value="«FOR s : shortcutsProvidedFor SEPARATOR ','»«s»«ENDFOR»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" containerViews="referencing-diagrams"/> - «ENDIF» - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="«editorGen.modelID»"/> - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="«commaSeparatedVisualIDs(allNodes)»"/> - «IF ! links.empty/*it is unlikely there would be a diagram without a node, but a diagram without links deemed possible */» - «tripleSpace(3)»<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="«commaSeparatedVisualIDs(links)»"/> - «ENDIF» - «tripleSpace(2)»</viewProvider> - «tripleSpace(1)»</extension> - - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<editpartProvider class="«editPartProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«editPartProviderPriority»"/> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram"> - «tripleSpace(4)»<method name="getType()" value="«editorGen.modelID»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(links)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(allNodes.map[n|n.labels].flatten)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(compartments)»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/> - «tripleSpace(2)»</editpartProvider> - «tripleSpace(1)»</extension> - -««« «modelingAssistantProvider(it)» - - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders" id="icon-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<IconProvider class="«iconProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«iconProviderPriority»"/> - «tripleSpace(2)»</IconProvider> - «tripleSpace(1)»</extension> - «IF editorGen.labelParsers != null && editorGen.labelParsers.extensibleViaService» - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<ParserProvider class="«labelParsers.qualifiedClassName(editorGen.labelParsers)»"> - «tripleSpace(3)»<Priority name="«editorGen.labelParsers.providerPriority»"/> - «tripleSpace(2)»</ParserProvider> - «tripleSpace(1)»</extension> - «ENDIF» - «IF generateShortcutIcon()» - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders" id="decorator-provider"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<decoratorProvider class="«shorcutProvider.qualifiedClassName(it)»"> - «tripleSpace(3)»<Priority name="«shortcutsDecoratorProviderPriority»"/> - «tripleSpace(3)»<object class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)" id="generated-top-nodes"> - «tripleSpace(4)»<method name="getType()" value="«commaSeparatedVisualIDs(it.topLevelNodes)/*generated code supports shortcuts only to top-level nodes*/»"/> - «tripleSpace(3)»</object> - «tripleSpace(3)»<context decoratorTargets="generated-top-nodes"/> - «tripleSpace(2)»</decoratorProvider> - «tripleSpace(1)»</extension> - «ENDIF» - -««« commented for bug 520882 -««« «IF !getLocalDefineTypedElements(it).empty» -««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types"> -««« «tripleSpace(2)»«xmlGeneratedTag» -««« «FOR e : getLocalDefineTypedElements(it)» -««« «elementTypeSafe(e.elementType)» -««« «ENDFOR» -««« «tripleSpace(1)»</extension> -««« «ENDIF» -««« -««« «tripleSpace(1)»<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings" id="element-types-bindings"> -««« «tripleSpace(2)»«xmlGeneratedTag» -««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size<1» -««« «tripleSpace(2)»<clientContext id="«editorGen.plugin.ID».TypeContext"> -««« «tripleSpace(3)»<enablement> -««« «tripleSpace(4)»<test -««« «tripleSpace(5)»property="org.eclipse.gmf.runtime.emf.core.editingDomain" -««« «tripleSpace(5)»value="«editingDomainID»"/> -««« «tripleSpace(3)»</enablement> -««« «tripleSpace(2)»</clientContext> -««« «tripleSpace(2)»<binding context="«editorGen.plugin.ID».TypeContext"> -««« «ENDIF» -««« «IF it.eResource.allContents.filter(typeof (GenerateUsingElementTypeCreationCommand)).size>0» -««« -««« <binding context="org.eclipse.papyrus.infra.services.edit.TypeContext"> -««« «ENDIF» -««« «FOR e : getLocalDefineTypedElements(it)» -««« «tripleSpace(3)»<elementType ref="«e.elementType.uniqueIdentifier»"/> -««« «ENDFOR» -««« «tripleSpace(3)»<advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/> -««« «tripleSpace(2)»</binding> -««« «tripleSpace(1)»</extension> - - «extraLineBreak» - «tripleSpace(1)»<extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> - «tripleSpace(2)»«xmlGeneratedTag» - «tripleSpace(2)»<visualTypeProvider - «tripleSpace(4)»class="«visualTypeProvider.qualifiedClassName(it)»" - «tripleSpace(4)»diagramType="«editorGen.modelID»"> - «tripleSpace(3)»</visualTypeProvider> - «tripleSpace(1)»</extension> - ''' - - def getLocalDefineTypedElements(GenDiagram it) { - getAllTypedElements(it).filter[et| false == et.elementType.definedExternally] - } -// override modelingAssistantProvider(GenDiagram it) ''' -// -// <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders" id="modelassist-provider"> -// «xmlGeneratedTag» -// <modelingAssistantProvider class="«getModelingAssistantProviderQualifiedClassName()»"> -// <Priority name="«modelingAssistantProviderPriority»"/> -// <object class="«getEditPartQualifiedClassName()»" id="«getUniqueIdentifier()»"/> -// «FOR n :topLevelNodes» -// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/> -// «ENDFOR» -// «FOR n:childNodes» -// <object class="«n.getEditPartQualifiedClassName()»" id="«n.getUniqueIdentifier()»"/> -// «ENDFOR» -// <context elements="«getUniqueIdentifier()»,«FOR n : topLevelNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»,«FOR n : childNodes SEPARATOR ','»«n.getUniqueIdentifier()»«ENDFOR»"/> -// </modelingAssistantProvider> -// </extension> -// -// -// ''' - - override def commaSeparatedVisualIDs(Iterable<? extends GenCommonBase> list) '''«FOR gcb : list SEPARATOR ','»«gcb.stringUniqueIdentifier»«ENDFOR»''' - - override def dispatch elementType(MetamodelType it) ''' - «tripleSpace(2)»<metamodel nsURI="«getMetaClass().genPackage.getEcorePackage.nsURI»"> - «tripleSpace(3)»<metamodelType - «tripleSpace(5)»id="«uniqueIdentifier»" - «IF null != displayName» - «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" - «ENDIF» - «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" - «tripleSpace(5)»eclass="«getMetaClass().ecoreClass.name»" - «tripleSpace(5)»edithelper="«editHelper.qualifiedClassName(it)»"> - «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> - «tripleSpace(3)»</metamodelType> - «tripleSpace(2)»</metamodel> - ''' - - override def specializationType(SpecializationType it) ''' - «tripleSpace(3)»<specializationType - «tripleSpace(5)»id="«uniqueIdentifier»" - «IF null != displayName» - «tripleSpace(5)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" - «ENDIF» - «tripleSpace(5)»kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"«IF editHelperAdviceClassName != null» - «tripleSpace(5)»edithelperadvice="«editHelperAdvice.qualifiedClassName(it)»"«ENDIF»> - «tripleSpace(4)»<specializes id="«IF (null == metamodelType)»org.eclipse.gmf.runtime.emf.type.core.null«ELSE»«metamodelType. - uniqueIdentifier»«ENDIF»"/> - «tripleSpace(4)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> - «tripleSpace(3)»</specializationType> - ''' - - override def dispatch elementType(NotationType it) ''' - «tripleSpace(2)»<specializationType - «tripleSpace(4)»id="«uniqueIdentifier»" - «IF null != displayName» - «tripleSpace(4)»name="%metatype.name.«diagramElement.stringUniqueIdentifier»" - «ENDIF» - «tripleSpace(4)»kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType"> - «tripleSpace(3)»<specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/> - «tripleSpace(3)»<param name="semanticHint" value="«diagramElement.stringVisualID»"/> - «tripleSpace(2)»</specializationType> - ''' -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/EditHelperUtils_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/utils/EditHelperUtils_qvto.xtend deleted file mode 100644 index 803f5520deb..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/EditHelperUtils_qvto.xtend +++ /dev/null @@ -1,18 +0,0 @@ - -package utils - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenDiagram -import org.eclipse.papyrus.papyrusgmfgenextension.AdditionalEditPartCandies - -@Singleton class EditHelperUtils_qvto { - - def String getBaseEditHelperFullName(GenDiagram diagram) { - if(!(diagram.eResource.allContents.filter(typeof(AdditionalEditPartCandies)).empty)) { - return diagram.eResource.allContents.filter(typeof(AdditionalEditPartCandies)).head.baseEditHelperPackage + "." + diagram.baseEditHelperClassName - } else { - return diagram.getBaseEditHelperQualifiedClassName(); - } - - } -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/EditPartsUtils_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/utils/EditPartsUtils_qvto.xtend deleted file mode 100644 index 7eaa6525c7f..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/EditPartsUtils_qvto.xtend +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010 CEA LIST - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Yann Tanguy (CEA LIST) - initial API and implementation - * - */ -package utils - -import com.google.inject.Singleton -import java.util.List -import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.papyrus.papyrusgmfgenextension.SpecificLocatorExternalLabel - -@Singleton class EditPartsUtils_qvto { - - def boolean hasSpecificLocator(GenExternalNodeLabel it) { - - return it.eResource.allContents.filter(typeof(SpecificLocatorExternalLabel)).filter[v|v.genExternalNodeLabel.contains(it)].size != 0 - } - - def String getSpecificLocator(GenExternalNodeLabel it) { - - if(hasSpecificLocator(it)) { - return it.eResource.allContents.filter(typeof(SpecificLocatorExternalLabel)).filter[v|v.genExternalNodeLabel.contains(it)].head.classpath - } - - return null; - } - - def List<GenExternalNodeLabel> getExternalLabelsWithoutSpecificLocator(GenNode it) { - return it.labels.filter(typeof(GenExternalNodeLabel)).filter[l|!hasSpecificLocator(l)].toList; - } - - def List<GenExternalNodeLabel> getExternalLabelsWithSpecificLocator(GenNode it) { - return it.labels.filter(typeof(GenExternalNodeLabel)).filter[l|hasSpecificLocator(l)].toList; - } - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/NodeConstraintUtils_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/utils/NodeConstraintUtils_qvto.xtend deleted file mode 100644 index 963cc1120c5..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/NodeConstraintUtils_qvto.xtend +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2010 CEA LIST - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Yann Tanguy (CEA LIST) - initial API and implementation - * - */ -package utils - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet -import org.eclipse.papyrus.papyrusgmfgenextension.GenNodeConstraint - -@Singleton class NodeConstraintUtils_qvto { - - def boolean hasNodeCreationConstraint(GenNode it) { - return it.eResource.allContents.filter(typeof(GenNodeConstraint)).filter[v| - v.genNode.contains(it) && v.genConstraint != null].size != 0 - } - - def GenNodeConstraint getNodeCreationConstraint(GenNode it) { - - if (hasNodeCreationConstraint(it)) { - return it.eResource.allContents.filter(typeof(GenNodeConstraint)).filter[v| - v.genNode.contains(it) && v.genConstraint != null].head - } else { - return null; - } - } - - def GenNode getOwningGenNode(TypeModelFacet it) { - - return it.eResource.allContents.filter(typeof(GenNode)).filter[v|v.modelFacet == it].head - } - - def String getNodeCreationConstraintBody(GenNode it) { - var nodeConstraint = getNodeCreationConstraint(it); - - if (hasNodeCreationConstraint(it)) { - if ((nodeConstraint.genConstraint != null) && (nodeConstraint.genConstraint.body != null)) { - return nodeConstraint.genConstraint.body; - } - } - return "No GenNodeConstraint found."; - } - -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/PrefsConstant_qvto.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/utils/PrefsConstant_qvto.xtend deleted file mode 100644 index 314a97776e8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/PrefsConstant_qvto.xtend +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2008 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: - * Thibault Landre (Atos Origin) - initial API and implementation - * modified by Patrick Tessier(CEA LIST) - */ -package utils - -import com.google.inject.Singleton - -@Singleton class PrefsConstant_qvto { - - - def String getDiagramPreferencePageCategory() { - return "org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams" - } - - def String getPreferenceConstant() { - return "_PREF_" - } - - def String getPreferenceGradientPolicyConstant(String _element) { - return _element + getPreferenceConstant() + "GRADIENT_POLICY" - } - - def String getPreferenceGradientColorConstant(String _element) { - return _element + getPreferenceConstant() + "GRADIENT_COLOR" - } - - def String getPreferenceFillColorConstant(String _element) { - return _element + getPreferenceConstant() + "FILL_COLOR" - } - - def String getPreferenceFontColorConstant(String _element) { - return _element + getPreferenceConstant() + "FONT_COLOR" - } - - def String getPreferenceFontConstant(String _element) { - return _element + getPreferenceConstant() + "FONT" - } - - def String getPreferenceLineColorConstant(String _element) { - return _element + getPreferenceConstant() + "LINE_COLOR" - } - - def String getPreferenceJumpLinkConstant() { - return getPreferenceConstant() + "JUMPLINK_" - } - - def String getPreferenceJumpLinkReverseConstant(String _element) { - return _element + getPreferenceJumpLinkConstant() + "REVERSE" - } - - def String getPreferenceJumpLinkStatusConstant(String _element) { - return _element + getPreferenceJumpLinkConstant() + "STATUS" - } - - def String getPreferenceJumpLinkTypeConstant(String _element) { - return _element + getPreferenceJumpLinkConstant() + "TYPE" - } - - def String getPreferenceRoutingConstant() { - return getPreferenceConstant() + "ROUTING_" - } - - def String getPreferenceRoutingDistancePolicyConstant(String _element) { - return _element + getPreferenceRoutingConstant() + "DISTANCE_POLICY" - } - - def String getPreferenceRoutingObstructionPolicyConstant(String _element) { - return _element + getPreferenceRoutingConstant() + "OBSTRUCTION_POLICY" - } - - def String getPreferenceRoutingStyleConstant(String _element) { - return _element + getPreferenceRoutingConstant() + "STYLE" - } - - def String getPreferenceSmoothnessConstant(String _element) { - return _element + getPreferenceConstant() + "SMOOTHNESS" - } - - def String getPreferencePageSuffix() { - return "PreferencePage" - } -} diff --git a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/UtilsItemSemanticEditPolicy.xtend b/plugins/developer/org.eclipse.papyrus.def/xtend/utils/UtilsItemSemanticEditPolicy.xtend deleted file mode 100644 index 0999d8861f8..00000000000 --- a/plugins/developer/org.eclipse.papyrus.def/xtend/utils/UtilsItemSemanticEditPolicy.xtend +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * - *****************************************************************************/ -package utils - -import com.google.inject.Singleton -import org.eclipse.gmf.codegen.gmfgen.GenNode -import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet - -@Singleton class UtilsItemSemanticEditPolicy { - - //Command for the EditPart which use the Delete Service - def getDestroyElementCommandByService(GenNode i) ''' - protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { - org.eclipse.emf.ecore.EObject selectedEObject = req.getElementToDestroy(); - org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(selectedEObject); - if(provider != null) { - // Retrieve delete command from the Element Edit service - org.eclipse.gmf.runtime.common.core.command.ICommand deleteCommand = provider.getEditCommand(req); - - if(deleteCommand != null) { - return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(deleteCommand); - } - } - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - } - ''' - - def getDestroyElementCommandByService(TypeLinkModelFacet it) ''' - protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) { - org.eclipse.emf.ecore.EObject selectedEObject = req.getElementToDestroy(); - org.eclipse.papyrus.infra.services.edit.service.IElementEditService provider =org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils.getCommandProvider(selectedEObject); - if(provider != null) { - // Retrieve delete command from the Element Edit service - org.eclipse.gmf.runtime.common.core.command.ICommand deleteCommand = provider.getEditCommand(req); - - if(deleteCommand != null) { - return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(deleteCommand); - } - } - return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE; - } - ''' -} |