diff options
author | Benoit Maggi | 2017-05-15 13:42:51 +0000 |
---|---|---|
committer | Benoit Maggi | 2017-06-01 05:11:06 +0000 |
commit | fdf5650b204a1e3a625a08735d91bf1d8df0e098 (patch) | |
tree | fbbca998ceafa9642d475aa14fb342fcad29cd28 /plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common | |
parent | 735a84b375cb02b7c58c9a6540d4d070d1728822 (diff) | |
download | org.eclipse.papyrus-fdf5650b204a1e3a625a08735d91bf1d8df0e098.tar.gz org.eclipse.papyrus-fdf5650b204a1e3a625a08735d91bf1d8df0e098.tar.xz org.eclipse.papyrus-fdf5650b204a1e3a625a08735d91bf1d8df0e098.zip |
Bug 516687 - [SysML 1.1] Move SysML 1.1 to an independent repository
- remove sysml 1.1 plugins and feature from master branch
- note: some weak reference are still in the code a simple sysml grep
will show all remaining typos
Change-Id: I00173658659cfb5f3cec47391c6a3b1216bafcff
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
Diffstat (limited to 'plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common')
269 files changed, 0 insertions, 25909 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath deleted file mode 100644 index beb405d35fd..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.classpath +++ /dev/null @@ -1,11 +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.6"/> - <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="src" path="src"/> - <classpathentry kind="src" path="src-gen"/> - <classpathentry kind="src" path="src-common-sysml"/> - <classpathentry kind="src" path="src-common-uml"/> - <classpathentry kind="src" path="src-common-gmf"/> - <classpathentry kind="output" path="bin"/> -</classpath> diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project deleted file mode 100644 index 9f75f3a94b6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.project +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>org.eclipse.papyrus.sysml.diagram.common</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.ManifestBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.SchemaBuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.oomph.version.VersionBuilder</name> - <arguments> - <dictionary> - <key>check.maven.pom</key> - <value>true</value> - </dictionary> - <dictionary> - <key>ignore.lower.bound.dependency.ranges</key> - <value>true</value> - </dictionary> - <dictionary> - <key>release.path</key> - <value>/org.eclipse.papyrus.releng.main.release/release.xml</value> - </dictionary> - </arguments> - </buildCommand> - <buildCommand> - <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.pde.PluginNature</nature> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>org.eclipse.oomph.version.VersionNature</nature> - <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature> - </natures> -</projectDescription> diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs deleted file mode 100644 index f03f98026a8..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/net.sf.jautodoc.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Fri Aug 19 13:56:17 CEST 2011 -add_header=true -eclipse.preferences.version=1 -header_text=/*****************************************************************************\r\n * Copyright (c) 2011 CEA LIST.\r\n *\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n *\t\t\r\n *\t\tCEA LIST - Initial API and implementation\r\n *\r\n *****************************************************************************/ -project_specific_settings=true -replace_header=true -replacements=<?xml version\="1.0" standalone\="yes"?>\n\n<replacements>\n<replacement key\="get" scope\="1" mode\="0">Gets the</replacement>\n<replacement key\="set" scope\="1" mode\="0">Sets the</replacement>\n<replacement key\="add" scope\="1" mode\="0">Adds the</replacement>\n<replacement key\="edit" scope\="1" mode\="0">Edits the</replacement>\n<replacement key\="remove" scope\="1" mode\="0">Removes the</replacement>\n<replacement key\="init" scope\="1" mode\="0">Inits the</replacement>\n<replacement key\="parse" scope\="1" mode\="0">Parses the</replacement>\n<replacement key\="create" scope\="1" mode\="0">Creates the</replacement>\n<replacement key\="build" scope\="1" mode\="0">Builds the</replacement>\n<replacement key\="is" scope\="1" mode\="0">Checks if is</replacement>\n<replacement key\="print" scope\="1" mode\="0">Prints the</replacement>\n<replacement key\="has" scope\="1" mode\="0">Checks for</replacement>\n</replacements>\n\n diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 6285ded23e0..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,295 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=260 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=false -org.eclipse.jdt.core.formatter.join_wrapped_lines=false -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=260 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=tab -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=false -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true -org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.ui.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 954281dbc31..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.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/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.pde.api.tools.prefs b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.settings/org.eclipse.pde.api.tools.prefs deleted file mode 100644 index 23fb95e120f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/.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/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF deleted file mode 100644 index 51849aa9227..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/META-INF/MANIFEST.MF +++ /dev/null @@ -1,47 +0,0 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.gmf.diagram.common.commands,
- org.eclipse.papyrus.gmf.diagram.common.compatibility,
- org.eclipse.papyrus.gmf.diagram.common.edit.part,
- org.eclipse.papyrus.gmf.diagram.common.edit.policy,
- org.eclipse.papyrus.gmf.diagram.common.factory,
- org.eclipse.papyrus.gmf.diagram.common.locator,
- org.eclipse.papyrus.gmf.diagram.common.parser,
- org.eclipse.papyrus.gmf.diagram.common.provider,
- org.eclipse.papyrus.sysml.diagram.common,
- org.eclipse.papyrus.sysml.diagram.common.commands,
- org.eclipse.papyrus.sysml.diagram.common.dialogs,
- org.eclipse.papyrus.sysml.diagram.common.edit.part,
- org.eclipse.papyrus.sysml.diagram.common.edit.policy,
- org.eclipse.papyrus.sysml.diagram.common.factory,
- org.eclipse.papyrus.sysml.diagram.common.figure,
- org.eclipse.papyrus.sysml.diagram.common.messages,
- org.eclipse.papyrus.sysml.diagram.common.parser,
- org.eclipse.papyrus.sysml.diagram.common.preferences,
- org.eclipse.papyrus.sysml.diagram.common.strategy.paste,
- org.eclipse.papyrus.sysml.diagram.common.utils,
- org.eclipse.papyrus.uml.diagram.common.dnd.helper,
- org.eclipse.papyrus.uml.diagram.common.edit.part,
- org.eclipse.papyrus.uml.diagram.common.edit.policy,
- org.eclipse.papyrus.uml.diagram.common.factory,
- org.eclipse.papyrus.uml.diagram.common.figure,
- org.eclipse.papyrus.uml.diagram.common.parser,
- org.eclipse.papyrus.uml.diagram.common.utils
-Require-Bundle: org.eclipse.emf;bundle-version="[2.6.0,3.0.0)",
- org.eclipse.papyrus.sysml;bundle-version="[1.2.0,2.0.0)";visibility:=reexport,
- org.eclipse.papyrus.editor;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.sysml.service.types;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
- org.eclipse.papyrus.uml.modelexplorer.widgets;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.uml.diagram.composite;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
- org.eclipse.papyrus.uml.diagram.clazz;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.uml.internationalization.edit;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.uml.internationalization.utils;bundle-version="[1.0.0,2.0.0)"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
-Bundle-Localization: plugin
-Bundle-Name: %pluginName
-Bundle-Activator: org.eclipse.papyrus.sysml.diagram.common.Activator
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.diagram.common;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html deleted file mode 100644 index d35d5aed64c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/about.html +++ /dev/null @@ -1,28 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> -<title>About</title> -</head> -<body lang="EN-US"> -<h2>About This Content</h2> - -<p>June 5, 2007</p> -<h3>License</h3> - -<p>The Eclipse Foundation makes available all content in this plug-in ("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> diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties deleted file mode 100644 index 58321663d25..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties +++ /dev/null @@ -1,11 +0,0 @@ -bin.includes = META-INF/,\ - .,\ - icons/,\ - about.html,\ - plugin.properties,\ - plugin.xml -output..=bin/ -src.includes = icons/,\ - about.html -source..=src/,src-gen/,src-common-uml/,src-common-sysml/,src-common-gmf/ -bin..=bin/ diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/category_sysml.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/category_sysml.gif Binary files differdeleted file mode 100644 index ecc0b715e2d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/category_sysml.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_EAST.gif Binary files differdeleted file mode 100644 index c33d1234b1c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH.gif Binary files differdeleted file mode 100644 index 52a2cb62512..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH_EAST.gif Binary files differdeleted file mode 100644 index 6c518958906..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH_WEST.gif Binary files differdeleted file mode 100644 index f798e3456ae..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_NORTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH.gif Binary files differdeleted file mode 100644 index 52a2cb62512..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH_EAST.gif Binary files differdeleted file mode 100644 index f798e3456ae..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH_WEST.gif Binary files differdeleted file mode 100644 index 6c518958906..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_SOUTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_WEST.gif Binary files differdeleted file mode 100644 index c33d1234b1c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_INOUT_A_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_EAST.gif Binary files differdeleted file mode 100644 index 273f7c629a5..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH.gif Binary files differdeleted file mode 100644 index 0947953d6af..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH_EAST.gif Binary files differdeleted file mode 100644 index dfb4021df08..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH_WEST.gif Binary files differdeleted file mode 100644 index 9ad7d3d046a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_NORTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH.gif Binary files differdeleted file mode 100644 index 80409678456..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH_EAST.gif Binary files differdeleted file mode 100644 index 3fe4ebf9053..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH_WEST.gif Binary files differdeleted file mode 100644 index f9beebd3126..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_SOUTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_WEST.gif Binary files differdeleted file mode 100644 index 259d142f074..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_IN_A_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_EAST.gif Binary files differdeleted file mode 100644 index d08bfd9d07b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH.gif Binary files differdeleted file mode 100644 index b888cee57ba..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH_EAST.gif Binary files differdeleted file mode 100644 index 48925afcf06..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH_WEST.gif Binary files differdeleted file mode 100644 index 21c7e975df9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_NORTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH.gif Binary files differdeleted file mode 100644 index b888cee57ba..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH_EAST.gif Binary files differdeleted file mode 100644 index 21c7e975df9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH_WEST.gif Binary files differdeleted file mode 100644 index 48925afcf06..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_SOUTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_WEST.gif Binary files differdeleted file mode 100644 index d08bfd9d07b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_NA_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_EAST.gif Binary files differdeleted file mode 100644 index 259d142f074..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH.gif Binary files differdeleted file mode 100644 index 80409678456..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH_EAST.gif Binary files differdeleted file mode 100644 index f9beebd3126..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH_WEST.gif Binary files differdeleted file mode 100644 index 3fe4ebf9053..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_NORTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH.gif Binary files differdeleted file mode 100644 index 0947953d6af..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH_EAST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH_EAST.gif Binary files differdeleted file mode 100644 index 9ad7d3d046a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH_EAST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH_WEST.gif Binary files differdeleted file mode 100644 index dfb4021df08..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_SOUTH_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_WEST.gif b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_WEST.gif Binary files differdeleted file mode 100644 index 273f7c629a5..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/icons/flowports/FlowPort_OUT_A_WEST.gif +++ /dev/null diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen deleted file mode 100644 index d47ed2793e7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/SysML.ReusableParts.idgen +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="SysML Reusable Parts" type="" icon="" label="" language="" javaPackagePrefix="org.eclipse.papyrus.sysml.diagram.common" javaClassPrefix="SysML" createCommandLabel="">
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_constraintproperty_as_label" label="ConstraintProperty" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintPropertyChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.ConstraintProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_flowport_as_label" label="FlowPort" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.FlowPort" labelMask="Direction, Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_flowproperty_as_label" label="FlowProperty" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPropertyChildLabelEditPart" semanticType="org.eclipse.papyrus.sysml.FlowProperty" labelMask="Direction, Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_part_as_label" label="Part" semanticType="org.eclipse.papyrus.sysml.PartProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
- <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_reference_as_label" label="Reference" semanticType="org.eclipse.papyrus.sysml.ReferenceProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
- <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomLabelNode" id="shape_sysml_value_as_label" label="Value" semanticType="org.eclipse.papyrus.sysml.ValueProperty" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers">
- <editPart href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_block_as_classifier" label="Block" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy" creationPolicy="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy" semanticType="org.eclipse.papyrus.sysml.Block" tag="block" labels="label_sysml_block_name">
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- <compartments href="#compartment_sysml_property_as_list"/>
- <compartments href="#compartment_sysml_part_as_list"/>
- <compartments href="#compartment_sysml_reference_as_list"/>
- <compartments href="UML.ReusableParts.idgen#compartment_uml_port_as_list"/>
- <compartments href="#compartment_sysml_flowport_as_list"/>
- <compartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- <compartments href="#compartment_sysml_constraint_as_list"/>
- <compartments href="#compartment_sysml_value_as_list"/>
- <visibleCompartments href="#compartment_sysml_property_as_list"/>
- <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- <visibleCompartments href="#compartment_sysml_constraint_as_list"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_block_as_composite" label="BlockComposite" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy" creationPolicy="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy" semanticType="org.eclipse.papyrus.sysml.Block" tag="block" labels="label_sysml_block_name" compartments="compartment_sysml_structure" visibleCompartments="compartment_sysml_structure">
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_blockproperty_as_composite" label="BlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]" compartments="compartment_sysml_blockproperty_structure" visibleCompartments="compartment_sysml_blockproperty_structure">
- <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_constraintblockproperty_as_composite" label="ConstraintBlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]" compartments="compartment_sysml_blockproperty_structure" visibleCompartments="compartment_sysml_blockproperty_structure">
- <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_property_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_dimension_as_classifier" label="Dimension" semanticType="org.eclipse.papyrus.sysml.Dimension" tag="dimension" labels="label_sysml_dimension_name"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_constraintblock_as_classifier" label="ConstraintBlock" semanticType="org.eclipse.papyrus.sysml.ConstraintBlock" tag="constraint" labels="label_sysml_constraintblock_name" compartments="compartment_sysml_parameter_as_list compartment_sysml_constraint_as_list" visibleCompartments="compartment_sysml_parameter_as_list compartment_sysml_constraint_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_flowspecification_as_classifier" label="FlowSpecification" semanticType="org.eclipse.papyrus.sysml.FlowSpecification" tag="flowSpecification" labels="label_sysml_flowspecification_name" compartments="compartment_sysml_flowproperty_as_list" visibleCompartments="compartment_sysml_flowproperty_as_list"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_unit_as_classifier" label="Unit" semanticType="org.eclipse.papyrus.sysml.Unit" labelMask="Name, Dimension" tag="unit" labels="label_sysml_unit_name"/>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_valuetype_as_classifier" label="ValueType" semanticType="org.eclipse.papyrus.sysml.ValueType" tag="valuetype" labels="label_sysml_valuetype_name">
- <compartments href="UML.ReusableParts.idgen#compartment_uml_property_as_list"/>
- <compartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_property_as_list"/>
- <visibleCompartments href="UML.ReusableParts.idgen#compartment_uml_operation_as_list"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomAffixedNode" id="shape_sysml_flowport_as_affixed" label="FlowPort" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart" semanticType="org.eclipse.papyrus.sysml.FlowPort" altSemanticTypes="org.eclipse.papyrus.sysml.FlowPort_In org.eclipse.papyrus.sysml.FlowPort_Out org.eclipse.papyrus.sysml.FlowPort_InOut">
- <affixedLabels href="#affixedlabel_sysml_flowport_label"/>
- <affixedLabels href="UML.ReusableParts.idgen#affixedlabel_uml_appliedstereotype"/>
- <locator href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/>
- </customNodes>
- <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_sysml_nestedblockproperty_as_composite" label="NestedBlockPropertyComposite" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart" semanticType="org.eclipse.papyrus.sysml.PartProperty" altSemanticTypes="org.eclipse.papyrus.sysml.ReferenceProperty" tag="[#runtime-defined]">
- <labels href="UML.ReusableParts.idgen#label_uml_property_label"/>
- <affixedNodes href="#shape_sysml_flowport_as_affixed"/>
- <affixedNodes href="UML.ReusableParts.idgen#shape_uml_port_as_affixed"/>
- <borderedNodeFigure href="UML.ReusableParts.idgen#org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/>
- </customNodes>
- <customEdges xsi:type="idgen:CustomLink" id="link_sysml_association" label="Association" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.AssociationEditPart" semanticType="org.eclipse.papyrus.sysml.Association" altSemanticTypes="org.eclipse.papyrus.sysml.AssociationComposite org.eclipse.papyrus.sysml.AssociationCompositeDirected org.eclipse.papyrus.sysml.AssociationNone org.eclipse.papyrus.sysml.AssociationNoneDirected org.eclipse.papyrus.sysml.AssociationShared org.eclipse.papyrus.sysml.AssociationSharedDirected" figure="org.eclipse.papyrus.sysml.diagram.common.figure.AssociationFigure">
- <viewFactory href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.factory.AssociationLinkViewFactory"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_namedelement_name"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_source_role"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_source_multiplicity"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_target_role"/>
- <labels href="UML.ReusableParts.idgen#linklabel_uml_association_target_multiplicity"/>
- </customEdges>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_constraint_as_list" label="BlockConstraint" title="constraints"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_flowport_as_list" label="FlowPort" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.FlowPortDefaultCompartmentSemanticEditPolicy" title="flow ports"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_flowproperty_as_list" label="FlowProperty" title="flow properties"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_parameter_as_list" label="Parameter" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ConstraintParameterDefaultCompartmentSemanticEditPolicy" title="parameters"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_part_as_list" label="PartProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PartDefaultCompartmentSemanticEditPolicy" title="parts"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_property_as_list" label="BlockProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PropertyDefaultCompartmentSemanticEditPolicy" title="properties"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_reference_as_list" label="ReferenceProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ReferenceDefaultCompartmentSemanticEditPolicy" title="references"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_structure" label="Structure" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureDefaultCompartmentSemanticEditPolicy" title="structure" list="false"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_blockproperty_structure" label="BlockPropertyStructure" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureDefaultCompartmentSemanticEditPolicy" title="structure" list="false"/>
- <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_sysml_value_as_list" label="ValueProperty" semanticPolicy="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ValueDefaultCompartmentSemanticEditPolicy" title="values"/>
- <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_sysml_flowport_label" label="FlowPortAffixedLabel" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart" role="Label">
- <locator href="UML.ReusableParts.idgen#org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator"/>
- </customDecorations>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_block_name" label="BlockLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_constraintblock_name" label="ConstraintBlockLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_dimension_name" label="DimensionLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_flowspecification_name" label="FlowSpecificationLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_unit_name" label="UnitLabelName" specificIconKey=""/>
- <customDecorations xsi:type="idgen:CustomClassifierInnerLabel" id="label_sysml_valuetype_name" label="ValueTypeLabelName" specificIconKey=""/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Block" name="Block" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Block.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ConstraintBlock" name="ConstraintBlock" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/constraints/ConstraintBlock.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ConstraintProperty" name="ConstraintProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/constraints/ConstraintProperty.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Dimension" name="Dimension" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Dimension.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort" name="FlowPort" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_In" name="FlowPort_In" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_Out" name="FlowPort_Out" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowPort_InOut" name="FlowPort_InOut" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowPort.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowProperty" name="FlowProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowProperty.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.FlowSpecification" name="FlowSpecification" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/portandflows/FlowSpecification.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.PartProperty" name="PartProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ReferenceProperty" name="ReferenceProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Unit" name="Unit" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/Unit.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ValueProperty" name="ValueProperty" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.ValueType" name="ValueType" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.sysml/icons/blocks/ValueType.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.Association" name="Association" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationNone" name="AssociationNone" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationNoneDirected" name="AssociationNoneDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_none_directed.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationComposite" name="AssociationComposite" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_composite.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationCompositeDirected" name="AssociationCompositeDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_composite_directed.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationShared" name="AssociationShared" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_shared.gif"/>
- <semanticTypes id="org.eclipse.papyrus.sysml.AssociationSharedDirected" name="AssociationSharedDirected" constantTypePackage="org.eclipse.papyrus.sysml.service.types.element" constantTypeClass="SysMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_shared_directed.gif"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintPropertyChildLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPropertyChildLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortChildLabelEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.part.AssociationEditPart"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.figure.AssociationFigure"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ConstraintParameterDefaultCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PartDefaultCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.PropertyDefaultCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ReferenceDefaultCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureDefaultCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.ValueDefaultCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureDefaultCompartmentSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy"/>
- <javaClasses qualifiedName="org.eclipse.papyrus.sysml.diagram.common.edit.policy.FlowPortDefaultCompartmentSemanticEditPolicy"/>
-</idgen:Diagram>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen deleted file mode 100644 index 5047ade7a02..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/model/UML.ReusableParts.idgen +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<idgen:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:idgen="http://www.eclipse.org/papyrus/0.7.0/idgen" name="UML Reusable Parts" type="" icon="" label="" language="" javaPackagePrefix="org.eclipse.papyrus.uml.diagram.common" javaClassPrefix="UML" createCommandLabel=""> - <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_constraint_as_label" label="Constraint" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Constraint" labelMask="Name, Specification"/> - <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_enumerationliteral_as_label" label="EnumerationLiteral" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.EnumerationLiteral" labelMask=""/> - <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_operation_as_label" label="Operation" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Operation" labelMask="Visibility, Name, Type, Modifiers, Param_Direction, Param_Name, Param_Type, Param_Multiplicity, Param_DefaultValue, Param_Modifiers"/> - <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_port_as_label" label="Port" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Port" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/> - <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_property_as_label" label="Property" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Property" labelMask="Visibility, Derive, Name, Type, Undefined_Type, Multiplicity, Default_Multiplicity, DefaultValue, Modifiers"/> - <customNodes xsi:type="idgen:CustomLabelNode" id="shape_uml_reception_as_label" label="Reception" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart" semanticType="org.eclipse.papyrus.uml.Reception" labelMask="Name, Signal"/> - <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_actor_as_classifier" label="Actor" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Actor" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/> - <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_datatype_as_classifier" label="DataType" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.DataType" tag="datatype" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list" visibleCompartments="compartment_uml_property_as_list"/> - <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_enumeration_as_classifier" label="Enumeration" semanticType="org.eclipse.papyrus.uml.Enumeration" labels="label_uml_namedelement_name" compartments="compartment_uml_enumerationliteral_as_list" visibleCompartments="compartment_uml_enumerationliteral_as_list"/> - <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_interface_as_classifier" label="Interface" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Interface" tag="" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list" visibleCompartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/> - <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_primitivetype_as_classifier" label="PrimitiveType" semanticType="org.eclipse.papyrus.uml.PrimitiveType" tag="primitive" labels="label_uml_namedelement_name"/> - <customNodes xsi:type="idgen:CustomClassifierNode" id="shape_uml_signal_as_classifier" label="Signal" viewFactory="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory" semanticType="org.eclipse.papyrus.uml.Signal" tag="" labels="label_uml_namedelement_name" compartments="compartment_uml_property_as_list compartment_uml_operation_as_list"/> - <customNodes xsi:type="idgen:CustomAffixedNode" id="shape_uml_port_as_affixed" label="Port" semanticType="org.eclipse.papyrus.uml.Port" affixedLabels="affixedlabel_uml_port_label affixedlabel_uml_appliedstereotype" locator="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/> - <customNodes xsi:type="idgen:CustomAffixedNode" id="shape_uml_property_as_affixed" label="Property" semanticType="org.eclipse.papyrus.uml.Property" affixedLabels="affixedlabel_uml_port_label affixedlabel_uml_appliedstereotype"/> - <customEdges xsi:type="idgen:CustomLink" id="link_uml_dependency" label="Dependency" semanticType="org.eclipse.papyrus.uml.Dependency" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/> - <customEdges xsi:type="idgen:CustomLink" id="link_uml_connector" label="Connector" semanticType="org.eclipse.papyrus.uml.Connector" labels="linklabel_uml_connector_label linklabel_uml_connector_source_multiplicity linklabel_uml_connector_target_multiplicity" figure="org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure"/> - <customEdges xsi:type="idgen:CustomLink" id="link_uml_generalization" label="Generalization" semanticType="org.eclipse.papyrus.uml.Generalization" figure="org.eclipse.papyrus.uml.diagram.common.figure.GeneralizationFigure"/> - <customEdges xsi:type="idgen:CustomLink" id="link_uml_interfacerealization" label="InterfaceRealization" semanticType="org.eclipse.papyrus.uml.InterfaceRealization" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.InterfaceRealizationFigure"/> - <customEdges xsi:type="idgen:CustomLink" id="link_uml_usage" label="Usage" semanticType="org.eclipse.papyrus.uml.Usage" tag="use" labels="linklabel_uml_namedelement_name" figure="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/> - <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_constraint_as_list" label="Constraint" title="constraints" children="shape_uml_constraint_as_label"/> - <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_enumerationliteral_as_list" label="EnumerationLiteral" title="literals" children="shape_uml_enumerationliteral_as_label"/> - <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_operation_as_list" label="Operation" title="operations" children="shape_uml_operation_as_label shape_uml_reception_as_label"/> - <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_port_as_list" label="Port" title="standard ports" children="shape_uml_port_as_label"/> - <customDecorations xsi:type="idgen:CustomCompartment" id="compartment_uml_property_as_list" label="Property" title="properties" children="shape_uml_property_as_label shape_uml_port_as_label"/> - <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_appliedstereotype" label="CustomFlowPortAppliedStereotypeEditPart" editPart="org.eclipse.papyrus.sysml.diagram.common.edit.part.CustomFlowPortAppliedStereotypeEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Stereotype"/> - <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_namedelement_name" label="NamedElementAffixedLabelName" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementAffixedLabelNameEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Name"/> - <customDecorations xsi:type="idgen:CustomAffixedLabel" id="affixedlabel_uml_port_label" label="PortAffixedLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedLabelNameEditPart" locator="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" role="Label"/> - <customDecorations xsi:type="idgen:CustomInnerLabel" id="label_uml_namedelement_name" label="NamedElementNodeLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart"/> - <customDecorations xsi:type="idgen:CustomInnerLabel" id="label_uml_property_label" label="PropertyNodeLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_label" label="ConnectorLinkLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelEditPart" role="Name"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_namedelement_name" label="NamedElementLinkLabelName" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart" role="Name"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_appliedstereotype" label="AppliedStereotypeLinkLabel" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeLinkLabelEditPart" role="Stereotype"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_source_role" label="AssociationLinkLabelSourceRole" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceRoleEditPart" role="SourceRole"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_source_multiplicity" label="AssociationLinkLabelSourceMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceMultiplicityEditPart" role="SourceMultiplicity"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_target_role" label="AssociationLinkLabelTargetRole" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetRoleEditPart" role="TargetRole"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_association_target_multiplicity" label="AssociationLinkLabelTargetMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetMultiplicityEditPart" role="TargetMultiplicity"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_source_multiplicity" label="ConnectorLinkLabelSourceMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelSourceMultiplicityEditPart" role="SourceMultiplicity"/> - <customDecorations xsi:type="idgen:CustomLinkLabel" id="linklabel_uml_connector_target_multiplicity" label="ConnectorLinkLabelTargetMultiplicity" editPart="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelTargetMultiplicityEditPart" role="TargetMultiplicity"/> - <semanticTypes id="org.eclipse.papyrus.uml.Actor" name="Actor" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Actor.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Comment" name="Comment" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Connector" name="Connector" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Connector.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Constraint" name="Constraint" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Constraint.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.DataType" name="DataType" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DataType.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Dependency" name="Dependency" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Dependency.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Enumeration" name="Enumeration" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Enumeration.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.EnumerationLiteral" name="EnumerationLiteral" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/EnumerationLiteral.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Generalization" name="Generalization" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Generalization.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.InstanceSpecification" name="InstanceSpecification" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InstanceSpecification.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Interface" name="Interface" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interface.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.InterfaceRealization" name="InterfaceRealization" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InterfaceRealization.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Model" name="Model" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Model.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Operation" name="Operation" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Operation.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Package" name="Package" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Package.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Port" name="Port" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.PrimitiveType" name="PrimitiveType" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/PrimitiveType.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Property" name="Property" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Reception" name="Reception" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Reception.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Signal" name="Signal" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Signal.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Slot" name="Slot" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Slot.gif"/> - <semanticTypes id="org.eclipse.papyrus.uml.Usage" name="Usage" constantTypePackage="org.eclipse.papyrus.uml.service.types.element" constantTypeClass="UMLElementTypes" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Usage.gif"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeAffixedLabelEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeLinkLabelEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.DefaultChildLabelEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementAffixedLabelNameEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedLabelNameEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceRoleEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceMultiplicityEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetRoleEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetMultiplicityEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelSourceMultiplicityEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.edit.part.ConnectorLinkLabelTargetMultiplicityEditPart"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.factory.ClassifierViewFactory"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.factory.AssociationLinkViewFactory"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.GeneralizationFigure"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.InterfaceRealizationFigure"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure"/> - <javaClasses qualifiedName="org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure"/> - <javaClasses qualifiedName="org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure"/> -</idgen:Diagram> diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties deleted file mode 100644 index c67df5eac36..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.properties +++ /dev/null @@ -1,12 +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) yann.tanguy@cea.fr - initial API and implementation -################################################################################## -pluginName=UML Common diagram for SysML -providerName=Eclipse Modeling Project diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml deleted file mode 100644 index af2a3173ee9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/plugin.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - -<extension point="org.eclipse.core.expressions.propertyTesters"> - <propertyTester class="org.eclipse.papyrus.sysml.diagram.common.utils.SysMLSelectionTester" id="org.eclipse.papyrus.SysMLSelectionTester" namespace="org.eclipse.papyrus.SysMLSelectionTester" properties="isSysMLModel, isSysMLRequirementsModel, isSysMLBlocksModel" type="org.eclipse.jface.viewers.ISelection"> - </propertyTester> -</extension> - -<extension point="org.eclipse.core.expressions.definitions"> - <definition id="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysML"> - <and> - <with variable="activeEditorId"> - <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals> - </with> - <with variable="selection"> - <test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLModel" value="true"></test> - </with> - </and> - </definition> - <definition id="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysMLBlocks"> - <and> - <with variable="activeEditorId"> - <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals> - </with> - <with variable="selection"> - <test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLBlocksModel" value="true"></test> - </with> - </and> - </definition> - <definition id="org.eclipse.papyrus.sysml.diagram.common.IsPapyrusActiveWithSysMLRequirements"> - <and> - <with variable="activeEditorId"> - <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"></equals> - </with> - <with variable="selection"> - <test forcePluginActivation="true" property="org.eclipse.papyrus.SysMLSelectionTester.isSysMLRequirementsModel" value="true"></test> - </with> - </and> - </definition> -</extension> -<extension - point="org.eclipse.papyrus.infra.gmfdiag.common.pasteStrategy"> - <strategy - strategy="org.eclipse.papyrus.sysml.diagram.common.strategy.paste.PartPasteStrategy"> - </strategy> -</extension> - -</plugin> diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/pom.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/pom.xml deleted file mode 100644 index 1808d432e5f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/pom.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.eclipse.papyrus</groupId>
- <artifactId>org.eclipse.papyrus.sysml-diagram</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.papyrus.sysml.diagram.common</artifactId>
- <version>2.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
\ No newline at end of file diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java deleted file mode 100644 index 612d3c0d170..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/CreateViewCommand.java +++ /dev/null @@ -1,60 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.commands; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.notation.View; - -/** - * A replacement for CreateCommand that avoids that takes into account the incorrect - * generation of ViewProvider by GMFTooling and modifies SemanticAdapter in call to {@link ViewService#provides(Class, org.eclipse.core.runtime.IAdaptable, View, String, int, boolean, org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint)} . - */ -public class CreateViewCommand extends CreateCommand { - - /** Constructor */ - public CreateViewCommand(TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor, View containerView) { - super(editingDomain, viewDescriptor, containerView); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean canExecute() { - - // Warning the element adapter can possibly be null (see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=353129) - if (viewDescriptor.getElementAdapter() == null) { - return false; - } - - // Try to adapt the descriptor ElementAdapter in EObject - EObject element = (EObject) viewDescriptor.getElementAdapter().getAdapter(EObject.class); - IElementType elementType = (IElementType) viewDescriptor.getElementAdapter().getAdapter(IElementType.class); - - SemanticElementAdapter semanticAdapter = new SemanticElementAdapter(element, elementType); - - // Use the semanticAdapter instead of view descriptor element adapter to avoid the use of provides(ViewForKind) method - // from ViewProvider which is incorrectly implemented in GMF Tooling generated editors (other editors may have undesired side-effect on each-other). - - return ViewService.getInstance().provides(viewDescriptor.getViewKind(), semanticAdapter, containerView, viewDescriptor.getSemanticHint(), viewDescriptor.getIndex(), viewDescriptor.isPersisted(), viewDescriptor.getPreferencesHint()); - } - - - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java deleted file mode 100644 index fba3a47663c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/ISemanticHintAdapter.java +++ /dev/null @@ -1,28 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.commands; - - -/** - * Interface for an adapter that can give a semantic hint - */ -public interface ISemanticHintAdapter { - - /** - * Returns the semantic hint for this adapter - * - * @return the semantic hint for this adapter - */ - public String getSemanticHint(); -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java deleted file mode 100644 index 5410455d754..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/IdentityCommandWithNotification.java +++ /dev/null @@ -1,94 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.AbstractCommand; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.util.StringStatics; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.Type; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.CombinedPopupAndViewBuilder; -import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder; - -/** - * A command that is always executable, undoable and redoable, but does nothing. - * It always returns the same OK command result. - * - * @author ldamus - */ -public class IdentityCommandWithNotification extends AbstractCommand { - - protected String title = "Papyrus notification"; - - protected String message = "No message."; - - protected Type type = Type.INFO; - - /** - * Public constructor. - */ - public IdentityCommandWithNotification(String message) { - this(); - this.message = message; - } - - /** - * Public constructor. - */ - public IdentityCommandWithNotification(String title, String message, Type type) { - this(message); - this.title = title; - this.type = type; - } - - /** - * Private constructor. - */ - private IdentityCommandWithNotification() { - super(StringStatics.BLANK, null); - setResult(CommandResult.newOKCommandResult()); - } - - /** - * Does nothing and returns an OK command result. - */ - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - - new NotificationBuilder().setBuilderClass(CombinedPopupAndViewBuilder.class).setType(type).setTitle(title).setMessage(message).run(); - - return getCommandResult(); - } - - /** - * Does nothing and returns an OK command result. - */ - @Override - protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - - return getCommandResult(); - } - - /** - * Does nothing and returns an OK command result. - */ - @Override - protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { - - return getCommandResult(); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java deleted file mode 100644 index c7787e7c51e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/commands/SemanticElementAdapter.java +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.commands; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.core.util.PackageUtil; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter; - -/** - * An adapter for {@link IElementType}, {@link EObject} or {@link View}. - */ -public class SemanticElementAdapter extends SemanticAdapter implements ISemanticHintAdapter { - - /** The elementType. */ - private Object elementType; - - /** Constructor from EObject */ - public SemanticElementAdapter(EObject element) { - super(element, null); - this.elementType = null; - } - - /** Constructor from IElementType */ - public SemanticElementAdapter(IElementType elementType) { - super(null, null); - this.elementType = elementType; - } - - /** Constructor from EObject and IElementType */ - public SemanticElementAdapter(EObject element, IElementType elementType) { - super(element, null); - this.elementType = elementType; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class adapter) { - if (adapter.equals(IHintedType.class)) { - if (elementType instanceof IHintedType) { - return elementType; - } - } - - if (adapter.equals(IElementType.class)) { - return elementType; - } - return super.getAdapter(adapter); - } - - /** - * {@inheritDoc} - */ - @Override - public Object getProxyClassID() { - if (elementType != null) { - return PackageUtil.getID(((IElementType) elementType).getEClass()); - } - return super.getProxyClassID(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getSemanticHint() { - if (elementType instanceof IHintedType) { - return ((IHintedType) elementType).getSemanticHint(); - } - return null; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java deleted file mode 100644 index cd8cc7b790a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/DiagramVersioningUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.compatibility; - - -/** - * @deprecated This class is repackaged as {@link org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils}, this old version is - * deprecated and left for binary compatibility only - */ -@Deprecated -public class DiagramVersioningUtils extends org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils { - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java deleted file mode 100644 index 35bc65af45d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/compatibility/IDiagramVersionUpdater.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.compatibility; - -import org.eclipse.gmf.runtime.notation.Diagram; - -/** - * This interface provides an API for migration of diagram from a version to another. - */ -public interface IDiagramVersionUpdater { - - /** - * Update a diagram to a new version. - * - * @param diagram - * the diagram to update - * @param oldVersion - * the old version of the diagram - * @param newVersion - * the new version of the diagram - * @return TODO : should return a status, not int. - */ - public int update(Diagram diagram, String oldVersion, String newVersion); -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java deleted file mode 100644 index b532c971a63..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/part/ITextAwareEditPart.java +++ /dev/null @@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.part; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; - -/** - * Edit Part that contains editable text. - */ -public interface ITextAwareEditPart extends org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart { - - /** - * Get the parser elements. - * - * @return the element being parsed. - */ - public EObject getParserElement(); - - /** - * Gets the default parser options (meaning parser options stored in preferences). - * - * @return ParserOptions the parser options - */ - public ParserOptions getDefaultParserOptions(); -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java deleted file mode 100644 index 16c87238cdf..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java +++ /dev/null @@ -1,414 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import static org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry.UNDEFINED_TYPE; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPartViewer; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.CompoundCommand; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.requests.ArrangeRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.RefreshConnectionsRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.commands.wrappers.CommandProxyWithResult; -import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.DeferredSnapToGridCommand; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.utils.ViewDescriptorUtil; -import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand; -import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementBorderEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart; -import org.eclipse.papyrus.uml.diagram.common.helper.Element2IAdaptableRegistryHelper; -import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; - -/** - * Abstract DND edit policy delegating the choice of the view to create for an EObject to a local - * graphical type registry. - */ -public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEditPolicy { - - private Element2IAdaptableRegistryHelper myElement2IAdaptableRegistryHelper; - - /** The graphical type registry. */ - protected IGraphicalTypeRegistry registry; - - /** The list of element types that require a specific drop command. */ - private Set<String> specificDropList = null; - - /** The specified link mapping helper depending on the diagram */ - protected ILinkMappingHelper linkMappingHelper; - - /** Constructor */ - public CommonDiagramDragDropEditPolicy(ILinkMappingHelper linkMappingHelper) { - this.linkMappingHelper = linkMappingHelper; - } - - private Set<String> getSpecificDropList() { - if (specificDropList == null) { - specificDropList = getSpecificDropBehaviorTypes(); - } - return specificDropList; - } - - /** - * Gets composite command adapters - */ - protected Element2IAdaptableRegistryHelper getElement2IAdaptableRegistryHelper() { - if (myElement2IAdaptableRegistryHelper == null) { - myElement2IAdaptableRegistryHelper = new Element2IAdaptableRegistryHelper(); - } - return myElement2IAdaptableRegistryHelper; - } - - protected abstract Set<String> getSpecificDropBehaviorTypes(); - - /** - * <pre> - * {@inheritedDoc}. - * - * Overridden method to fix some exception occurring while moving affixed element (nodes or labels) - * (https://bugs.eclipse.org/bugs/show_bug.cgi?id=350680). - * </pre> - */ - @Override - protected Command getDropCommand(ChangeBoundsRequest request) { - - Iterator<?> iter = request.getEditParts().iterator(); - EObject graphicalParentObject = ((GraphicalEditPart) getHost()).resolveSemanticElement(); - while ((graphicalParentObject != null) && (iter.hasNext())) { - EditPart droppedEditPart = (EditPart) iter.next(); - if (droppedEditPart instanceof AbstractElementBorderEditPart) { - return UnexecutableCommand.INSTANCE; - } - if (droppedEditPart instanceof AbstractElementLabelEditPart) { - return UnexecutableCommand.INSTANCE; - } - } - return super.getDropCommand(request); - } - - /** - * {@inheritedDoc}. - */ - @Override - public Command getDropObjectsCommand(DropObjectsRequest dropRequest) { - - CompoundCommand completeDropCommand = new CompoundCommand("DropObjectsAndArrange"); //$NON-NLS-1$ - - // Detect file drop - if ((dropRequest.getObjects().size() > 0) && (dropRequest.getObjects().get(0) instanceof String)) { - return getDropFileCommand(dropRequest); - } - - // Create the drop command by composite drop command for each dropped elements - CompositeCommand gmfDropCommand = new CompositeCommand("DropObjects"); //$NON-NLS-1$ - Iterator<?> iter = dropRequest.getObjects().iterator(); - while (iter.hasNext()) { - EObject droppedObject = (EObject) iter.next(); - gmfDropCommand.add(getDropObjectCommand(dropRequest, droppedObject)); - } - - // Create the complete drop command by adding an arrange command after drop - if (!gmfDropCommand.isEmpty()) { - - // Retrieve drop result (most probably created view but not necessarily) and update the request - CommandResult result = gmfDropCommand.getCommandResult(); - List<?> newValues = (List<?>) result.getReturnValue(); - dropRequest.setResult(newValues); - - // Prepare refresh command - RefreshConnectionsRequest refreshRequest = new RefreshConnectionsRequest(newValues); - Command refreshCommand = getHost().getCommand(refreshRequest); - - // Prepare an arrange command to avoid every dropped view to appear at the same location only if newValues contains at least one node, not when you just drag a link - boolean isOneNode = false; - for(Object o : newValues){ - if(o instanceof Node){ - isOneNode=true; - break; - } - } - - ArrangeRequest arrangeRequest = new ArrangeRequest(RequestConstants.REQ_ARRANGE_DEFERRED); - arrangeRequest.setViewAdaptersToArrange(newValues); - Command arrangeCommand = getHost().getCommand(arrangeRequest); - - // Update the complete drop command (drop - refresh - arrange) - Command dropCommand = new ICommandProxy(gmfDropCommand); - completeDropCommand.add(dropCommand.chain(refreshCommand)); - if(isOneNode){ - completeDropCommand.add(arrangeCommand); - } - - // add snap command if required - // 430099: [Diagram] Snap to Grid for elements dropped from the ModelExplorer is ignored - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=430099 - final Object value = dropRequest.getExtendedData().get(PreferencesConstantsHelper.SNAP_TO_GRID_CONSTANT); - if (value instanceof Boolean && Boolean.TRUE.equals(value)) { - DeferredSnapToGridCommand snapCommand = new DeferredSnapToGridCommand(getEditingDomain(), newValues, (IGraphicalEditPart) getHost()); - completeDropCommand.add(new ICommandProxy(snapCommand)); - } - - } - - return completeDropCommand; - } - - protected ICommand getDropObjectCommand(DropObjectsRequest dropRequest, EObject droppedObject) { - - Point location = dropRequest.getLocation().getCopy(); - - View dropTargetView = ((IGraphicalEditPart) getHost()).getNotationView(); - - String droppedNodeType = registry.getNodeGraphicalType(droppedObject, dropTargetView.getType()); - String droppedEdgeType = registry.getEdgeGraphicalType(droppedObject); - - // Test if a specific drop command should be used - if (getSpecificDropList().contains(droppedNodeType) || getSpecificDropList().contains(droppedEdgeType)) { - return getSpecificDropCommand(dropRequest, droppedObject, droppedNodeType, droppedEdgeType); - } - - // Decide unknown type handling - if (UNDEFINED_TYPE.equals(droppedNodeType) && UNDEFINED_TYPE.equals(droppedEdgeType)) { - return getUnknownDropCommand(dropRequest, droppedObject); - } - - // The dropped element is a node - if (!UNDEFINED_TYPE.equals(droppedNodeType)) { - return getDefaultDropNodeCommand(droppedNodeType, droppedObject, location); - } - - // The dropped element is a edge - if (!UNDEFINED_TYPE.equals(droppedEdgeType)) { - - Collection<?> sources = linkMappingHelper.getSource((Element) droppedObject); - Collection<?> targets = linkMappingHelper.getTarget((Element) droppedObject); - - // Only manage binary link during drop - if ((sources.size() > 0) && (targets.size() > 0)) { - EObject source = (EObject) sources.toArray()[0]; - EObject target = (EObject) targets.toArray()[0]; - return getDefaultDropEdgeCommand(droppedObject, source, target, droppedEdgeType, location); - } - - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - protected ICommand getDefaultDropNodeCommand(String droppedNodeType, EObject droppedObject, Point location) { - View dropTargetView = ((IGraphicalEditPart) getHost()).getNotationView(); - EObject dropTargetElement = dropTargetView.getElement(); - // Drop restriction: - // - no restriction when dropped on diagram - // - require containment when dropped on any other EObject - if ((dropTargetView instanceof Diagram) || dropTargetElement.eContents().contains(droppedObject)) { - return getDefaultDropNodeCommand(droppedNodeType, location, droppedObject); - } - - // Allow drop for inherited elements - if (dropTargetElement instanceof Classifier && ((Classifier) dropTargetElement).getAllAttributes().contains(droppedObject)) { - return getDefaultDropNodeCommand(droppedNodeType, location, droppedObject); - } - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - protected ICommand getDefaultDropNodeCommand(String droppedObjectGraphicalType, Point absoluteLocation, EObject droppedObject) { - - IAdaptable elementAdapter = new EObjectAdapter(droppedObject); - - ViewDescriptor descriptor = new ViewDescriptor(elementAdapter, Node.class, droppedObjectGraphicalType, ViewUtil.APPEND, ViewDescriptorUtil.PERSISTED, getDiagramPreferencesHint()); - CreateViewRequest createViewRequest = new CreateViewRequest(descriptor); - createViewRequest.setLocation(absoluteLocation); - - // Get view creation command for the dropped object - Command command = getHost().getCommand(createViewRequest); - - // Use the ViewDescriptor as command result, it then can be used as an adaptable to retrieve the View - return new CommandProxyWithResult(command, descriptor); - } - - protected ICommand getDefaultDropEdgeCommand(EObject droppedObject, EObject source, EObject target, String droppedEdgeType, Point absoluteLocation) { - - CompositeCommand completeDropCommand = new CompositeCommand("CompleteDropEdge"); //$NON-NLS-1$ - - // Find views in current diagram representing source and target - Collection<View> sourceViews = getViews(source); - Collection<View> targetViews = getViews(target); - - IAdaptable sourceViewAdapter = null; - IAdaptable targetViewAdapter = null; - - // If either a source or target lacks create view for these elements - // - using defaultDrop command (assumed to be a view creation) - // - try to create view on host - if (sourceViews.isEmpty() || targetViews.isEmpty()) { - - CompositeCommand createEndViewsCommand = new CompositeCommand("CreateSourceTargetViews"); //$NON-NLS-1$ - - View dropContainerView = ((IGraphicalEditPart) getHost()).getNotationView(); - EObject dropContainerElement = dropContainerView.getElement(); - - if (sourceViews.isEmpty()) { - if (dropContainerElement.eContents().contains(source)) { - ICommand dropSourceCommand = getDefaultDropNodeCommand(registry.getNodeGraphicalType(source, dropContainerView.getType()), absoluteLocation.getCopy(), source); - CompositeCommand.compose(createEndViewsCommand, dropSourceCommand); - sourceViewAdapter = (IAdaptable) dropSourceCommand.getCommandResult().getReturnValue(); - } else { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - } - - if (targetViews.isEmpty()) { - if (dropContainerElement.eContents().contains(target)) { - ICommand dropTargetCommand = getDefaultDropNodeCommand(registry.getNodeGraphicalType(target, dropContainerView.getType()), absoluteLocation.getCopy(), target); - CompositeCommand.compose(createEndViewsCommand, dropTargetCommand); - targetViewAdapter = (IAdaptable) dropTargetCommand.getCommandResult().getReturnValue(); - } else { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - } - - CompositeCommand.compose(completeDropCommand, createEndViewsCommand); - } - - // Create source adapter - if (!sourceViews.isEmpty()) { // sourceViewAdapter should still be null in this case - sourceViewAdapter = new SemanticAdapter(null, sourceViews.toArray()[0]); - } - - // Create target adapter - if (!targetViews.isEmpty()) { // targetViewAdapter should still be null in this case - targetViewAdapter = new SemanticAdapter(null, targetViews.toArray()[0]); - } - - // Create a view for the dropped link between the source and target view adapters - IAdaptable droppedObjectAdapter = new SemanticAdapter(droppedObject, null); - - CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(droppedObjectAdapter, droppedEdgeType, getDiagramPreferencesHint()); - - CommonDeferredCreateConnectionViewCommand createConnectionViewCommand = new CommonDeferredCreateConnectionViewCommand(getEditingDomain(), droppedEdgeType, sourceViewAdapter, targetViewAdapter, getViewer(), getDiagramPreferencesHint(), linkdescriptor, - null); - createConnectionViewCommand.setElement(droppedObject); - - CompositeCommand.compose(completeDropCommand, createConnectionViewCommand); - - return completeDropCommand.reduce(); - } - - /** - * <pre> - * Sub-classes have to implement this method in order to provides specific drop command for - * element which require a specific treatment. - * - * @param dropRequest current drop request - * @param droppedEObject the dropped object - * @param nodeType the graphical type of the dropped element (node representation) - * @param edgeType the graphical type of the dropped element (edge representation) - * @return the drop command - * </pre> - */ - protected ICommand getSpecificDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject, String nodeType, String edgeType) { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - /** - * <pre> - * Sub-classes have to implement this method in order to provides drop command for - * elements that are not natively known by the diagram. - * - * @param dropRequest current drop request - * @param droppedEObject the dropped object - * @return the drop command - * </pre> - */ - protected ICommand getUnknownDropCommand(DropObjectsRequest dropRequest, EObject droppedEObject) { - return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; - } - - protected EditPartViewer getViewer() { - return ((IGraphicalEditPart) getHost()).getViewer(); - } - - protected TransactionalEditingDomain getEditingDomain() { - return ((IGraphicalEditPart) getHost()).getEditingDomain(); - } - - protected PreferencesHint getDiagramPreferencesHint() { - return ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint(); - } - - /** - * This methods looks for views representing a given EObject in the host diagram. - * - * @param eObject - * the {@link EObject} to look for. - * @return the list of {@link View} representing the eObject. - */ - private Set<View> getViews(EObject eObject) { - Set<View> views = new HashSet<View>(); - - // Retrieve host diagram - View hostView = ((IGraphicalEditPart) getHost()).getNotationView(); - View hostDiagram = (hostView instanceof Diagram) ? hostView : hostView.getDiagram(); - - // Retrieve all views for the eObject - Collection<View> relatedViews = CrossReferencerUtil.getCrossReferencingViews(eObject, hostDiagram.getType()); - - // Parse and select views from host diagram only - Iterator<View> it = relatedViews.iterator(); - while (it.hasNext()) { - View currentView = it.next(); - if (!(currentView instanceof Diagram) && (currentView.getDiagram() == hostDiagram)) { - views.add(currentView); - } - } - - return views; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java deleted file mode 100644 index 663d811f22b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultContainerNodeEditPolicy.java +++ /dev/null @@ -1,86 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.ConnectionAnchor; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.CreateConnectionRequest; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.util.StringStatics; -import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand; -import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionEndsCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ContainerNodeEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.internal.commands.SetConnectionBendpointsCommand; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand; - -/** - * Default container node edit policy replacement used to replace {@link CreateCommand} by {@link CreateViewCommand}, - * different implementation of the canExecute() method. - * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739. - */ -public class DefaultContainerNodeEditPolicy extends ContainerNodeEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getConnectionCreateCommand(CreateConnectionRequest request) { - if (!(request instanceof CreateConnectionViewRequest)) { - return null; - } - CreateConnectionViewRequest req = (CreateConnectionViewRequest) request; - CompositeCommand cc = new CompositeCommand( - DiagramUIMessages.Commands_CreateCommand_Connection_Label); - Diagram diagramView = ((View) getHost().getModel()) - .getDiagram(); - - // TransactionalEditingDomain editingDomain = getEditingDomain(); - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - CreateCommand createCommand = new CreateViewCommand(editingDomain, req - .getConnectionViewDescriptor(), diagramView.getDiagram()); - // - setViewAdapter((IAdaptable) createCommand.getCommandResult() - .getReturnValue()); - - - SetConnectionEndsCommand sceCommand = new SetConnectionEndsCommand(editingDomain, StringStatics.BLANK); - sceCommand.setEdgeAdaptor(getViewAdapter()); - sceCommand.setNewSourceAdaptor(new EObjectAdapter(getView())); - ConnectionAnchor sourceAnchor = getConnectableEditPart() - .getSourceConnectionAnchor(request); - SetConnectionAnchorsCommand scaCommand = new SetConnectionAnchorsCommand(editingDomain, StringStatics.BLANK); - scaCommand.setEdgeAdaptor(getViewAdapter()); - scaCommand.setNewSourceTerminal(getConnectableEditPart() - .mapConnectionAnchorToTerminal(sourceAnchor)); - SetConnectionBendpointsCommand sbbCommand = new SetConnectionBendpointsCommand(editingDomain); - sbbCommand.setEdgeAdapter(getViewAdapter()); - cc.compose(createCommand); - cc.compose(sceCommand); - cc.compose(scaCommand); - cc.compose(sbbCommand); - Command c = new ICommandProxy(cc); - request.setStartCommand(c); - return c; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java deleted file mode 100644 index c84a050c2d6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultSnapBackEditPolicy.java +++ /dev/null @@ -1,114 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.View; - - -/** - * <pre> - * EditPolicy which support the RequestConstants.REQ_SNAP_BACK request type. - * - * Returns a command to position a label's offset to it default set at creation. - * - * This edit policy is a copy of LabelSnapBackEditPolicy, which does not only use the label view type - * to find the snap back position (also takes into account the diagram and parent view type). - * - * @see org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.LabelSnapBackEditPolicy - * </pre> - */ -@SuppressWarnings("restriction") -public class DefaultSnapBackEditPolicy extends GraphicalNodeEditPolicy { - - - /** - * Understands RequestConstants.REQ_SNAP_BACK request types - * - * @param request - * @return boolean - */ - @Override - public boolean understandsRequest(Request request) { - return RequestConstants.REQ_SNAP_BACK.equals(request.getType()); - } - - /** - * Returns a <code>Command</code> which sets the label's offset to its - * original position. - * - * @param request - * the request - * @return the command - */ - @Override - public Command getCommand(Request request) { - if (RequestConstants.REQ_SNAP_BACK.equals(request.getType())) { - View view = (View) getHost().getModel(); - - // YT - Use a snap back hint that takes into account the diagram - // and parent view type. - String hint = getSnapBackHint(view); - - Point offset = LabelEditPart.getSnapBackPosition(hint); - if (offset == null) { - return null; - } - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - - ICommand moveCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), offset); - return new ICommandProxy(moveCommand); - } - return null; - } - - @Override - public EditPart getTargetEditPart(Request request) { - if (understandsRequest(request)) { - return getHost(); - } - return super.getTargetEditPart(request); - } - - /** - * Get the snap back hint for the view. - * - * @param view - * the view to snap back. - * @return the snap back hint. - */ - private String getSnapBackHint(View view) { - - String diagramType = view.getDiagram().getType(); - String parentType = ViewUtil.getViewContainer(view).getType(); - String labelType = view.getType(); - - return diagramType + "_" + parentType + "-" + labelType; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java deleted file mode 100644 index 30aafed5da7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/DefaultXYLayoutEditPolicy.java +++ /dev/null @@ -1,116 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import java.util.Iterator; - -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PrecisionPoint; -import org.eclipse.draw2d.geometry.PrecisionRectangle; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.SnapToHelper; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.LayoutHelper; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.XYLayoutWithConstrainedResizedEditPolicy; - -/** - * Avoid forcing (-1, -1) dimension in set bounds command (let the view factories deal with - * size initialization if needed). - */ -public class DefaultXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEditPolicy { - - /** - * Called in response to a <tt>REQ_CREATE</tt> request. Returns a command - * to set each created element bounds and auto-size properties. - * - * @param request - * a create request (understands instances of {@link CreateViewRequest}). - * @return a command to satisfy the request; <tt>null</tt> if the request is not - * understood. - */ - @Override - protected Command getCreateCommand(CreateRequest request) { - CreateViewRequest req = (CreateViewRequest) request; - - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - - CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label); - Iterator<?> iter = req.getViewDescriptors().iterator(); - final Rectangle BOUNDS = (Rectangle) getConstraintFor(request); - boolean couldBeSnaped = request.getLocation().equals(LayoutHelper.UNDEFINED.getLocation()) && req.isSnapToEnabled(); - while (iter.hasNext()) { - CreateViewRequest.ViewDescriptor viewDescriptor = (CreateViewRequest.ViewDescriptor) iter.next(); - Rectangle rect = getBoundsOffest(req, BOUNDS, viewDescriptor); - - // see bug 427129: Figures newly created via the palette should be snapped to grid if "snap to grid" is activated - if (couldBeSnaped) { - // this code fix the bug in some case... - int add = 0; - DiagramRootEditPart drep = (DiagramRootEditPart) getHost().getRoot(); - double spacing = drep.getGridSpacing(); - final double max_value = spacing * 20; - final SnapToHelper helper = (SnapToHelper) getHost().getAdapter(SnapToHelper.class); - if (helper != null) { - final LayoutHelper layoutHelper = new LayoutHelper(); - while (add < max_value) {// we define a max value to do test - Rectangle LOCAL_BOUNDS = BOUNDS.getCopy(); - LOCAL_BOUNDS.translate(add, add); - Rectangle tmp_rect = getBoundsOffest(req, LOCAL_BOUNDS, viewDescriptor); - final PrecisionRectangle resultRect = new PrecisionRectangle(tmp_rect); - resultRect.setWidth(-1); - resultRect.setHeight(-1); - PrecisionPoint res1 = new PrecisionPoint(tmp_rect.getLocation()); - helper.snapPoint(request, PositionConstants.NORTH_WEST, res1.getPreciseCopy(), res1); - final Point pt = layoutHelper.validatePosition(getHostFigure(), resultRect.setLocation(res1)); - if (couldBeSnaped) { - if (pt.equals(resultRect.getLocation())) { - rect.setLocation(resultRect.getLocation()); - break; - } else { - add += spacing; - continue; - } - } - } - } - } - if (rect.getSize().isEmpty()) { - // Only set location and let the ViewFactory deal with dimension. - cc.compose(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, rect.getLocation().getCopy())); - - } else { - // Default set bounds command. - cc.compose(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, rect)); - } - break; - - } - - if (cc.reduce() == null) { - return null; - } - return chainGuideAttachmentCommands(request, new ICommandProxy(cc.reduce())); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java deleted file mode 100644 index 0b305132f46..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ExternalLabelPrimaryDragRoleEditPolicy.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.PrecisionRectangle; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; - -/** - * This policy provides the selection handles, feedback and move command for - * external node label. - * The expected behavior is to provide an external label that can freely move and with a link feedback - * towards its parent figure during the move. - */ -public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected List createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - - /** - * {@inheritDoc} - */ - @Override - protected Command getMoveCommand(ChangeBoundsRequest request) { - LabelEditPart editPart = (LabelEditPart) getHost(); - - // FeedBack - Parent + Delta - Rectangle updatedRect = new Rectangle(); - PrecisionRectangle initialRect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy()); - updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated()); - updatedRect = updatedRect.getTranslated(request.getMoveDelta()); - - // translate the feedback figure - PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy()); - getHostFigure().translateToAbsolute(rect); - rect.translate(request.getMoveDelta()); - rect.resize(request.getSizeDelta()); - getHostFigure().translateToRelative(rect); - - // translate according to the text alignments - if (editPart instanceof PapyrusLabelEditPart) { - switch (((PapyrusLabelEditPart) editPart).getTextAlignment()) { - case PositionConstants.LEFT: - break; - case PositionConstants.CENTER: - updatedRect.translate(getHostFigure().getBounds().width / 2, 0); - break; - case PositionConstants.RIGHT: - updatedRect.translate(getHostFigure().getBounds().width, 0); - break; - default: - break; - } - } - - ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), updatedRect); - return new ICommandProxy(moveCommand); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java deleted file mode 100644 index 445f0452530..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/ILinkMappingHelper.java +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -/** - * Interface to map links at semantic level. - */ -@Deprecated -public interface ILinkMappingHelper extends org.eclipse.papyrus.uml.diagram.common.helper.ILinkMappingHelper { - - // /** - // * Get the sources. - // * - // * @param link - // * the link. - // * @return the sources. - // */ - // public Collection<?> getSource(EObject link); - // - // /** - // * Get the targets. - // * - // * @param link - // * the link. - // * @return the targets. - // */ - // public Collection<?> getTarget(EObject link); -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java deleted file mode 100644 index 2eaea78bf56..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDefaultSemanticEditPolicy.java +++ /dev/null @@ -1,85 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; - -/** - * Semantic edit policy for label (affixed labels mainly), that allow correct destroy, - * but forbid other edit actions. - */ -public class LabelDefaultSemanticEditPolicy extends DefaultSemanticEditPolicy { - - @Override - protected Command getDestroyElementCommand(DestroyElementRequest req) { - return super.getDestroyElementCommand(req); - } - - @Override - protected Command getConfigureCommand(ConfigureRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getCreateCommand(CreateElementRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getSetCommand(SetRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getDuplicateCommand(DuplicateElementsRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getMoveCommand(MoveRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { - return UnexecutableCommand.INSTANCE; - } - - @Override - protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { - return UnexecutableCommand.INSTANCE; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java deleted file mode 100644 index 41e6046dfe3..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LabelDirectEditPolicy.java +++ /dev/null @@ -1,115 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.DirectEditPolicy; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.gef.ui.internal.parts.TextCellEditorEx; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart; - -/** - * Overrides {@link org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy} in - * order to pass parser options to the method that returns the modification command. - * (always pass 0 - ParserOptions.NONE in the original class). - * - * Also this uses (or tries to) the EObject given by {@link org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart#getParserElement()} to - * get the edit command instead of using the EObject associated to the edited edit part. - */ -public class LabelDirectEditPolicy extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy { - - /** - * We need an adapter that will be able to hold both a model - * and an view - */ - class EObjectAdapterEx extends EObjectAdapter { - - private View view = null; - - /** - * constructor - * - * @param element - * element to be wrapped - * @param view - * view to be wrapped - */ - public EObjectAdapterEx(EObject element, View view) { - super(element); - this.view = view; - } - - @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - Object o = super.getAdapter(adapter); - if (o != null) { - return o; - } - if (adapter.equals(View.class)) { - return view; - } - return null; - } - } - - /** - * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest) - */ - @Override - protected Command getDirectEditCommand(DirectEditRequest edit) { - if (edit.getCellEditor() instanceof TextCellEditorEx) { - if (!((TextCellEditorEx) edit.getCellEditor()).hasValueChanged()) { - return null; - } - } - - String labelText = (String) edit.getCellEditor().getValue(); - - // for CellEditor, null is always returned for invalid values - if (labelText == null) { - return null; - } - - // Papyrus - using org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart here - ITextAwareEditPart compartment = (ITextAwareEditPart) getHost(); - EObjectAdapter elementAdapter = new EObjectAdapterEx(compartment.getParserElement(), null); - // - - // Papyrus - elementAdapter created with compartment.getParserElement(), no need to use the view here. - // EObject model = (EObject)compartment.getModel(); - // EObjectAdapter elementAdapter = null; - // if(model instanceof View) { - // View view = (View)model; - // elementAdapter = new EObjectAdapterEx(ViewUtil.resolveSemanticElement(view), view); - // } else - // elementAdapter = new EObjectAdapterEx(model, null); - - // check to make sure an edit has occurred before returning a command. - String prevText = compartment.getParser().getEditString(elementAdapter, compartment.getParserOptions().intValue()); - if (!prevText.equals(labelText)) { - ICommand iCommand = compartment.getParser().getParseCommand(elementAdapter, labelText, compartment.getParserOptions().intValue()); - // Papyrus - use parser options to build command - // compartment.getParser().getParseCommand(elementAdapter, labelText, 0); - return new ICommandProxy(iCommand); - } - - return null; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java deleted file mode 100644 index 3ba01b4790d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/LinkLabelDragEditPolicy.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; - -/** - * Abstract non-diagram specific drag edit policy for link labels. - * This class is adapted from edit parts generated by GMF Tooling. - * Deprecated: use {@link PapyrusLinkLabelDragPolicy} instead. - */ -@Deprecated -public class LinkLabelDragEditPolicy extends NonResizableLabelEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - @SuppressWarnings("rawtypes") - protected List createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java deleted file mode 100644 index 766f156d554..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextNonResizableEditPolicy.java +++ /dev/null @@ -1,211 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FigureListener; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx; -import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class TextNonResizableEditPolicy extends NonResizableEditPolicyEx { - - private IFigure selectionFeedbackFigure; - - private IFigure focusFeedbackFigure; - - private FigureListener hostPositionListener; - - /** - * {@inheritDoc} - */ - @Override - protected void showPrimarySelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - showSelection(); - showFocus(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void showSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - hideSelection(); - addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); - getHostFigure().addFigureListener(getHostPositionListener()); - refreshSelectionFeedback(); - hideFocus(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void hideSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(false); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (selectionFeedbackFigure != null) { - removeFeedback(selectionFeedbackFigure); - getHostFigure().removeFigureListener(getHostPositionListener()); - selectionFeedbackFigure = null; - } - hideFocus(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void showFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - hideFocus(); - addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); - refreshFocusFeedback(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void hideFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (focusFeedbackFigure != null) { - removeFeedback(focusFeedbackFigure); - focusFeedbackFigure = null; - } - } - } - - protected Rectangle getFeedbackBounds() { - Rectangle bounds; - if (getHostFigure() instanceof Label) { - bounds = ((Label) getHostFigure()).getTextBounds(); - bounds.intersect(getHostFigure().getBounds()); - } else { - bounds = getHostFigure().getBounds().getCopy(); - } - getHostFigure().getParent().translateToAbsolute(bounds); - getFeedbackLayer().translateToRelative(bounds); - return bounds; - } - - protected IFigure createSelectionFeedbackFigure() { - if (getHostFigure() instanceof Label) { - Label feedbackFigure = new Label(); - feedbackFigure.setOpaque(true); - feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected); - feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected); - return feedbackFigure; - } else { - RectangleFigure feedbackFigure = new RectangleFigure(); - feedbackFigure.setFill(false); - return feedbackFigure; - } - } - - protected IFigure createFocusFeedbackFigure() { - return new Figure() { - - @Override - protected void paintFigure(Graphics graphics) { - graphics.drawFocus(getBounds().getResized(-1, -1)); - } - }; - } - - protected void updateLabel(Label target) { - Label source = (Label) getHostFigure(); - target.setText(source.getText()); - target.setTextAlignment(source.getTextAlignment()); - target.setFont(source.getFont()); - } - - protected void refreshSelectionFeedback() { - if (selectionFeedbackFigure != null) { - if (selectionFeedbackFigure instanceof Label) { - updateLabel((Label) selectionFeedbackFigure); - selectionFeedbackFigure.setBounds(getFeedbackBounds()); - } else { - selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5)); - } - } - } - - protected void refreshFocusFeedback() { - if (focusFeedbackFigure != null) { - focusFeedbackFigure.setBounds(getFeedbackBounds()); - } - } - - public void refreshFeedback() { - refreshSelectionFeedback(); - refreshFocusFeedback(); - } - - private FigureListener getHostPositionListener() { - if (hostPositionListener == null) { - hostPositionListener = new FigureListener() { - - @Override - public void figureMoved(IFigure source) { - refreshFeedback(); - } - }; - } - return hostPositionListener; - } - - /** - * {@inheritDoc} - */ - @Override - protected List createSelectionHandles() { - MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost()); - moveHandle.setBorder(null); - moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost())); - return Collections.singletonList(moveHandle); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java deleted file mode 100644 index 9952e69dac6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/TextSelectionEditPolicy.java +++ /dev/null @@ -1,194 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.edit.policy; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.Figure; -import org.eclipse.draw2d.FigureListener; -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.editpolicies.SelectionEditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class TextSelectionEditPolicy extends SelectionEditPolicy { - - private IFigure selectionFeedbackFigure; - - private IFigure focusFeedbackFigure; - - private FigureListener hostPositionListener; - - /** - * {@inheritDoc} - */ - @Override - protected void showPrimarySelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - showSelection(); - showFocus(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void showSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(true); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - hideSelection(); - addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure()); - getHostFigure().addFigureListener(getHostPositionListener()); - refreshSelectionFeedback(); - hideFocus(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void hideSelection() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setSelected(false); - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (selectionFeedbackFigure != null) { - removeFeedback(selectionFeedbackFigure); - getHostFigure().removeFigureListener(getHostPositionListener()); - selectionFeedbackFigure = null; - } - hideFocus(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void showFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(true); - } else { - hideFocus(); - addFeedback(focusFeedbackFigure = createFocusFeedbackFigure()); - refreshFocusFeedback(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void hideFocus() { - if (getHostFigure() instanceof WrappingLabel) { - ((WrappingLabel) getHostFigure()).setFocus(false); - } else { - if (focusFeedbackFigure != null) { - removeFeedback(focusFeedbackFigure); - focusFeedbackFigure = null; - } - } - } - - protected Rectangle getFeedbackBounds() { - Rectangle bounds; - if (getHostFigure() instanceof Label) { - bounds = ((Label) getHostFigure()).getTextBounds(); - bounds.intersect(getHostFigure().getBounds()); - } else { - bounds = getHostFigure().getBounds().getCopy(); - } - getHostFigure().getParent().translateToAbsolute(bounds); - getFeedbackLayer().translateToRelative(bounds); - return bounds; - } - - protected IFigure createSelectionFeedbackFigure() { - if (getHostFigure() instanceof Label) { - Label feedbackFigure = new Label(); - feedbackFigure.setOpaque(true); - feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected); - feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected); - return feedbackFigure; - } else { - RectangleFigure feedbackFigure = new RectangleFigure(); - feedbackFigure.setFill(false); - return feedbackFigure; - } - } - - protected IFigure createFocusFeedbackFigure() { - return new Figure() { - - @Override - protected void paintFigure(Graphics graphics) { - graphics.drawFocus(getBounds().getResized(-1, -1)); - } - }; - } - - protected void updateLabel(Label target) { - Label source = (Label) getHostFigure(); - target.setText(source.getText()); - target.setTextAlignment(source.getTextAlignment()); - target.setFont(source.getFont()); - } - - protected void refreshSelectionFeedback() { - if (selectionFeedbackFigure != null) { - if (selectionFeedbackFigure instanceof Label) { - updateLabel((Label) selectionFeedbackFigure); - selectionFeedbackFigure.setBounds(getFeedbackBounds()); - } else { - selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5)); - } - } - } - - protected void refreshFocusFeedback() { - if (focusFeedbackFigure != null) { - focusFeedbackFigure.setBounds(getFeedbackBounds()); - } - } - - public void refreshFeedback() { - refreshSelectionFeedback(); - refreshFocusFeedback(); - } - - private FigureListener getHostPositionListener() { - if (hostPositionListener == null) { - hostPositionListener = new FigureListener() { - - @Override - public void figureMoved(IFigure source) { - refreshFeedback(); - } - }; - } - return hostPositionListener; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java deleted file mode 100644 index 3ba18900adb..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AbstractLabelViewFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.DecorationNodeViewFactory; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager; - -/** - * Default view Factory for Papyrus custom labels. - */ -public abstract class AbstractLabelViewFactory extends DecorationNodeViewFactory { - - @Override - protected void initializeFromPreferences(View view) { - // Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed) - if (ThemeInitializerManager.instance.usePreferenceInitializer(view)) { - super.initializeFromPreferences(view); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java deleted file mode 100644 index 1a458a7c7c8..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/AffixedLabelViewFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.LayoutConstraint; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; - -/** - * Default view Factory for Papyrus custom affixed labels. - */ -public class AffixedLabelViewFactory extends AbstractLabelViewFactory { - - /** - * {@inheritDoc} - */ - @Override - protected LayoutConstraint createLayoutConstraint() { - return NotationFactory.eINSTANCE.createLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeFromPreferences(View view) { - - super.initializeFromPreferences(view); - - IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - - String preferenceKey = ViewUtil.getViewContainer(view).getType() + "-" + view.getType(); - PreferenceInitializerForElementHelper.initLabelLocationFromPrefs(view, store, preferenceKey); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java deleted file mode 100644 index cd231398b00..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentListViewFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.ListCompartmentViewFactory; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.NotationFactory; - -/** - * Default compartment view Factory for custom list compartments. - */ -public class CompartmentListViewFactory extends ListCompartmentViewFactory { - - /** - * {@inheritDoc} - */ - @Override - protected Node createNode() { - return NotationFactory.eINSTANCE.createListCompartment(); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java deleted file mode 100644 index 9fd448a1a0a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/CompartmentShapeViewFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import java.util.List; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.BasicCompartmentViewFactory; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; - -/** - * Default compartment view Factory for custom shape compartments. - */ -public class CompartmentShapeViewFactory extends BasicCompartmentViewFactory { - - /** - * {@inheritDoc} - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - protected List createStyles(View view) { - List styles = super.createStyles(view); - styles.add(NotationFactory.eINSTANCE.createTitleStyle()); - return styles; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java deleted file mode 100644 index eb1e0ea9e60..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorLabelViewFactory.java +++ /dev/null @@ -1,52 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.LayoutConstraint; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; - -/** - * Default view Factory for Papyrus custom affixed labels. - */ -public class ConnectorLabelViewFactory extends AbstractLabelViewFactory { - - /** - * {@inheritDoc} - */ - @Override - protected LayoutConstraint createLayoutConstraint() { - return NotationFactory.eINSTANCE.createLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeFromPreferences(View view) { - - super.initializeFromPreferences(view); - - IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - - String preferenceKey = ViewUtil.getViewContainer(view).getType() + "-" + view.getType(); - PreferenceInitializerForElementHelper.initLabelLocationFromPrefs(view, store, preferenceKey); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java deleted file mode 100644 index 7386f3f82c4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ConnectorViewFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.Style; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager; -import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; - -/** - * Default connector view Factory for Papyrus custom edges. - */ -public class ConnectorViewFactory extends org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ConnectorViewFactory { - - /** - * {@inheritDoc} - */ - @Override - protected List createStyles(View view) { - return Arrays.asList(new Style[] { NotationFactory.eINSTANCE.createFontStyle() }); - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeFromPreferences(View view) { - // Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed) - if (ThemeInitializerManager.instance.usePreferenceInitializer(view)) { - super.initializeFromPreferences(view); - } - - IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - - // The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required) - String elementName = view.getType(); - PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, elementName); - PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, elementName); - PreferenceInitializerForElementHelper.initRoutingFromPrefs(view, store, elementName); - PreferenceInitializerForElementHelper.initLabelVisibilityFromPrefs(view, store, elementName); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java deleted file mode 100644 index c4d0a29492b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/InnerLabelViewFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -/** - * Default label view Factory for Papyrus custom inner labels. - */ -public class InnerLabelViewFactory extends AbstractLabelViewFactory { - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java deleted file mode 100644 index 3a2c5a7da35..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeChildLabelViewFactory.java +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory; -import org.eclipse.gmf.runtime.notation.LayoutConstraint; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager; -import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; - -/** - * Default Shape view Factory for Papyrus custom child label nodes. - */ -public class ShapeChildLabelViewFactory extends AbstractShapeViewFactory { - - /** - * {@inheritDoc} - */ - @Override - protected LayoutConstraint createLayoutConstraint() { - return NotationFactory.eINSTANCE.createLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeFromPreferences(View view) { - // Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed) - if (ThemeInitializerManager.instance.usePreferenceInitializer(view)) { - super.initializeFromPreferences(view); - } - - IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - - // The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required) - String preferenceKey = view.getType(); - PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, preferenceKey); - PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, preferenceKey); - - PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(view, store, preferenceKey); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java deleted file mode 100644 index 78669c3ce1e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/factory/ShapeViewFactory.java +++ /dev/null @@ -1,59 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.factory; - -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.Shape; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.papyrus.infra.gmfdiag.common.providers.ThemeInitializerManager; -import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; - -/** - * Default Shape view Factory for Papyrus custom nodes. - */ -public class ShapeViewFactory extends org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ShapeViewFactory { - - /** - * {@inheritDoc} - */ - @Override - protected Shape createNode() { - return NotationFactory.eINSTANCE.createShape(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeFromPreferences(View view) { - // Do not call initializeFromPreferences when the preference initializer is disabled (Typical use case: CSS are installed) - if (ThemeInitializerManager.instance.usePreferenceInitializer(view)) { - super.initializeFromPreferences(view); - } - - IPreferenceStore store = (IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - - // The PreferenceInitializerForElementHelper already checks for usePreferenceInitializer() (When required) - String elementName = view.getType(); - PreferenceInitializerForElementHelper.initForegroundFromPrefs(view, store, elementName); - PreferenceInitializerForElementHelper.initFontStyleFromPrefs(view, store, elementName); - PreferenceInitializerForElementHelper.initBackgroundFromPrefs(view, store, elementName); - - PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(view, store, elementName); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java deleted file mode 100644 index f057c8cf0b4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/CellEditorLocatorUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.locator; - -import org.eclipse.draw2d.Label; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class CellEditorLocatorUtil { - - public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) { - if (source.getFigure() instanceof IMultilineEditableFigure) { - return new MultilineCellEditorLocator((IMultilineEditableFigure) source.getFigure()); - } else if (source.getFigure() instanceof WrappingLabel) { - return new TextCellEditorLocator((WrappingLabel) source.getFigure()); - } else { - return new LabelCellEditorLocator((Label) source.getFigure()); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java deleted file mode 100644 index 410406f59e2..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/LabelCellEditorLocator.java +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.locator; - -import org.eclipse.draw2d.FigureUtilities; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Text; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class LabelCellEditorLocator implements CellEditorLocator { - - private Label label; - - public LabelCellEditorLocator(Label label) { - this.label = label; - } - - public Label getLabel() { - return label; - } - - @Override - public void relocate(CellEditor celleditor) { - Text text = (Text) celleditor.getControl(); - Rectangle rect = getLabel().getTextBounds().getCopy(); - getLabel().translateToAbsolute(rect); - if (!text.getFont().isDisposed()) { - int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth(); - rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0)); - } - if (!rect.equals(new Rectangle(text.getBounds()))) { - text.setBounds(rect.x, rect.y, rect.width, rect.height); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java deleted file mode 100644 index c3cb6a6040e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/MultilineCellEditorLocator.java +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.locator; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Text; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class MultilineCellEditorLocator implements CellEditorLocator { - - private IMultilineEditableFigure multilineEditableFigure; - - public MultilineCellEditorLocator(IMultilineEditableFigure figure) { - this.multilineEditableFigure = figure; - } - - public IMultilineEditableFigure getMultilineEditableFigure() { - return multilineEditableFigure; - } - - @Override - public void relocate(CellEditor celleditor) { - Text text = (Text) celleditor.getControl(); - 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 Dimension(text.computeSize(rect.width, SWT.DEFAULT))); - } - if (!rect.equals(new Rectangle(text.getBounds()))) { - text.setBounds(rect.x, rect.y, rect.width, rect.height); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java deleted file mode 100644 index 1a4a7d56fc8..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/locator/TextCellEditorLocator.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.locator; - -import org.eclipse.draw2d.FigureUtilities; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gef.tools.CellEditorLocator; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.jface.viewers.CellEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Text; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class TextCellEditorLocator implements CellEditorLocator { - - private WrappingLabel wrapLabel; - - public TextCellEditorLocator(WrappingLabel wrapLabel) { - this.wrapLabel = wrapLabel; - } - - public WrappingLabel getWrapLabel() { - return wrapLabel; - } - - @Override - public void relocate(CellEditor celleditor) { - Text text = (Text) celleditor.getControl(); - Rectangle rect = getWrapLabel().getTextBounds().getCopy(); - getWrapLabel().translateToAbsolute(rect); - if (!text.getFont().isDisposed()) { - if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) { - rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT))); - } else { - int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth(); - rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0)); - } - } - if (!rect.equals(new Rectangle(text.getBounds()))) { - text.setBounds(rect.x, rect.y, rect.width, rect.height); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java deleted file mode 100644 index 6513381901e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/parser/IMaskManagedSemanticParser.java +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.parser; - -import java.util.Collection; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; - -/** - * Interface for semantic parsers that support mask options. - * - * @deprecated since Eclipse Mars SR1. Use {@link org.eclipse.papyrus.uml.diagram.common.parser.IMaskManagedSemanticParser} instead - */ -@Deprecated -public interface IMaskManagedSemanticParser extends ISemanticParser { - - /** The label to show in case ParserOptions.None is passed as flag (avoid a fully masked label) */ - public static final String MaskedLabel = "<empty label>"; - - /** - * Get the {@link Map} of masks - * - * @return the {@link Map} of masks - */ - public Map<String, String> getMasks(); - - /** - * Gets the default mask configuration for this parser - * - * @return - * The default mask configuration for this parser - */ - public Collection<String> getDefaultValue(IAdaptable element); -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java deleted file mode 100644 index 3c3d811738a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/AbstractViewProvider.java +++ /dev/null @@ -1,328 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.provider; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.HashMap; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.transaction.util.TransactionUtil; -import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.common.core.util.Log; -import org.eclipse.gmf.runtime.diagram.core.internal.DiagramPlugin; -import org.eclipse.gmf.runtime.diagram.core.internal.DiagramStatusCodes; -import org.eclipse.gmf.runtime.diagram.core.internal.l10n.DiagramCoreMessages; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.core.providers.IViewProvider; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewOperation; -import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.osgi.util.NLS; - -/** - * Implements of the <code>IViewProvider</code> interface. This - * implementations invokes the appropriate factory method by inspecting the - * supplied operation and provides the actual view creation functionality. - */ -public class AbstractViewProvider extends AbstractProvider implements IViewProvider { - - private static String viewCreationMethodName = "createView"; //$NON-NLS-1$ - - private static String diagramCreationMethodName = "createDiagram"; //$NON-NLS-1$ - - static protected class ClassToCreationMethodMap extends HashMap { - - static final long serialVersionUID = 1; - - public void addMethod(Class clazz, Method method) { - if (get(clazz) == null) { - put(clazz, method); - } - } - - public Method getCreationMethod(Class clazz) { - return (Method) get(clazz); - } - } - - public static ClassToCreationMethodMap classToCreateMethod = new ClassToCreationMethodMap(); - - /** - * Determines whether this view provider can provide for the required - * operation It inspects the type of view operation and calls the - * corresponding <code>provides</code> method. - * - * @see org.eclipse.gmf.runtime.common.core.service.IProvider#provides(IOperation) - */ - @Override - public final boolean provides(IOperation operation) { - /* if this is the CreateViewForKindOperation operation */ - if (operation instanceof CreateViewForKindOperation) { - return provides((CreateViewForKindOperation) operation); - } - - /* Make sure it is a view operation */ - assert operation instanceof CreateViewOperation : "operation is not CreateViewOperation in AbstractViewProvider";//$NON-NLS-1$ - - /* call the specific provides method */ - if (operation instanceof CreateDiagramViewOperation) { - return provides((CreateDiagramViewOperation) operation); - } else if (operation instanceof CreateEdgeViewOperation) { - return provides((CreateEdgeViewOperation) operation); - } else if (operation instanceof CreateNodeViewOperation) { - return provides((CreateNodeViewOperation) operation); - } - return false; - } - - @Override - public final Diagram createDiagram(IAdaptable contextElement, String diagramKind, PreferencesHint preferencesHint) { - return (Diagram) createNewView(getDiagramViewClass(contextElement, diagramKind), new Object[] { contextElement, diagramKind, preferencesHint }); - } - - // Papyrus - final statement removed - @Override - public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { - - return (Edge) createNewView(getEdgeViewClass(semanticAdapter, containerView, semanticHint), new Object[] { semanticAdapter, containerView, semanticHint, new Integer(index), Boolean.valueOf(persisted), preferencesHint }); - } - - // Papyrus - final statement removed - @Override - public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { - - return (Node) createNewView(getNodeViewClass(semanticAdapter, containerView, semanticHint), new Object[] { semanticAdapter, containerView, semanticHint, new Integer(index), Boolean.valueOf(persisted), preferencesHint }); - } - - /** - * Determines whether this provider can provide for the specified view - * creation operation - * - * @param operation - * Contains a semantic kind and a containerView - * @return boolean - */ - protected boolean provides(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; - } - return true; - } - - /** - * Determines whether this provider can provide for the specified diagram - * view operation - * - * @param operation - * @return boolean - */ - protected boolean provides(CreateDiagramViewOperation operation) { - return getDiagramViewClass(operation.getSemanticAdapter(), operation.getSemanticHint()) != null; - } - - /** - * Determines whether this provider can provide for the specified edge view - * operation - * - * @param operation - * @return boolean - */ - protected boolean provides(CreateEdgeViewOperation operation) { - return (getEdgeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()) != null); - } - - /** - * Determines whether this provider can provide for the specified node view - * operation - * - * @param operation - * @return boolean - */ - protected boolean provides(CreateNodeViewOperation operation) { - return (getNodeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()) != null); - } - - /** - * Returns the diagram view class to instantiate based on the passed params - * - * @param semanticAdapter - * TODO - * @param semanticAdapter - * @return Class - */ - protected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) { - return null; - } - - /** - * Returns the edge view class to instantiate based on the passed params - * - * @param semanticAdapter - * @param containerView - * @param semanticHint - * @return Class - */ - protected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) { - return null; - } - - /** - * Returns the node view class to instantiate based on the passed params - * - * @param semanticAdapter - * @param containerView - * @param semanticHint - * @return Class - */ - protected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) { - return null; - } - - /** - * creates a view instance via reflection. - * - * @param constructorParams - * the view's constructor parameters. - */ - private View createNewView(Class viewClass, Object[] constructorParams) { - try { - assert null != viewClass : "Null viewClass in AbstractProvider";//$NON-NLS-1$ - assert null != constructorParams : "Null constructorParams in AbstractProvider";//$NON-NLS-1$ - - Constructor constructor = getFactoryConstructor(viewClass); - if (constructor == null) { - Log.error(DiagramPlugin.getInstance(), DiagramStatusCodes.SERVICE_FAILURE, "View (" + viewClass + ") is missing a proper creation Factory"); //$NON-NLS-1$//$NON-NLS-2$ - return null; - } - - Object factory = constructor.newInstance(new Object[] {}); - Method method = getCreationMethod(viewClass, constructorParams); - if (method == null) { - Log.error(DiagramPlugin.getInstance(), DiagramStatusCodes.SERVICE_FAILURE, "View (" + viewClass + ") is missing a proper creation Factory"); //$NON-NLS-1$//$NON-NLS-2$ - return null; - } - return (View) method.invoke(factory, constructorParams); - } catch (Throwable e) { - String eMsg = NLS.bind(DiagramCoreMessages.AbstractViewProvider_create_view_failed_ERROR_, viewClass.getName()); - Log.warning(DiagramPlugin.getInstance(), IStatus.WARNING, eMsg, e); - return null; - } - } - - private Constructor getFactoryConstructor(Class viewClass) { - if (viewClass != null) { - Constructor[] ctors = viewClass.getConstructors(); - for (int i = 0; i < ctors.length; i++) { - if (ctors[i].getParameterTypes().length == 0) { - return ctors[i]; - } - } - } - return null; - } - - /** Return the <i>creation</i> constructor for the cached view class. */ - private Method getCreationMethod(Class viewClass, Object[] params) { - if (viewClass != null) { - Method method = classToCreateMethod.getCreationMethod(viewClass); - if (method != null) { - return method; - } - - Method[] methods = viewClass.getMethods(); - for (int i = 0; i < methods.length; i++) { - method = methods[i]; - String methodName = method.getName(); - if (methodName.equals(viewCreationMethodName) || methodName.equals(diagramCreationMethodName)) { - classToCreateMethod.addMethod(viewClass, method); - return method; - } - } - } - return null; - } - - /** - * Returns the EClass associated with the semantic adapter - * - * @param semanticAdapter - * @return EClass - */ - protected EClass getSemanticEClass(IAdaptable semanticAdapter) { - if (semanticAdapter == null) { - return null; - } - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - return EMFCoreUtil.getProxyClass(eObject); - } - IElementType type = (IElementType) semanticAdapter.getAdapter(IElementType.class); - if (type != null) { - return type.getEClass(); - } - return null; - } - - /** - * Returns the semantic element associated with the semantic adapter - * - * @param semanticAdapter - * @return EClass - */ - protected EObject getSemanticElement(IAdaptable semanticAdapter) { - if (semanticAdapter == null) { - return null; - } - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - return EMFCoreUtil.resolve(TransactionUtil.getEditingDomain(eObject), eObject); - } - return null; - } - - /** - * Returns the semantic element associated with the semantic adapter - * - * @param semanticAdapter - * @return EClass - */ - protected EObject getSemanticElement(IAdaptable semanticAdapter, TransactionalEditingDomain domain) { - if (semanticAdapter == null) { - return null; - } - EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class); - if (eObject != null) { - return EMFCoreUtil.resolve(domain, eObject); - } - return null; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java deleted file mode 100644 index bea81c411ed..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractEditPartProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.provider; - -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation; -import org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart; - -/** - * This abstract edit part provider restricts its contribution to view that are owned by - * a given type of diagram. - */ -public abstract class CustomAbstractEditPartProvider extends AbstractEditPartProvider { - - /** The provides only provides for this diagram type */ - protected String diagramType= org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart.MODEL_ID; - - /** - * {@inheritDoc} - */ - @Override - public boolean provides(IOperation operation) { - if (operation instanceof CreateGraphicEditPartOperation) { - String currentDiagramType = ((IEditPartOperation) operation).getView().getDiagram().getType(); - - if ((diagramType == null) || (!diagramType.equals(currentDiagramType))) { - return false; - } - } - - return super.provides(operation); - } - - - - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java deleted file mode 100644 index 8958a363c7e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/CustomAbstractViewProvider.java +++ /dev/null @@ -1,154 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.provider; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateEdgeViewOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateNodeViewOperation; -import org.eclipse.gmf.runtime.diagram.core.services.view.CreateViewForKindOperation; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.gmf.runtime.notation.View; - -/** - * This abstract view provider retrieve the view type from the graphical type - * registry and use it in edge and node view creation. - */ -public abstract class CustomAbstractViewProvider extends AbstractViewProvider { - - /** Local graphical type registry */ - protected IGraphicalTypeRegistry registry; - - /** The provides only provides for this diagram type */ - protected String diagramType; - - /** - * {@inheritDoc} - */ - @Override - public Edge createEdge(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { - String graphicalType = getEdgeGraphicalType(semanticAdapter, containerView, semanticHint); - return super.createEdge(semanticAdapter, containerView, graphicalType, index, persisted, preferencesHint); - } - - /** - * {@inheritDoc} - */ - @Override - public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { - String graphicalType = getNodeGraphicalType(semanticAdapter, containerView, semanticHint); - return super.createNode(semanticAdapter, containerView, graphicalType, index, persisted, preferencesHint); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean provides(CreateViewForKindOperation op) { - - // This method should generally not be called (https://bugs.eclipse.org/bugs/show_bug.cgi?id=346739). - - if ((diagramType == null) || (!diagramType.equals(op.getContainerView().getDiagram().getType()))) { - return false; - } - - // if(op.getViewKind() == Node.class) { - // String graphicalType = getNodeGraphicalType(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()); - // return getNodeViewClass(op.getSemanticAdapter(), op.getContainerView(), graphicalType) != null; - // } - // - // if(op.getViewKind() == Edge.class) { - // String graphicalType = getEdgeGraphicalType(op.getSemanticAdapter(), op.getContainerView(), op.getSemanticHint()); - // return getEdgeViewClass(op.getSemanticAdapter(), op.getContainerView(), graphicalType) != null; - // } - - throw new UnsupportedOperationException("Should never be called by the " + diagramType + " diagram."); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean provides(CreateEdgeViewOperation operation) { - - if ((diagramType == null) || (!diagramType.equals(operation.getContainerView().getDiagram().getType()))) { - return false; - } - - String graphicalType = getEdgeGraphicalType(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()); - return (getEdgeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), graphicalType) != null); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean provides(CreateNodeViewOperation operation) { - - if ((diagramType == null) || (!diagramType.equals(operation.getContainerView().getDiagram().getType()))) { - return false; - } - - String graphicalType = getNodeGraphicalType(operation.getSemanticAdapter(), operation.getContainerView(), operation.getSemanticHint()); - return (getNodeViewClass(operation.getSemanticAdapter(), operation.getContainerView(), graphicalType) != null); - } - - private String getNodeGraphicalType(IAdaptable semanticAdapter, View containerView, String semanticHint) { - String graphicalType = null; - - // Some ViewDescriptor constructors initialize unspecified semanticHint with "" - if ((semanticHint != null) && (!"".equals(semanticHint))) { - graphicalType = registry.getNodeGraphicalType(semanticHint, containerView.getType()); - - } else if (semanticAdapter != null) { - - EObject domainElement = (EObject) semanticAdapter.getAdapter(EObject.class); - if (domainElement != null) { - graphicalType = registry.getNodeGraphicalType(domainElement, containerView.getType()); - } - - IElementType elementType = (IElementType) semanticAdapter.getAdapter(IElementType.class); - if (elementType != null) { - graphicalType = registry.getNodeGraphicalType(elementType, containerView.getType()); - - } - } - return graphicalType; - } - - private String getEdgeGraphicalType(IAdaptable semanticAdapter, View containerView, String semanticHint) { - String graphicalType = null; - // Some ViewDescriptor constructors initialize unspecified semanticHint with "" - if ((semanticHint != null) && (!"".equals(semanticHint))) { - graphicalType = registry.getEdgeGraphicalType(semanticHint); - - } else { - - EObject domainElement = (EObject) semanticAdapter.getAdapter(EObject.class); - if (domainElement != null) { - graphicalType = registry.getEdgeGraphicalType(domainElement); - } - - IElementType elementType = (IElementType) semanticAdapter.getAdapter(IElementType.class); - if (elementType != null) { - graphicalType = registry.getEdgeGraphicalType(elementType); - - } - } - return graphicalType; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java deleted file mode 100644 index 948e40ffabd..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/DiagramEditorUtil.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.provider; - -import java.util.List; - -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart; -import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class DiagramEditorUtil { - - public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List<EditPart> editParts) { - diagramPart.getDiagramGraphicalViewer().deselectAll(); - - EditPart firstPrimary = null; - for (EditPart nextPart : editParts) { - diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart); - if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) { - firstPrimary = nextPart; - } - } - - if (!editParts.isEmpty()) { - diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0)); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java deleted file mode 100644 index 421bcc182e7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/ElementTypeLabelProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.provider; - -import org.eclipse.gmf.runtime.common.ui.services.icon.IconService; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; - -/** - * A label provider that provides the name and image for <code>IElementType</code> objects. - * - * @author cmahoney - */ -public class ElementTypeLabelProvider extends LabelProvider { - - /** - * Retrieves the image for <code>IElementType</code> objects using - * the <code>IconService</code>. - * - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ - @Override - public Image getImage(Object object) { - if (object instanceof IElementType) { - return IconService.getInstance().getIcon((IElementType) object); - } - return null; - } - - /** - * Uses <code>IElementType.getDisplayName()</code> for the text. - * - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ - @Override - public String getText(Object object) { - if (object instanceof IElementType) { - return ((IElementType) object).getDisplayName(); - } else { - return object.toString(); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/IGraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/IGraphicalTypeRegistry.java deleted file mode 100644 index 4f7b043b64b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/IGraphicalTypeRegistry.java +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.provider; - - -/** - * This interface provides an API for accessing the local graphical type registry. - * This registry provides a graphical type for existing model elements. - */ -public interface IGraphicalTypeRegistry extends org.eclipse.papyrus.infra.gmfdiag.common.providers.IGraphicalTypeRegistry { - - // /** Constant for undefined graphical type */ - // public static final String UNDEFINED_TYPE = "undefined_type"; - // - // /** - // * Get a valid edge graphical type for the domain element. - // * - // * @param domainElement - // * the domain element. - // * @return the domain element graphical type. - // */ - // public String getEdgeGraphicalType(EObject domainElement); - // - // /** - // * Get a valid edge graphical type for the element type. - // * - // * @param elementType - // * the element type. - // * @param containerType - // * the type of the graphical owner of the domain element. - // * @return the domain element graphical type. - // */ - // public String getEdgeGraphicalType(IElementType elementType); - // - // /** - // * Get a valid edge graphical type for the proposed type. - // * - // * @param proposedType - // * the proposed type. - // * @param containerType - // * the type of the graphical owner of the domain element. - // * @return the domain element graphical type. - // */ - // public String getEdgeGraphicalType(String proposedType); - // - // /** - // * Get a valid node graphical type for the domain element. - // * - // * @param domainElement - // * the domain element. - // * @param containerType - // * the type of the graphical owner of the domain element. - // * @return the domain element graphical type. - // */ - // public String getNodeGraphicalType(EObject domainElement, String containerType); - // - // /** - // * Get a valid node graphical type for the element type. - // * - // * @param elementType - // * the element type. - // * @param containerType - // * the type of the graphical owner of the domain element. - // * @return the domain element graphical type. - // */ - // public String getNodeGraphicalType(IElementType elementType, String containerType); - // - // /** - // * Get a valid node graphical type for the proposed type. - // * - // * @param proposedType - // * the proposed type. - // * @param containerType - // * the type of the graphical owner of the domain element. - // * @return the domain element graphical type. - // */ - // public String getNodeGraphicalType(String proposedType, String containerType); - // - // /** - // * Test if the type is a known edge graphical type in this diagram - // * - // * @param type - // * the type to test - // * @return true if the type is known - // */ - // public boolean isKnownEdgeType(String type); - // - // /** - // * Test if the type is a known node graphical type in this diagram - // * - // * @param type - // * the type to test - // * @return true if the type is known - // */ - // public boolean isKnownNodeType(String type); - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java deleted file mode 100644 index 8ad96a32158..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/MarkerNavigationProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.gmf.diagram.common.provider; - -import java.util.Arrays; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; -import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider; -import org.eclipse.papyrus.sysml.diagram.common.Activator; - -/** - * Non diagram-specific class generated by GMF Tooling. - */ -public class MarkerNavigationProvider extends AbstractModelMarkerNavigationProvider { - - public static final String MARKER_TYPE = Activator.PLUGIN_ID + ".diagnostic"; //$NON-NLS-1$ - - /** - * {@inheritDoc} - */ - @Override - protected void doGotoMarker(IMarker marker) { - String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null); - if (elementId == null || !(getEditor() instanceof DiagramEditor)) { - return; - } - DiagramEditor editor = (DiagramEditor) getEditor(); - Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry(); - EObject targetView = editor.getDiagram().eResource().getEObject(elementId); - if (targetView == null) { - return; - } - EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView); - if (targetEditPart != null) { - DiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart })); - } - } - - /** - * {@inheritDoc} - */ - public static void deleteMarkers(IResource resource) { - try { - resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO); - } catch (CoreException e) { - Activator.log.error("Failed to delete validation markers", e); //$NON-NLS-1$ - } - } - - /** - * {@inheritDoc} - */ - public static IMarker addMarker(IFile file, String elementId, String location, String message, int statusSeverity) { - IMarker marker = null; - try { - marker = file.createMarker(MARKER_TYPE); - marker.setAttribute(IMarker.MESSAGE, message); - marker.setAttribute(IMarker.LOCATION, location); - marker.setAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, elementId); - int markerSeverity = IMarker.SEVERITY_INFO; - if (statusSeverity == IStatus.WARNING) { - markerSeverity = IMarker.SEVERITY_WARNING; - } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) { - markerSeverity = IMarker.SEVERITY_ERROR; - } - marker.setAttribute(IMarker.SEVERITY, markerSeverity); - } catch (CoreException e) { - Activator.log.error("Failed to create validation marker", e); //$NON-NLS-1$ - } - return marker; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/SysMLVisualTypeProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/SysMLVisualTypeProvider.java deleted file mode 100644 index 302adcbd319..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/provider/SysMLVisualTypeProvider.java +++ /dev/null @@ -1,120 +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 org.eclipse.papyrus.gmf.diagram.common.provider; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.IHintedType; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.service.visualtype.AbstractVisualTypeProvider; -import org.eclipse.papyrus.infra.gmfdiag.common.service.visualtype.IVisualTypeProvider; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Generic visual type provider for SysML diagrams that, for the most part, delegates - * to the diagram's specific {@link IGraphicalTypeRegistry} and the {@link IVisualTypeProvider} - * of the UML diagram that it extends. - */ -public class SysMLVisualTypeProvider extends AbstractVisualTypeProvider { - - private final IGraphicalTypeRegistry types; - private final IVisualTypeProvider uml; - - /** - * Initializes me with my delegates. - * - * @param types - * the graphical type registry to which I delegate SysML-specific queries - * @param uml - * the visual type provider of the UML diagram that the SysML diagram extends - */ - protected SysMLVisualTypeProvider(IGraphicalTypeRegistry types, IVisualTypeProvider uml) { - super(); - - this.types = types; - this.uml = uml; - } - - @Override - public IElementType getElementType(Diagram diagram, String viewType) { - IElementType result = getCustomElementType(viewType); - - if ((result == null) && (viewType != null)) { - // Look for a standard SysML element type - for (Field field : SysMLElementTypes.class.getDeclaredFields()) { - if (IElementType.class.isAssignableFrom(field.getType()) && Modifier.isStatic(field.getModifiers()) && Modifier.isPublic(field.getModifiers())) { - try { - IElementType candidate = (IElementType) field.get(null); - if ((candidate instanceof IHintedType) && viewType.equals(((IHintedType) candidate).getSemanticHint())) { - result = candidate; - break; - } - } catch (Exception e) { - // Reflection problems on this class shouldn't happen - Activator.log.error(e); - } - } - } - - if (result == null) { - // Still null? Try the UML diagram - result = uml.getElementType(diagram, viewType); - } - } - - return result; - } - - /** - * Overridden by subclasses in diagrams that provide custom SysML visual element types - * in their {@code ElementTypes} enumerations. - * - * @param viewType - * the view type to look up - * @return the corresponding element type, or {@code null} if none - */ - protected IElementType getCustomElementType(String viewType) { - return null; - } - - @Override - public String getNodeType(View parentView, EObject element) { - String result = types.getNodeGraphicalType(element, parentView.getType()); - - if (result == null) { - // Try the UML diagram - result = uml.getNodeType(parentView, element); - } - - return result; - } - - @Override - public String getLinkType(Diagram diagram, EObject element) { - String result = types.getEdgeGraphicalType(element); - - if (result == null) { - // Try the UML diagram - result = uml.getLinkType(diagram, element); - } - - return result; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/ConstraintExtendedDirectEditionDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/ConstraintExtendedDirectEditionDialog.java deleted file mode 100644 index 828b17e4c63..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/ConstraintExtendedDirectEditionDialog.java +++ /dev/null @@ -1,29 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.swt.widgets.Shell; - -public class ConstraintExtendedDirectEditionDialog extends ExtendedDirectEditionDialog { - - public ConstraintExtendedDirectEditionDialog(Shell parentShell, - Object object, String initialValue, - IDirectEditorConfiguration configuration) { - super(parentShell, object, initialValue, configuration); - this.title = "Edit Constraint specification"; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java deleted file mode 100644 index 149116b6c6d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java +++ /dev/null @@ -1,91 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils; -import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectActorPartTypeDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * This command factory provides a command that enable ActorPart type to be selected or created during creation. - */ -public class CreateActorPartWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory { - - /** - * {@inheritDoc} - */ - @Override - public ICommand create(ConfigureRequest request) { - - ICommand configureCommand = null; - - Shell shell = Display.getDefault().getActiveShell(); - // Start dialog to identify the new part type - Property part = (Property) request.getElementToConfigure(); - Package partPkg = part.getNearestPackage(); - - CreateOrSelectActorPartTypeDialog dialog = new CreateOrSelectActorPartTypeDialog(shell, partPkg); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - - final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand(); - final Type actorPartType = (Type) dialog.getExistingType(); - - // Abort if type creation command exists but is not executable - if ((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) { - return cancelCommand(request); - } else { - configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand); - } - - // Create the configure command that will set the ActorPart type - ICommand setTypeCommand = new ConfigureElementCommand(request) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - Property actorPart = (Property) getElementToEdit(); - if (actorPartType != null) { - actorPart.setType(actorPartType); - } else { - Type newType = (Type) GMFCommandUtils.getCommandEObjectResult(typeCreationCommand); - actorPart.setType(newType); - } - - return CommandResult.newOKCommandResult(actorPart); - } - - }; - - configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand); - return configureCommand; - } - - return cancelCommand(request); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java deleted file mode 100644 index 27fa06ed5f1..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java +++ /dev/null @@ -1,111 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils; -import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectConstraintPropertyTypeDialog; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * This command factory provides a command that enable Part type to be selected or created during creation. - */ -public class CreateConstraintPropertyWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory { - - /** - * {@inheritDoc} - */ - @Override - public ICommand create(ConfigureRequest request) { - - ICommand configureCommand = null; - - Shell shell = Display.getDefault().getActiveShell(); - // Start dialog to identify the new part type - Property part = (Property) request.getElementToConfigure(); - Package partPkg = part.getNearestPackage(); - - CreateOrSelectConstraintPropertyTypeDialog dialog = new CreateOrSelectConstraintPropertyTypeDialog(shell, partPkg); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - - final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand(); - final Type partType = (Type) dialog.getExistingType(); - - // Abort if type creation command exists but is not executable - if ((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) { - return cancelCommand(request); - } else { - configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand); - } - - // Create the configure command that will set the constraint property type - ICommand setTypeCommand = new ConfigureElementCommand(request) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - Property part = (Property) getElementToEdit(); - if (partType != null) { - part.setType(partType); - } else { - Type newType = (Type) GMFCommandUtils.getCommandEObjectResult(typeCreationCommand); - createConstraintBlockConstraint(newType, monitor, info); - part.setType(newType); - } - return CommandResult.newOKCommandResult(part); - } - - private void createConstraintBlockConstraint(Type newType, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - // Create the constraint attached to the ConstraintBlock - IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newType); - if (commandService != null) { - CreateElementRequest createTypeRequest = new CreateElementRequest(newType, UMLElementTypes.CONSTRAINT); - createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, - new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newType.getName() + "Specification")); - ICommand newConstraintCreateCommand = commandService.getEditCommand(createTypeRequest); - if (newConstraintCreateCommand.canExecute()) { - newConstraintCreateCommand.execute(monitor, info); - } - } - } - }; - - configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand); - return configureCommand; - } - - return cancelCommand(request); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java.rej b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java.rej deleted file mode 100644 index b38fb2c614a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateConstraintPropertyWithTypeConfigureCommandFactory.java.rej +++ /dev/null @@ -1,30 +0,0 @@ -@@ -105,29 +99,6 @@ - ICommand newConstraintCreateCommand = commandService.getEditCommand(createTypeRequest); - if (newConstraintCreateCommand.canExecute()) { - newConstraintCreateCommand.execute(monitor, info); -- Object newObject = newConstraintCreateCommand.getCommandResult().getReturnValue(); -- // Create the constraint specification -- if (newObject instanceof EObject) { -- final EObject newElement = (EObject)newObject; -- final IDirectEditorConfiguration configuration = initExtendedEditorConfiguration(newElement); -- try { -- Dialog dialog = new ConstraintExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), newElement, configuration.getTextToEdit(newElement), configuration); -- final Dialog finalDialog = dialog; -- if(Window.OK == dialog.open()) { -- TransactionalEditingDomain domain = getEditingDomain(); -- RecordingCommand command = new RecordingCommand(domain, "Edit Constraint specification") { -- @Override -- protected void doExecute() { -- configuration.postEditAction(newElement, ((ILabelEditorDialog)finalDialog).getValue()); -- } -- }; -- domain.getCommandStack().execute(command); -- } -- } catch (Exception e) { -- Activator.log.error("Problem during editing Constaint", e); -- } -- } -- - } - } - } diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java deleted file mode 100644 index afb8cff0a8f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateFlowPortWithFlowSpecificationConfigureCommandFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils; -import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectNonAtomicFlowPortTypeDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.Type; - -/** - * This command factory provides a command that enable FlowPort type (FlowSpecification) to be selected or created during creation. - */ -public class CreateFlowPortWithFlowSpecificationConfigureCommandFactory extends AbstractConfigureCommandFactory { - - /** - * {@inheritDoc} - */ - @Override - public ICommand create(ConfigureRequest request) { - - ICommand configureCommand = null; - - Shell shell = Display.getDefault().getActiveShell(); - // Start dialog to identify the new port type - Port port = (Port) request.getElementToConfigure(); - Package partPkg = port.getNearestPackage(); - - CreateOrSelectNonAtomicFlowPortTypeDialog dialog = new CreateOrSelectNonAtomicFlowPortTypeDialog(shell, partPkg); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - - final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand(); - final Type portType = (Type) dialog.getExistingType(); - - // Abort if type creation command exists but is not executable - if ((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) { - return cancelCommand(request); - } else { - configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand); - } - - // Create the configure command that will set the part type - ICommand setTypeCommand = new ConfigureElementCommand(request) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - Port port = (Port) getElementToEdit(); - if (portType != null) { - port.setType(portType); - } else { - Type newType = (Type) GMFCommandUtils.getCommandEObjectResult(typeCreationCommand); - port.setType(newType); - } - return CommandResult.newOKCommandResult(port); - } - - }; - - configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand); - return configureCommand; - } - - return cancelCommand(request); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java deleted file mode 100644 index f0d0c85cdbe..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreatePartWithTypeConfigureCommandFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils; -import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectBlockPropertyTypeDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * This command factory provides a command that enable Part type to be selected or created during creation. - */ -public class CreatePartWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory { - - /** - * {@inheritDoc} - */ - @Override - public ICommand create(ConfigureRequest request) { - - ICommand configureCommand = null; - - Shell shell = Display.getDefault().getActiveShell(); - // Start dialog to identify the new part type - Property part = (Property) request.getElementToConfigure(); - Package partPkg = part.getNearestPackage(); - - CreateOrSelectBlockPropertyTypeDialog dialog = new CreateOrSelectBlockPropertyTypeDialog(shell, partPkg); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - - final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand(); - final Type partType = (Type) dialog.getExistingType(); - - // Abort if type creation command exists but is not executable - if ((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) { - return cancelCommand(request); - } else { - configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand); - } - - // Create the configure command that will set the part type - ICommand setTypeCommand = new ConfigureElementCommand(request) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - Property part = (Property) getElementToEdit(); - if (partType != null) { - part.setType(partType); - } else { - Type newType = (Type) GMFCommandUtils.getCommandEObjectResult(typeCreationCommand); - part.setType(newType); - } - return CommandResult.newOKCommandResult(part); - } - - }; - - configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand); - return configureCommand; - } - - return cancelCommand(request); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java deleted file mode 100644 index 646689f789a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateReferenceWithTypeConfigureCommandFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils; -import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectBlockPropertyTypeDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * This command factory provides a command that enable Reference type to be selected or created during creation. - */ -public class CreateReferenceWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory { - - /** - * {@inheritDoc} - */ - @Override - public ICommand create(ConfigureRequest request) { - - ICommand configureCommand = null; - - Shell shell = Display.getDefault().getActiveShell(); - // Start dialog to identify the new part type - Property part = (Property) request.getElementToConfigure(); - Package partPkg = part.getNearestPackage(); - - CreateOrSelectBlockPropertyTypeDialog dialog = new CreateOrSelectBlockPropertyTypeDialog(shell, partPkg); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - - final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand(); - final Type partType = (Type) dialog.getExistingType(); - - // Abort if type creation command exists but is not executable - if ((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) { - return cancelCommand(request); - } else { - configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand); - } - - // Create the configure command that will set the part type - ICommand setTypeCommand = new ConfigureElementCommand(request) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - Property part = (Property) getElementToEdit(); - if (partType != null) { - part.setType(partType); - } else { - Type newType = (Type) GMFCommandUtils.getCommandEObjectResult(typeCreationCommand); - part.setType(newType); - } - return CommandResult.newOKCommandResult(part); - } - - }; - - configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand); - return configureCommand; - } - - return cancelCommand(request); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java deleted file mode 100644 index 46a2c3db47c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateValueWithTypeConfigureCommandFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils; -import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectValuePropertyTypeDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * This command factory provides a command that enable Value type to be selected or created during creation. - */ -public class CreateValueWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory { - - /** - * {@inheritDoc} - */ - @Override - public ICommand create(ConfigureRequest request) { - - ICommand configureCommand = null; - - Shell shell = Display.getDefault().getActiveShell(); - // Start dialog to identify the new part type - Property part = (Property) request.getElementToConfigure(); - Package partPkg = part.getNearestPackage(); - - CreateOrSelectValuePropertyTypeDialog dialog = new CreateOrSelectValuePropertyTypeDialog(shell, partPkg); - dialog.open(); - if (dialog.getReturnCode() == Window.OK) { - - final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand(); - final Type partType = (Type) dialog.getExistingType(); - - // Abort if type creation command exists but is not executable - if ((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) { - return cancelCommand(request); - } else { - configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand); - } - - // Create the configure command that will set the part type - ICommand setTypeCommand = new ConfigureElementCommand(request) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - - Property part = (Property) getElementToEdit(); - if (partType != null) { - part.setType(partType); - } else { - Type newType = (Type) GMFCommandUtils.getCommandEObjectResult(typeCreationCommand); - part.setType(newType); - } - return CommandResult.newOKCommandResult(part); - } - - }; - - configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand); - return configureCommand; - } - - return cancelCommand(request); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java deleted file mode 100644 index 8e0340d194b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.dialogs; - -import org.eclipse.papyrus.sysml.diagram.common.messages.Messages; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Dialog for initialization of ActorPart (Property) type (the type is either selected or created). - */ -public class CreateOrSelectActorPartTypeDialog extends CreateOrSelectTypeDialog { - - /** Constructor */ - public CreateOrSelectActorPartTypeDialog(Shell shell, NamedElement owner) { - super(shell, owner, UMLElementTypes.ACTOR, UMLPackage.eINSTANCE.getTypedElement_Type(), UMLPackage.eINSTANCE.getActor(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null); - } - - /** - * {@inheritDoc} - */ - @Override - protected String getDialogTitle() { - return Messages.CreateOrSelectActorPartTypeDialog_DialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionTitle() { - return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionRadioLabel() { - return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionTitle() { - return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionRadioLabel() { - return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeNameLabel() { - return Messages.CreateOrSelectActorPartTypeDialog_NewTypeNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerNameLabel() { - return Messages.CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogTitle() { - return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogMessage() { - return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogTitle() { - return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogMessage() { - return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java deleted file mode 100644 index a7a541d4415..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectBlockPropertyTypeDialog.java +++ /dev/null @@ -1,142 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.dialogs; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.papyrus.sysml.blocks.BlocksPackage; -import org.eclipse.papyrus.sysml.diagram.common.messages.Messages; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.sysml.util.SysmlResource; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.Stereotype; -import org.eclipse.uml2.uml.UMLFactory; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Dialog for initialization of Part (Property) type (the type is either selected or created). - */ -public class CreateOrSelectBlockPropertyTypeDialog extends CreateOrSelectTypeDialog { - - /** Constructor */ - public CreateOrSelectBlockPropertyTypeDialog(Shell shell, NamedElement owner) { - super(shell, owner, SysMLElementTypes.BLOCK, UMLPackage.eINSTANCE.getTypedElement_Type(), BlocksPackage.eINSTANCE.getBlock(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null, getConstraintBlockAsStereotype()); - } - - /** - * If we create a Part type by a ConstraintBlock, thisPart will become a ConstraintProperty and representation will immediately disappear. - * So we filter ConstraintBlock type => Only strict Block are allowed - * - * @return - */ - @SuppressWarnings("deprecation") - private static List<?> getConstraintBlockAsStereotype() { - // We create a mock Stereotype to pass in the good code section of SemanticUMLContentProvider.isCompatibleMetaclass (bad gestion of static stereotypes) - Stereotype mockStereotype = UMLFactory.eINSTANCE.createStereotype(); - // We use this stereotype with namespace instead of ConstraintsPackage.eINSTANCE.getConstraintBlock() - mockStereotype.setName(SysmlResource.CONSTRAINT_BLOCK_ID); - return Arrays.asList(mockStereotype); - } - - /** - * {@inheritDoc} - */ - @Override - protected String getDialogTitle() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_DialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionTitle() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectionSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionRadioLabel() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectionSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionTitle() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_CreationSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionRadioLabel() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_CreationSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeNameLabel() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_NewTypeNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerNameLabel() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_NewTypeContainerNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogTitle() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogMessage() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogTitle() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogMessage() { - return Messages.CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectConstraintPropertyTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectConstraintPropertyTypeDialog.java deleted file mode 100644 index 48f950103ee..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectConstraintPropertyTypeDialog.java +++ /dev/null @@ -1,122 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.dialogs; - -import org.eclipse.papyrus.sysml.constraints.ConstraintsPackage; -import org.eclipse.papyrus.sysml.diagram.common.messages.Messages; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Dialog for initialization of Part (Property) type (the type is either selected or created). - */ -public class CreateOrSelectConstraintPropertyTypeDialog extends CreateOrSelectTypeDialog { - - /** Constructor */ - public CreateOrSelectConstraintPropertyTypeDialog(Shell shell, NamedElement owner) { - super(shell, owner, SysMLElementTypes.CONSTRAINT_BLOCK, UMLPackage.eINSTANCE.getTypedElement_Type(), ConstraintsPackage.eINSTANCE.getConstraintBlock(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null); - } - - /** - * {@inheritDoc} - */ - @Override - protected String getDialogTitle() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_DialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionTitle() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionRadioLabel() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionTitle() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_CreationSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionRadioLabel() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_CreationSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeNameLabel() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_NewTypeNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerNameLabel() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_NewTypeContainerNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogTitle() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogMessage() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogMessage; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogTitle() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogMessage() { - return Messages.CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogMessage; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java deleted file mode 100644 index 50fa0e189d7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectNonAtomicFlowPortTypeDialog.java +++ /dev/null @@ -1,121 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.dialogs; - -import org.eclipse.papyrus.sysml.diagram.common.messages.Messages; -import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Dialog for initialization of non atomic FlowPort type (the type is a FlowSpecification either selected or created). - */ -public class CreateOrSelectNonAtomicFlowPortTypeDialog extends CreateOrSelectTypeDialog { - - /** Constructor */ - public CreateOrSelectNonAtomicFlowPortTypeDialog(Shell shell, NamedElement owner) { - super(shell, owner, SysMLElementTypes.FLOW_SPECIFICATION, UMLPackage.eINSTANCE.getTypedElement_Type(), PortandflowsPackage.eINSTANCE.getFlowSpecification(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null); - } - - /** - * {@inheritDoc} - */ - @Override - protected String getDialogTitle() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_DialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionTitle() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionRadioLabel() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionTitle() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionRadioLabel() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeNameLabel() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerNameLabel() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeContainerNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogTitle() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogMessage() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogMessage; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogTitle() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogMessage() { - return Messages.CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogMessage; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java deleted file mode 100644 index 79a4e924431..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectTypeDialog.java +++ /dev/null @@ -1,630 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.dialogs; - -import java.util.LinkedList; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.sysml.diagram.common.messages.Messages; -import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider; -import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.FormDialog; -import org.eclipse.ui.forms.IManagedForm; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.ScrolledForm; -import org.eclipse.ui.forms.widgets.Section; -import org.eclipse.uml2.uml.Namespace; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Dialog for initialization of Property type (the type is either selected or created). - */ -public class CreateOrSelectTypeDialog extends FormDialog { - - protected Button creationRadio; - - protected Button selectionRadio; - - protected Text newTypeNameText; - - protected Text newTypeContainerNameText; - - protected Button newTypeContainerButton; - - protected String newTypeName = null; - - protected ICommand newTypeCreateCommand = null; - - protected EObject newTypeContainer = null; - - protected Text existingTypeNameText; - - protected Button existingTypeButton; - - protected EObject existingType = null; - - protected EObject defaultContainer; - - protected ILabelProvider labelProvider; - - protected IElementType elementType; - - protected EStructuralFeature editedFeature; - - protected EClass elementEClass; - - protected IElementType containerType; - - protected EStructuralFeature containerFeature; - - protected EClass containerEClass; - - protected List<?> notWantedMetaclasses; - - /** - * Create a new dialog to initialize an ActivityParameterNode. - * - * @param shell - * parent shell - * @param owner - * the activity that owns the action - */ - public CreateOrSelectTypeDialog(Shell shell, EObject defaultContainer, IElementType elementType, EStructuralFeature editedFeature, EClass elementEClass, IElementType containerType, EStructuralFeature containerFeature, EClass containerEClass) { - super(shell); - this.defaultContainer = defaultContainer; - this.elementType = elementType; - this.editedFeature = editedFeature; - this.elementEClass = elementEClass; - this.containerType = containerType; - this.containerFeature = containerFeature; - this.containerEClass = containerEClass; - this.labelProvider = new UMLLabelProvider(); - this.notWantedMetaclasses = new LinkedList<Object>(); - } - - /** - * Create a new dialog to initialize an ActivityParameterNode. - * This dialog will filter certain Stereotypes - * - * @param shell - * parent shell - * @param owner - * the activity that owns the action - */ - public CreateOrSelectTypeDialog(Shell shell, EObject defaultContainer, IElementType elementType, EStructuralFeature editedFeature, EClass elementEClass, IElementType containerType, EStructuralFeature containerFeature, EClass containerEClass, - List<?> notWantedMetaclasses) { - this(shell, defaultContainer, elementType, editedFeature, elementEClass, containerType, containerFeature, containerEClass); - this.notWantedMetaclasses = notWantedMetaclasses; - } - - protected String getDialogTitle() { - return Messages.CreateOrSelectTypeDialog_DialogTitle; - } - - protected String getSelectionSectionTitle() { - return Messages.CreateOrSelectTypeDialog_SelectionSectionTitle; - } - - protected String getSelectionSectionRadioLabel() { - return Messages.CreateOrSelectTypeDialog_SelectionSectionRadioLabel; - } - - protected String getCreationSectionTitle() { - return Messages.CreateOrSelectTypeDialog_CreationSectionTitle; - } - - protected String getCreationSectionRadioLabel() { - return Messages.CreateOrSelectTypeDialog_CreationSectionRadioLabel; - } - - protected String getNewTypeNameLabel() { - return Messages.CreateOrSelectTypeDialog_NewTypeNameLabel; - } - - protected String getNewTypeContainerNameLabel() { - return Messages.CreateOrSelectTypeDialog_NewTypeContainerNameLabel; - } - - protected String getNewTypeContainerDialogTitle() { - return Messages.CreateOrSelectTypeDialog_SelectNewTypeContainerDialogTitle; - } - - protected String getNewTypeContainerDialogMessage() { - return Messages.CreateOrSelectTypeDialog_SelectNewTypeContainerDialogMessage; - } - - protected String getTypeDialogTitle() { - return Messages.CreateOrSelectTypeDialog_SelectTypeDialogTitle; - } - - protected String getTypeDialogMessage() { - return Messages.CreateOrSelectTypeDialog_SelectTypeDialogMessage; - } - - /** - * Create the form to : - * - * - ask the user to choose or create an existing element. - * - * @see org.eclipse.ui.forms.FormDialog#createFormContent(org.eclipse.ui.forms.IManagedForm) - */ - @Override - protected void createFormContent(IManagedForm pForm) { - pForm.getForm().setText(getDialogTitle()); - ScrolledForm scrolledForm = pForm.getForm(); - FormToolkit toolkit = pForm.getToolkit(); - Composite parent = scrolledForm.getBody(); - parent.setLayout(new GridLayout()); - - createFormCreationSection(scrolledForm.getBody(), toolkit); - createFormSelectionSection(scrolledForm.getBody(), toolkit); - - refreshSectionsEnable(false); - hookListeners(); - // invoked name is set after listeners, since we count on listener to update it properly - setNewTypeContainer(defaultContainer); - setNewTypeName(null); - - scrolledForm.reflow(true); - } - - /** - * Adds buttons to this dialog's button bar. - * - * @param parent - * the button bar composite - */ - @Override - protected void createButtonsForButtonBar(Composite parent) { - super.createButtonsForButtonBar(parent); - refreshOkButton(); - } - - /** - * Create the section to ask the user to choose an existing element. - * - * @param pParent - * the section's parent widget - * @param pToolkit - * the form toolkit - */ - protected void createFormSelectionSection(Composite pParent, FormToolkit pToolkit) { - // create the section - String lSectionTitle = getSelectionSectionTitle(); - Section lSection = pToolkit.createSection(pParent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR); - lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - if (lSectionTitle != null) { - lSection.setText(lSectionTitle); - } - - ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection); - lInsideScrolledForm.setExpandHorizontal(true); - lInsideScrolledForm.setExpandVertical(true); - Composite lBody = lInsideScrolledForm.getBody(); - - GridLayout lLayout = new GridLayout(); - lLayout.numColumns = 3; - lBody.setLayout(lLayout); - - // content of the section - selectionRadio = pToolkit.createButton(lBody, getSelectionSectionRadioLabel(), SWT.RADIO); - selectionRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); - - // manage elementType selection - pToolkit.createLabel(lBody, elementType.getDisplayName(), SWT.NONE); - existingTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER | SWT.READ_ONLY); - existingTypeNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - existingTypeButton = pToolkit.createButton(lBody, "...", SWT.FLAT); - - Image image = Activator.getInstance().getImage(elementType.getEClass()); - if (elementEClass != null) { - image = Activator.getInstance().getImage(elementEClass); - } - - existingTypeButton.setImage(image); - existingTypeButton.setLayoutData(new GridData(SWT.NONE)); - - lInsideScrolledForm.reflow(true); - lSection.setClient(lInsideScrolledForm); - } - - /** - * Create the section to ask the user to create an invoked element. - * - * @param pParent - * the section's parent widget - * @param pToolkit - * the form toolkit - */ - protected void createFormCreationSection(Composite pParent, FormToolkit pToolkit) { - // create the section - String lSectionTitle = getCreationSectionTitle(); - Section lSection = pToolkit.createSection(pParent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR); - lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - if (lSectionTitle != null) { - lSection.setText(lSectionTitle); - } - - ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection); - lInsideScrolledForm.setExpandHorizontal(true); - lInsideScrolledForm.setExpandVertical(true); - Composite lBody = lInsideScrolledForm.getBody(); - - GridLayout lLayout = new GridLayout(); - lLayout.numColumns = 3; - lBody.setLayout(lLayout); - - // content of the section - creationRadio = pToolkit.createButton(lBody, getCreationSectionRadioLabel(), SWT.RADIO); - creationRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); - - pToolkit.createLabel(lBody, getNewTypeNameLabel(), SWT.NONE); - newTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER); - newTypeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); - newTypeNameText.setFocus(); - - // manage type selection - pToolkit.createLabel(lBody, getNewTypeContainerNameLabel(), SWT.NONE); - newTypeContainerNameText = pToolkit.createText(lBody, labelProvider.getText(newTypeContainer), SWT.BORDER | SWT.READ_ONLY); - newTypeContainerNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - newTypeContainerButton = pToolkit.createButton(lBody, "...", SWT.FLAT); - Image image = Activator.getInstance().getImage(containerType.getEClass()); - if (containerEClass != null) { - image = Activator.getInstance().getImage(containerEClass); - } - newTypeContainerButton.setImage(image); - newTypeContainerButton.setLayoutData(new GridData(SWT.NONE)); - - lInsideScrolledForm.reflow(true); - lSection.setClient(lInsideScrolledForm); - } - - - @Override - protected void okPressed() { - - // Build type creation command if needed - boolean isSelectionMode = selectionRadio.getSelection(); - if (!isSelectionMode) { - // Creation mode - Prepare type creation command and set existing type to null. - existingType = null; - buildNewTypeCreateCommand(); - - } else { - // Selection mode - Set the type creation command to null. - newTypeCreateCommand = null; - } - - super.okPressed(); - } - - protected void buildNewTypeCreateCommand() { - // The new element is expected to be a NamedElement. - IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newTypeContainer); - if (commandService != null) { - CreateElementRequest createTypeRequest = new CreateElementRequest(newTypeContainer, elementType); - createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newTypeNameText.getText())); - newTypeCreateCommand = commandService.getEditCommand(createTypeRequest); - } - } - - public ICommand getNewTypeCreateCommand() { - return newTypeCreateCommand; - } - - public String getNewTypeName() { - return newTypeNameText.getText(); - } - - public EObject getExistingType() { - return existingType; - } - - /** - * Add listeners to widgets - */ - protected void hookListeners() { - // listener to choose active section - SelectionListener selectCreateListener = new SelectionAdapter() { - - /** - * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - @Override - public void widgetSelected(SelectionEvent e) { - if (creationRadio.equals(e.getSource())) { - refreshSectionsEnable(false); - } else { - refreshSectionsEnable(true); - } - refreshOkButton(); - } - }; - selectionRadio.addSelectionListener(selectCreateListener); - creationRadio.addSelectionListener(selectCreateListener); - - // listener to select existing element - SelectionListener selectBtnListener = new SelectionAdapter() { - - /** - * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - @Override - public void widgetSelected(SelectionEvent e) { - handleChooseType(); - refreshOkButton(); - } - }; - existingTypeButton.addSelectionListener(selectBtnListener); - - // listener to existing element name - ModifyListener lNameListener = new ModifyListener() { - - /** - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - @Override - public void modifyText(ModifyEvent e) { - setNewTypeName(existingTypeNameText.getText()); - } - }; - existingTypeNameText.addModifyListener(lNameListener); - - // listener to select new element type container - SelectionListener selectTypeBtnListener = new SelectionAdapter() { - - /** - * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) - */ - @Override - public void widgetSelected(SelectionEvent e) { - handleChooseNewTypeContainer(); - // reset name if not set - if (newTypeName == null) { - setNewTypeName(null); - } - refreshOkButton(); - } - }; - newTypeContainerButton.addSelectionListener(selectTypeBtnListener); - - // listener to new element name - ModifyListener lNewNameListener = new ModifyListener() { - - /** - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - @Override - public void modifyText(ModifyEvent e) { - validateNewTypeName(); - refreshOkButton(); - } - }; - newTypeNameText.addModifyListener(lNewNameListener); - } - - /** - * Set the name of the new type - * - * @param text - * the text string or null for auto-initialization - */ - protected void setNewTypeName(String text) { - String name = text; - if (text == null) { - name = NamedElementUtil.getDefaultNameWithIncrementFromBase(elementType.getEClass().getName(), newTypeContainer.eContents()); - if (elementEClass != null) { - name = NamedElementUtil.getDefaultNameWithIncrementFromBase(elementEClass.getName(), newTypeContainer.eContents()); - } - newTypeNameText.setText(name); - - } else { - newTypeNameText.setText(name); - newTypeName = name; - } - - validateNewTypeName(); - refreshOkButton(); - } - - protected void validateNewTypeName() { - if (isValidName(newTypeContainer, newTypeNameText.getText())) { - Color black = newTypeNameText.getDisplay().getSystemColor(SWT.COLOR_BLACK); - newTypeNameText.setForeground(black); - - } else { - Color red = newTypeNameText.getDisplay().getSystemColor(SWT.COLOR_RED); - newTypeNameText.setForeground(red); - } - } - - protected boolean isValidName(EObject container, String newName) { - boolean isValid = true; - if (container instanceof Namespace) { - if (((Namespace) container).getOwnedMember(newName) != null) { - isValid = false; - } - } - - return isValid; - } - - /** Open the dialog to choose an existing type */ - protected void handleChooseType() { - - TreeSelectorDialog dialog = new TreeSelectorDialog(getShell()); - - dialog.setMessage(getTypeDialogMessage()); - dialog.setTitle(getTypeDialogTitle()); - dialog.setInput(EcoreUtil.getRootContainer(defaultContainer)); - - ServiceEditContentProvider provider = new ServiceEditContentProvider(elementType, editedFeature, EcoreUtil.getRootContainer(defaultContainer)); - provider.setNotWantedMetaclasses(notWantedMetaclasses); - - dialog.setContentProvider(provider); - dialog.setLabelProvider(labelProvider); - - if (dialog.open() == Window.OK) { - Object result = dialog.getResult()[0]; - if (result instanceof IAdaptable) { - result = EMFHelper.getEObject(result); - } - - if (result instanceof EObject) { - setExistingTypeSelection((EObject) result); - } else { - setExistingTypeSelection(null); - } - } - } - - /** - * Set the existing type selected (if selection mode is chosen) - * - * @param invokedElement - * the selected element - */ - protected void setExistingTypeSelection(EObject type) { - if (type == null) { - existingTypeNameText.setText(""); - } else { - existingType = type; - existingTypeNameText.setText(labelProvider.getText(existingType)); - } - } - - /** Open the dialog to choose new type container */ - protected void handleChooseNewTypeContainer() { - - TreeSelectorDialog dialog = new TreeSelectorDialog(getShell()); - - dialog.setMessage(getNewTypeContainerDialogMessage()); - dialog.setTitle(getNewTypeContainerDialogTitle()); - dialog.setInput(EcoreUtil.getRootContainer(defaultContainer)); - - ServiceEditContentProvider provider = new ServiceEditContentProvider(containerType, containerFeature, EcoreUtil.getRootContainer(defaultContainer)); - dialog.setContentProvider(provider); - dialog.setLabelProvider(labelProvider); - - if (dialog.open() == Window.OK) { - Object result = dialog.getResult()[0]; - if (result instanceof IAdaptable) { - result = EMFHelper.getEObject(result); - } - - if (result instanceof EObject) { - setNewTypeContainer((EObject) result); - } else { - setNewTypeContainer(null); - } - } - } - - /** - * Define the type of the object that will be created (if creation mode is chosen) - * - * @param the - * selected parent - */ - protected void setNewTypeContainer(EObject container) { - - if ((containerType instanceof ISpecializationType) && ((ISpecializationType) containerType).getMatcher().matches(container)) { - newTypeContainer = container; - newTypeContainerNameText.setText(labelProvider.getText(newTypeContainer)); - - } else if (containerType.getEClass().isInstance(container)) { - newTypeContainer = container; - newTypeContainerNameText.setText(labelProvider.getText(newTypeContainer)); - - } else { - newTypeContainer = null; - newTypeContainerNameText.setText(""); - } - } - - /** - * Refresh the enabled and disabled elements in various sections - * - * @param isSelectionSelected - * true if we choose to select an existing element, false if we choose to create an element - */ - private void refreshSectionsEnable(boolean isSelectionSelected) { - // handle radio button value - if (isSelectionSelected) { - creationRadio.setSelection(false); - if (!selectionRadio.getSelection()) { - selectionRadio.setSelection(true); - } - } else { - selectionRadio.setSelection(false); - if (!creationRadio.getSelection()) { - creationRadio.setSelection(true); - } - } - // handle disabled section - existingTypeNameText.setEnabled(isSelectionSelected); - existingTypeButton.setEnabled(isSelectionSelected); - newTypeNameText.setEnabled(!isSelectionSelected); - newTypeNameText.setFocus(); - newTypeContainerNameText.setEnabled(!isSelectionSelected); - newTypeContainerButton.setEnabled(!isSelectionSelected); - } - - - /** Refresh the OK button activation */ - protected void refreshOkButton() { - boolean isSelectionSelected = selectionRadio.getSelection(); - if (getButton(IDialogConstants.OK_ID) != null && !getButton(IDialogConstants.OK_ID).isDisposed()) { - if (isSelectionSelected) { - getButton(IDialogConstants.OK_ID).setEnabled(existingType != null); - } else { - getButton(IDialogConstants.OK_ID).setEnabled((newTypeContainer != null) && (isValidName(newTypeContainer, newTypeNameText.getText()))); - } - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java deleted file mode 100644 index 16503d2da56..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectValuePropertyTypeDialog.java +++ /dev/null @@ -1,286 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.dialogs; - -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.papyrus.gmf.diagram.common.provider.ElementTypeLabelProvider; -import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.sysml.blocks.BlocksPackage; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.sysml.diagram.common.messages.Messages; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.ScrolledForm; -import org.eclipse.ui.forms.widgets.Section; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Dialog for initialization of Value (Property) type (the type is either selected or created). - */ -public class CreateOrSelectValuePropertyTypeDialog extends CreateOrSelectTypeDialog { - - protected ComboViewer newTypeKindComboViewer = null; - - protected Combo newTypeKindCombo = null; - - protected IElementType[] valueTypeKind = { UMLElementTypes.DATA_TYPE, SysMLElementTypes.VALUE_TYPE, UMLElementTypes.PRIMITIVE_TYPE, UMLElementTypes.ENUMERATION }; - - protected IElementType newTypeKind = UMLElementTypes.DATA_TYPE; - - /** Constructor */ - public CreateOrSelectValuePropertyTypeDialog(Shell shell, NamedElement owner) { - super(shell, owner, UMLElementTypes.DATA_TYPE, UMLPackage.eINSTANCE.getTypedElement_Type(), null, UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createFormCreationSection(Composite pParent, FormToolkit pToolkit) { - // create the section - String lSectionTitle = getCreationSectionTitle(); - Section lSection = pToolkit.createSection(pParent, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR); - lSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - if (lSectionTitle != null) { - lSection.setText(lSectionTitle); - } - - ScrolledForm lInsideScrolledForm = pToolkit.createScrolledForm(lSection); - lInsideScrolledForm.setExpandHorizontal(true); - lInsideScrolledForm.setExpandVertical(true); - Composite lBody = lInsideScrolledForm.getBody(); - - GridLayout lLayout = new GridLayout(); - lLayout.numColumns = 3; - lBody.setLayout(lLayout); - - // content of the section - creationRadio = pToolkit.createButton(lBody, getCreationSectionRadioLabel(), SWT.RADIO); - creationRadio.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); - - pToolkit.createLabel(lBody, getNewTypeNameLabel(), SWT.NONE); - newTypeNameText = pToolkit.createText(lBody, "", SWT.BORDER); - newTypeNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); - newTypeNameText.setFocus(); - - // manage type selection - pToolkit.createLabel(lBody, getNewTypeContainerNameLabel(), SWT.NONE); - newTypeContainerNameText = pToolkit.createText(lBody, labelProvider.getText(newTypeContainer), SWT.BORDER | SWT.READ_ONLY); - newTypeContainerNameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - newTypeContainerButton = pToolkit.createButton(lBody, "...", SWT.FLAT); - Image image = Activator.getInstance().getImage(containerType.getEClass()); - if (containerEClass != null) { - image = Activator.getInstance().getImage(containerEClass); - } - newTypeContainerButton.setImage(image); - newTypeContainerButton.setLayoutData(new GridData(SWT.NONE)); - - pToolkit.createLabel(lBody, getNewTypeKindLabel(), SWT.NONE); - newTypeKindCombo = new Combo(lBody, SWT.DROP_DOWN | SWT.READ_ONLY); - newTypeKindComboViewer = new ComboViewer(newTypeKindCombo); - pToolkit.adapt(newTypeKindCombo); - newTypeKindCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); - newTypeKindComboViewer.setLabelProvider(new ElementTypeLabelProvider()); - newTypeKindComboViewer.add(valueTypeKind); - newTypeKindComboViewer.setSelection(new StructuredSelection(valueTypeKind[0])); - - lInsideScrolledForm.reflow(true); - lSection.setClient(lInsideScrolledForm); - } - - /** - * {@inheritDoc} - */ - @Override - protected void buildNewTypeCreateCommand() { - // The new element is expected to be a NamedElement. - IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(newTypeContainer); - if (commandService != null) { - CreateElementRequest createTypeRequest = new CreateElementRequest(newTypeContainer, newTypeKind); - createTypeRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), newTypeNameText.getText())); - newTypeCreateCommand = commandService.getEditCommand(createTypeRequest); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void hookListeners() { - super.hookListeners(); - - // listener to select invocation type - ModifyListener newTypeKindListener = new ModifyListener() { - - /** - * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent) - */ - @Override - public void modifyText(ModifyEvent e) { - ISelection sel = newTypeKindComboViewer.getSelection(); - if (sel instanceof StructuredSelection) { - Object type = ((StructuredSelection) sel).getFirstElement(); - if (type instanceof IElementType) { - newTypeKind = (IElementType) type; - } else { - newTypeKind = null; - } - - // reset name - setNewTypeName(null); - } - } - }; - newTypeKindCombo.addModifyListener(newTypeKindListener); - } - - /** - * {@inheritDoc} - */ - @Override - protected void setNewTypeName(String text) { - String name = text; - if (text == null) { - name = NamedElementUtil.getDefaultNameWithIncrementFromBase(newTypeKind.getEClass().getName(), newTypeContainer.eContents()); - if (newTypeKind == SysMLElementTypes.VALUE_TYPE) { - name = NamedElementUtil.getDefaultNameWithIncrementFromBase(BlocksPackage.eINSTANCE.getValueType().getName(), newTypeContainer.eContents()); - } - newTypeNameText.setText(name); - - } else { - newTypeNameText.setText(name); - newTypeName = name; - } - - validateNewTypeName(); - refreshOkButton(); - } - - /** - * {@inheritDoc} - */ - @Override - protected String getDialogTitle() { - return Messages.CreateOrSelectValuePropertyTypeDialog_DialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionTitle() { - return Messages.CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getSelectionSectionRadioLabel() { - return Messages.CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionTitle() { - return Messages.CreateOrSelectValuePropertyTypeDialog_CreationSectionTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getCreationSectionRadioLabel() { - return Messages.CreateOrSelectValuePropertyTypeDialog_CreationSectionRadioLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeNameLabel() { - return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeNameLabel; - } - - /** - * Get the newTypeKind label. - * - * @return the label - */ - protected String getNewTypeKindLabel() { - return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeKindLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerNameLabel() { - return Messages.CreateOrSelectValuePropertyTypeDialog_NewTypeContainerNameLabel; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogTitle() { - return Messages.CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getNewTypeContainerDialogMessage() { - return Messages.CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogMessage; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogTitle() { - return Messages.CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogTitle; - } - - /** - * {@inheritDoc} - */ - @Override - protected String getTypeDialogMessage() { - return Messages.CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogMessage; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java deleted file mode 100644 index 7a6975c35e0..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/ServiceEditContentProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.dialogs; - -import java.util.Collections; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.papyrus.infra.services.edit.ui.dialogs.ElementTypeValidator; -import org.eclipse.papyrus.uml.tools.providers.SemanticUMLContentProvider; - -/** - * A content provider that takes into account the nature of the searched element - * (org.eclipse.papyrus.uml.tools.providers.ServiceEditFilteredContentProvider). - */ -public class ServiceEditContentProvider extends SemanticUMLContentProvider { - - private ElementTypeValidator validator; - - public ServiceEditContentProvider(IElementType elementType, EStructuralFeature feature, EObject semanticRoot) { - super(semanticRoot.eResource().getResourceSet()); - setWantedMetaclasses(Collections.singletonList(feature.getEType())); - validator = new ElementTypeValidator(elementType); - } - - @Override - public boolean isValidValue(Object element) { - return super.isValidValue(element) && validator.validate(new Object[] { getAdaptedValue(element) }).isOK(); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/AssociationEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/AssociationEditPart.java deleted file mode 100644 index aa80e04945d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/AssociationEditPart.java +++ /dev/null @@ -1,308 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.AssociationFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLinkEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceMultiplicityEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelSourceRoleEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetMultiplicityEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AssociationLinkLabelTargetRoleEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementLinkLabelNameEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType; -import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils; -import org.eclipse.uml2.uml.AggregationKind; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Property; - -/** - * Edit Part for SysML {@link Association} - */ -public class AssociationEditPart extends AbstractElementLinkEditPart { - - protected static final String ASSOCIATION_END_LISTENERS_SOURCE = "AssociationEndListenersSource"; - - protected static final String ASSOCIATION_END_LISTENERS_TARGET = "AssociationEndListenersTarget"; - - /** - * {@inheritDoc} - */ - @Override - public void activate() { - super.activate(); - addAssociationEndListeners(); - } - - /** - * this methods add listeners on targets and sources - */ - protected void addAssociationEndListeners() { - EObject semanticElement = resolveSemanticElement(); - if (semanticElement instanceof Association) { - - Association association = (Association) semanticElement; - - if (association.getMemberEnds().size() >= 2) { - - EObject sourceEnd = AssociationViewUtils.getSourceSemanticEnd(getNotationView()); - EObject targetEnd = AssociationViewUtils.getTargetSemanticEnd(getNotationView()); - - addListenerFilter(ASSOCIATION_END_LISTENERS_SOURCE, this, sourceEnd); - addListenerFilter(ASSOCIATION_END_LISTENERS_TARGET, this, targetEnd); - - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public void deactivate() { - removeAssociationEndListeners(); - super.deactivate(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void handleNotificationEvent(Notification event) { - super.handleNotificationEvent(event); - - // Set association ends appearance (aggregation diamond, navigable arrow, etc...) - if (resolveSemanticElement() != null) { - refreshVisuals(); - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - - if (resolveSemanticElement() != null) { - if (getSource() == null || getTarget() == null) { - return; - } - if (((GraphicalEditPart) getSource()).resolveSemanticElement() == null || ((GraphicalEditPart) getTarget()).resolveSemanticElement() == null) { - return; - } - - Property source = AssociationViewUtils.getSourceSemanticEnd(getNotationView()); - Property target = AssociationViewUtils.getTargetSemanticEnd(getNotationView()); - if (source == null || target == null) { - return; - } - - // Get the association - Element umlElement = getUMLElement(); - if (umlElement instanceof Association) { - Association association = (Association) getUMLElement(); - - // Show navigable arrow if either source or target is navigable - // not when both are navigable. - if (isNavigable(association, source) && isNavigable(association, target)) { - - // No navigable mark shown on figure. - if (source.getAggregation() == AggregationKind.NONE_LITERAL) { - setArrowSource(getArrowDecoration(EdgeDecorationType.NONE)); - } - if (target.getAggregation() == AggregationKind.NONE_LITERAL) { - setArrowTarget(getArrowDecoration(EdgeDecorationType.NONE)); - } - - } else { - - if (isNavigable(association, source)) { - setArrowTarget(getArrowDecoration(EdgeDecorationType.OPEN_ARROW)); - if (source.getAggregation() == AggregationKind.NONE_LITERAL) { - setArrowSource(getArrowDecoration(EdgeDecorationType.NONE)); - } - } - - if (isNavigable(association, target)) { - setArrowSource(getArrowDecoration(EdgeDecorationType.OPEN_ARROW)); - if (target.getAggregation() == AggregationKind.NONE_LITERAL) { - setArrowTarget(getArrowDecoration(EdgeDecorationType.NONE)); - } - } - - } - - if (source.getAggregation() == AggregationKind.SHARED_LITERAL) { - setArrowSource(getArrowDecoration(EdgeDecorationType.SOLID_DIAMOND_EMPTY)); - } - if (target.getAggregation() == AggregationKind.SHARED_LITERAL) { - setArrowTarget(getArrowDecoration(EdgeDecorationType.SOLID_DIAMOND_EMPTY)); - } - - if (source.getAggregation() == AggregationKind.COMPOSITE_LITERAL) { - setArrowSource(getArrowDecoration(EdgeDecorationType.SOLID_DIAMOND_FILLED)); - } - if (target.getAggregation() == AggregationKind.COMPOSITE_LITERAL) { - setArrowTarget(getArrowDecoration(EdgeDecorationType.SOLID_DIAMOND_FILLED)); - } - - } - } - } - - /** - * SysML implementation for isNavigable. - * - * @param end - * @return - */ - private boolean isNavigable(Association association, Property end) { - boolean isNavigable = false; - - if (association.getOwnedEnds().contains(end)) { - isNavigable = false; - } else { - isNavigable = true; - } - - return isNavigable; - } - - /** - * this method is used to remove listener on ends - */ - protected void removeAssociationEndListeners() { - removeListenerFilter(ASSOCIATION_END_LISTENERS_SOURCE); - removeListenerFilter(ASSOCIATION_END_LISTENERS_TARGET); - } - - /** - * Constructor. - */ - public AssociationEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - // Start of user code custom policies - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - ((NamedElementLinkLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof AssociationLinkLabelSourceRoleEditPart) { - ((AssociationLinkLabelSourceRoleEditPart) childEditPart).setLabel(getPrimaryShape().getSourceRoleLabel()); - return true; - } - if (childEditPart instanceof AssociationLinkLabelSourceMultiplicityEditPart) { - ((AssociationLinkLabelSourceMultiplicityEditPart) childEditPart).setLabel(getPrimaryShape().getSourceMultiplicityLabel()); - return true; - } - if (childEditPart instanceof AssociationLinkLabelTargetRoleEditPart) { - ((AssociationLinkLabelTargetRoleEditPart) childEditPart).setLabel(getPrimaryShape().getTargetRoleLabel()); - return true; - } - if (childEditPart instanceof AssociationLinkLabelTargetMultiplicityEditPart) { - ((AssociationLinkLabelTargetMultiplicityEditPart) childEditPart).setLabel(getPrimaryShape().getTargetMultiplicityLabel()); - return true; - } - return super.addFixedChild(childEditPart); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - return true; - } - if (childEditPart instanceof AssociationLinkLabelSourceRoleEditPart) { - return true; - } - if (childEditPart instanceof AssociationLinkLabelSourceMultiplicityEditPart) { - return true; - } - if (childEditPart instanceof AssociationLinkLabelTargetRoleEditPart) { - return true; - } - if (childEditPart instanceof AssociationLinkLabelTargetMultiplicityEditPart) { - return true; - } - return super.removeFixedChild(childEditPart); - } - - /** - * Creates figure for this edit part. - */ - @Override - protected Connection createConnectionFigure() { - return new AssociationFigure(); - } - - /** - * Creates primary shape for this edit part. - */ - @Override - public AssociationFigure getPrimaryShape() { - return (AssociationFigure) getFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshLineType() { - setLineType(Graphics.LINE_SOLID); - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowSource() { - // Not implemented, refreshVisuals currently implements this. - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowTarget() { - // Not implemented, refreshVisuals currently implements this. - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.java deleted file mode 100644 index 55524864cc9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.java +++ /dev/null @@ -1,271 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyCompositeSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.BlockPropertyCompositeFigure; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.UMLPackage; - -public class BlockPropertyCompositeEditPart extends AbstractElementEditPart { - - public BlockPropertyCompositeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new BlockPropertyCompositeSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY, new ShowHideRelatedContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EncapsulatedClassifierResizableShapeEditPolicy()); - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { - return new BorderItemResizableEditPolicy(); - } - - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof PropertyNodeLabelEditPart) { - ((PropertyNodeLabelEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((FlowPortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((PortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - - if (childEditPart instanceof BlockPropertyStructureCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockPropertyStructureCompartmentFigure(); - setupContentPane(pane); - pane.add(((BlockPropertyStructureCompartmentEditPart) childEditPart).getFigure()); - return true; - } - - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof PropertyNodeLabelEditPart) { - return true; - } - - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((FlowPortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((PortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - - if (childEditPart instanceof BlockPropertyStructureCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockPropertyStructureCompartmentFigure(); - setupContentPane(pane); - pane.remove(((BlockPropertyStructureCompartmentEditPart) childEditPart).getFigure()); - return true; - } - - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof BlockPropertyStructureCompartmentEditPart) { - return getPrimaryShape().getBlockPropertyStructureCompartmentFigure(); - } - if (editPart instanceof IBorderItemEditPart) { - return getBorderedFigure().getBorderItemContainer(); - } - - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - - @Override - protected NodeFigure createNodeFigure() { - return new SelectableBorderedNodeFigure(createMainFigure()); - } - - @Override - protected IFigure createNodeShape() { - return primaryShape = new BlockPropertyCompositeFigure(); - } - - @Override - public BlockPropertyCompositeFigure getPrimaryShape() { - return (BlockPropertyCompositeFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID); - } - - /** - * <pre> - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void handleNotificationEvent(Notification event) { - - // A visual refresh may also be needed when the following properties are changing : aggregation, type, or the related association. - if (resolveSemanticElement() != null) { - EObject element = resolveSemanticElement(); - - if ((element != null) && (element.equals(event.getNotifier())) && (element instanceof Property)) { - - if (UMLPackage.eINSTANCE.getProperty_Aggregation().equals(event.getFeature())) { - refreshVisuals(); - } - - if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(event.getFeature())) { - refreshVisuals(); - } - - if (UMLPackage.eINSTANCE.getProperty_Association().equals(event.getFeature())) { - refreshVisuals(); - } - } - } - - super.handleNotificationEvent(event); - } - - /** - * <pre> - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - - String tag = "property"; - int borderStyle = Graphics.LINE_SOLID; - - if (resolveSemanticElement() != null) { - EObject eObject = resolveSemanticElement(); - if (((ISpecializationType) SysMLElementTypes.PART_PROPERTY).getMatcher().matches(eObject)) { - tag = "part"; - - } else if (((ISpecializationType) SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(eObject)) { - tag = "reference"; - borderStyle = Graphics.LINE_CUSTOM; - - } else if (((ISpecializationType) SysMLElementTypes.ACTOR_PART_PROPERTY).getMatcher().matches(eObject)) { - tag = "actor part"; - - } else if (((ISpecializationType) SysMLElementTypes.VALUE_PROPERTY).getMatcher().matches(eObject)) { - tag = "value"; - - } else { - // Consider the element is a Property... - } - } - - getPrimaryShape().setFigureTag(tag); - getPrimaryShape().setBorderStyle(borderStyle); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java deleted file mode 100644 index 56f04e795ad..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockPropertyCompositeEditPart.java +++ /dev/null @@ -1,291 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.StringValueStyle; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyCompositeSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.ConstraintBlockPropertyCompositeFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintNodeLabelEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.ConstraintParameterAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.locator.FullInsidePortPositionLocator; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.UMLPackage; - -public class ConstraintBlockPropertyCompositeEditPart extends AbstractElementEditPart { - - public static final String REPRESENTATION_MODE_STYLE = "representation_mode_style"; - public static final String ROUNDED_REPRESENTATION = "rounded_representation"; - public static final String SQUARE_REPRESENTATION_WITH_STRUCTURE = "square_representation_with_structure"; - - public Map<EditPart, FullInsidePortPositionLocator> constraintParameter2FullInsidePortPositionLocator = new HashMap<EditPart, FullInsidePortPositionLocator>(); - - public static String lastRepresentationKind; - - public ConstraintBlockPropertyCompositeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new BlockPropertyCompositeSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY, new ShowHideRelatedContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EncapsulatedClassifierResizableShapeEditPolicy()); - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { - return new BorderItemResizableEditPolicy(); - } - - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof PropertyNodeLabelEditPart) { - ((PropertyNodeLabelEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof ConstraintNodeLabelEditPart) { - ((ConstraintNodeLabelEditPart) childEditPart).setLabel(getPrimaryShape().getConstraintLabel()); - return true; - } - - if (childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { - FullInsidePortPositionLocator locator = new FullInsidePortPositionLocator(getMainFigure(), PositionConstants.NONE, getPrimaryShape().getCorner()); - constraintParameter2FullInsidePortPositionLocator.put(childEditPart, locator); // register the locator in order to reset the corner when changing ConstraintProeprty representation - getBorderedFigure().getBorderItemContainer().add(((ConstraintParameterAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof PropertyNodeLabelEditPart) { - return true; - } - - if (childEditPart instanceof ConstraintNodeLabelEditPart) { - return true; - } - if (childEditPart instanceof ConstraintParameterAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((ConstraintParameterAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - - return false; - } - - @Override - protected void removeChild(EditPart child) { - if (child instanceof ConstraintNodeLabelEditPart) { - return; // When hiding constraint expression, we want to keep the edit part in order to re-show it - } - super.removeChild(child); - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof IBorderItemEditPart) { - return getBorderedFigure().getBorderItemContainer(); - } - - return getContentPane(); - } - - @Override - protected NodeFigure createNodeFigure() { - return new SelectableBorderedNodeFigure(createMainFigure()); - } - - @Override - protected IFigure createNodeShape() { - if (isSquareRepresentationWithStructure()) { - primaryShape = new ConstraintBlockPropertyCompositeFigure(SQUARE_REPRESENTATION_WITH_STRUCTURE); - } - else if (isRoundedRepresentation()) { - primaryShape = new ConstraintBlockPropertyCompositeFigure(ROUNDED_REPRESENTATION); - } - else { - if (lastRepresentationIsSquareWithStructure()) { - primaryShape = new ConstraintBlockPropertyCompositeFigure(SQUARE_REPRESENTATION_WITH_STRUCTURE); - } - else { - // default - if (this.getChildViewBySemanticHint(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID) != null) { - // no style => if structure then square else rounded - primaryShape = new ConstraintBlockPropertyCompositeFigure(SQUARE_REPRESENTATION_WITH_STRUCTURE); - } - else { - primaryShape = new ConstraintBlockPropertyCompositeFigure(ROUNDED_REPRESENTATION); - } - } - } - return primaryShape; - } - - @Override - public ConstraintBlockPropertyCompositeFigure getPrimaryShape() { - return (ConstraintBlockPropertyCompositeFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID); - } - - @SuppressWarnings("rawtypes") - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - - List children = getChildren(); - for (Object editPart : children) { - if (editPart instanceof EditPart) { - ((EditPart) editPart).refresh(); - } - } - } - - public boolean isSquareRepresentationWithStructure() { - StringValueStyle style = (StringValueStyle) ((View) this.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle()); - if (style == null) { - return false; - } - return SQUARE_REPRESENTATION_WITH_STRUCTURE.equals(style.getStringValue()); - } - - public boolean isRoundedRepresentation() { - StringValueStyle style = (StringValueStyle) ((View) this.getModel()).getStyle(NotationPackage.eINSTANCE.getStringValueStyle()); - if (style == null) { - return false; - } - return ROUNDED_REPRESENTATION.equals(style.getStringValue()); - } - - /** - * <pre> - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void handleNotificationEvent(Notification event) { - - // A visual refresh may also be needed when the following properties are changing : aggregation, type, or the related association. - if (resolveSemanticElement() != null) { - EObject element = resolveSemanticElement(); - - if ((element != null) && (element.equals(event.getNotifier())) && (element instanceof Property)) { - - if (UMLPackage.eINSTANCE.getProperty_Aggregation().equals(event.getFeature())) { - refreshVisuals(); - } - - if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(event.getFeature())) { - refreshVisuals(); - } - - if (UMLPackage.eINSTANCE.getProperty_Association().equals(event.getFeature())) { - refreshVisuals(); - } - } - } - super.handleNotificationEvent(event); - refresh(); - } - - public static boolean lastRepresentationIsSquareWithStructure() { - return ConstraintBlockPropertyCompositeEditPart.SQUARE_REPRESENTATION_WITH_STRUCTURE.equals(ConstraintBlockPropertyCompositeEditPart.lastRepresentationKind); - } - - public static void setLastRepresentation(String representationKind) { - ConstraintBlockPropertyCompositeEditPart.lastRepresentationKind = representationKind; - } - - public void setCornerLocators(int corner) { - for (EditPart editPart : constraintParameter2FullInsidePortPositionLocator.keySet()) { - FullInsidePortPositionLocator locator = constraintParameter2FullInsidePortPositionLocator.get(editPart); - locator.setCorner(corner); - } - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java deleted file mode 100644 index f75e5edcfd2..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintPropertyChildLabelEditPart.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.constraints.ConstraintProperty; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart; - -/** - * Edit part for {@link ConstraintProperty} used as Child label node. - */ -public class ConstraintPropertyChildLabelEditPart extends AbstractElementChildLabelEditPart { - - /** Constructor */ - public ConstraintPropertyChildLabelEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - // /** - // * {@inheritDoc} - // */ - // @Override - // protected Image getLabelIcon() { - // EObject parserElement = getParserElement(); - // if(parserElement == null) { - // return null; - // } - // - // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - // for(View view : views) { - // if(NameLabelIconHelper.showLabelIcon(view)) { - // return Activator.getInstance().getLabelProvider().getImage(parserElement); - // } - // } - // - // return null; - // } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/CustomFlowPortAppliedStereotypeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/CustomFlowPortAppliedStereotypeEditPart.java deleted file mode 100644 index 0063f30ce2f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/CustomFlowPortAppliedStereotypeEditPart.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) 2015 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 472932 - */ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart; -import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy; - -/** - * The custom edit policy for the port applied stereotype. - */ -public class CustomFlowPortAppliedStereotypeEditPart extends PortAppliedStereotypeEditPart { - - /** - * Constructor. - * - * @param view - * The view - */ - public CustomFlowPortAppliedStereotypeEditPart(final View view) { - super(view); - } - - /** - * Redefine the refresh label to get the STEREOTYPE_LABEL_POLICY if exist and don't recalculate the text. - * - * @see org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortAppliedStereotypeEditPart#refreshLabel() - */ - @Override - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); - } - // Bug 472932 : Stereotype is always displayed - if (maskLabelPolicy == null) { - maskLabelPolicy = getEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY); - } - if (maskLabelPolicy == null) { - final View view = (View) getModel(); - if (view.isVisible()) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } else { - setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ - setLabelIconHelper(getFigure(), null); - } - } - final Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - final Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } -} - diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java deleted file mode 100644 index f21cb9de9ad..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedLabelNameEditPart.java +++ /dev/null @@ -1,126 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart; -import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.swt.graphics.Image; - -/** - * This class implements a FlowPort affixed label edit part. - */ -public class FlowPortAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart { - - /** label provider for icons */ - private final ILabelProvider labelProvider; - - /** Constructor */ - public FlowPortAffixedLabelNameEditPart(View view) { - super(view); - addSnapBackLocation(); - labelProvider = Activator.getInstance().getLabelProvider(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return constraint instanceof IBorderItemLocator ? (IBorderItemLocator) constraint : null; - } - return null; - } - - - /** - * {@inheritDoc} - */ - @Override - protected Image getLabelIcon() { - EObject parserElement = getParserElement(); - if (parserElement == null) { - return null; - } - - List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for (View view : views) { - if (AppearanceHelper.showElementIcon(view)) { - return labelProvider.getImage(parserElement); - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - protected IFigure createFigurePrim() { - return new PapyrusWrappingLabel(); - } - - - /** - * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart#getDefaultTextAlignment() - * - * @return - */ - @Override - protected int getDefaultTextAlignment() { - return PositionConstants.LEFT; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Label"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedNodeEditPart.java deleted file mode 100644 index ce77cd91c3b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortAffixedNodeEditPart.java +++ /dev/null @@ -1,336 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LayoutListener; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.ExternalLabelPrimaryDragRoleEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.sysml.diagram.common.figure.FlowPortFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.sysml.portandflows.FlowPort; -import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementBorderEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeIconlDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure; -import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * This class implements an edit part for FlowPort represented as border items. - */ -public class FlowPortAffixedNodeEditPart extends AbstractElementBorderEditPart { - - private LayoutListener.Stub layoutInitializationListener; - - public FlowPortAffixedNodeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeIconlDisplayEditPolicy() { - - /** - * <pre> - * {@inheritDoc} - * - * This modifies the edit policy in order to call refreshVisuals() whenever the stereotype image to show is null. - * (required to show the FlowPort default image correctly). - * </pre> - */ - @Override - protected void refreshStereotypeDisplay() { - if (getHost() instanceof IPapyrusEditPart) { - IFigure figure = ((IPapyrusEditPart) getHost()).getPrimaryShape(); - - if ((figure instanceof IPapyrusUMLElementFigure) && (stereotypeIconToDisplay() != null)) { - ((IPapyrusUMLElementFigure) figure).setStereotypeDisplay(null, stereotypeIconToDisplay()); - } else { - refreshVisuals(); - } - } - } - - }); - - installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { // External labels - return new ExternalLabelPrimaryDragRoleEditPolicy() { - - @Override - @SuppressWarnings("rawtypes") - protected List createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - }; - } - - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - return; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID); - } - - @Override - protected void addSemanticListeners() { - - if (resolveSemanticElement() != null) { - - FlowPort flowPort = UMLUtil.getStereotypeApplication((Element) resolveSemanticElement(), FlowPort.class); - if (flowPort != null) { - addListenerFilter("FlowPort", this, flowPort); //$NON-NLS-1$ - } - } - - super.addSemanticListeners(); - } - - @Override - protected void removeSemanticListeners() { - removeListenerFilter("FlowPort"); //$NON-NLS-1$ - super.removeSemanticListeners(); - } - - /** - * <pre> - * Calls the figure refresh when a change event is detected on - * UMLPackage.eINSTANCE.getProperty_Aggregation(). - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void handleNotificationEvent(Notification event) { - - // When the flow port position changes, its position on parent side may change and requires a visual refresh. - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { - refreshVisuals(); - } - - // A visual refresh may also be needed when the following properties are changing : isAtomic (depend on the type), direction, isConjugated. - if (resolveSemanticElement() != null) { - Element element = (Element) resolveSemanticElement(); - FlowPort flowPort = UMLUtil.getStereotypeApplication(element, FlowPort.class); - - if ((flowPort != null) && (flowPort.equals(event.getNotifier()))) { - if (PortandflowsPackage.eINSTANCE.getFlowPort_Direction().equals(event.getFeature()) - // || PortandflowsPackage.eINSTANCE.getFlowPort_IsAtomic().equals(event.getFeature()) - || PortandflowsPackage.eINSTANCE.getFlowPort_IsConjugated().equals(event.getFeature())) { - refreshVisuals(); - } - } - - // IsAtomic change is triggered by a type change - if (resolveSemanticElement().equals(event.getNotifier())) { - if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(event.getFeature())) { - refreshVisuals(); - } - } - } - - super.handleNotificationEvent(event); - } - - /** - * {@inheritDoc} - */ - @Override - protected IFigure createNodeShape() { - return primaryShape = new FlowPortFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - public FlowPortFigure getPrimaryShape() { - return (FlowPortFigure) primaryShape; - } - - /** - * <pre> - * Refresh the figure with the flow port image. - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - - int side = getBorderItemLocator().getCurrentSideOfParent(); - if (side == 0) { - getBorderItemLocator().getCurrentSideOfParent(); - } - - Element element = (Element) resolveSemanticElement(); - FlowPort flowPort = UMLUtil.getStereotypeApplication(element, FlowPort.class); - - Image image = Activator.getInstance().getFlowPortImage(flowPort, side); - getPrimaryShape().setImage(image); - } - - /** - * <pre> - * A post layout listener is added during activate and remove the first time the layout occurs. - * This is required in order to be able to find the side of this border item on its parent when opening the model. - * Without this, the locator is unable to guess the parent side because the parent constraint is not set yet. - * - * Once the initialization is done, the listener become useless and can be removed. - * - * {@inheritDoc} - * </pre> - */ - @Override - public void activate() { - - layoutInitializationListener = new LayoutListener.Stub() { - - @Override - public void postLayout(IFigure container) { - refreshVisuals(); - // getBorderedFigure().getBorderItemContainer().removeLayoutListener(layoutInitializationListener); - layoutInitializationListener = null; - } - }; - getBorderedFigure().getBorderItemContainer().addLayoutListener(layoutInitializationListener); - - super.activate(); - } - - /** - * {@inheritDoc} - */ - - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - - /** - * {@inheritDoc} - */ - - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - - /** - * {@inheritDoc} - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof FlowPortAffixedLabelNameEditPart) { - ((FlowPortAffixedLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - IFigure borderItemContainer = getContentPaneFor((IGraphicalEditPart) childEditPart); - addBorderItem(borderItemContainer, (IBorderItemEditPart) childEditPart); - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof FlowPortAffixedLabelNameEditPart) { - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - protected void removeChild(EditPart child) { - if (child instanceof AbstractElementLabelEditPart) { - return; - } - super.removeChild(child); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java deleted file mode 100644 index 707b7904284..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortChildLabelEditPart.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.portandflows.FlowPort; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart; - -/** - * Edit part for {@link FlowPort} used as Child label node. - */ -public class FlowPortChildLabelEditPart extends AbstractElementChildLabelEditPart { - - /** Constructor */ - public FlowPortChildLabelEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - // /** - // * {@inheritDoc} - // */ - // @Override - // protected Image getLabelIcon() { - // EObject parserElement = getParserElement(); - // if(parserElement == null) { - // return null; - // } - // - // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - // for(View view : views) { - // if(NameLabelIconHelper.showLabelIcon(view)) { - // return labelProvider.getImage(parserElement); - // } - // } - // - // return null; - // } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java deleted file mode 100644 index 31435690d48..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyChildLabelEditPart.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.portandflows.FlowProperty; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementChildLabelEditPart; - -/** - * Edit part for {@link FlowProperty} used as Child label node. - */ -public class FlowPropertyChildLabelEditPart extends AbstractElementChildLabelEditPart { - - /** Constructor */ - public FlowPropertyChildLabelEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - // /** - // * {@inheritDoc} - // */ - // @Override - // protected Image getLabelIcon() { - // EObject parserElement = getParserElement(); - // if(parserElement == null) { - // return null; - // } - // - // List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - // for(View view : views) { - // if(NameLabelIconHelper.showLabelIcon(view)) { - // return labelProvider.getImage(parserElement); - // } - // } - // - // return null; - // } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/NestedBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/NestedBlockPropertyCompositeEditPart.java deleted file mode 100644 index 366ca2198c6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/NestedBlockPropertyCompositeEditPart.java +++ /dev/null @@ -1,258 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.Graphics; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.NestedBlockPropertyCompositeSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.NestedBlockPropertyCompositeFigure; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Edit part for nested Block property shown as composite. - */ -@Deprecated -public class NestedBlockPropertyCompositeEditPart extends AbstractElementEditPart { - - public NestedBlockPropertyCompositeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NestedBlockPropertyCompositeSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY, new ShowHideRelatedContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EncapsulatedClassifierResizableShapeEditPolicy()); - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { - return new BorderItemResizableEditPolicy(); - } - - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof PropertyNodeLabelEditPart) { - ((PropertyNodeLabelEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((FlowPortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((PortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - - if (childEditPart instanceof PropertyNodeLabelEditPart) { - return true; - } - - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((FlowPortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((PortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof IBorderItemEditPart) { - return getBorderedFigure().getBorderItemContainer(); - } - - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - - @Override - protected NodeFigure createNodeFigure() { - return new SelectableBorderedNodeFigure(createMainFigure()); - } - - @Override - protected IFigure createNodeShape() { - return primaryShape = new NestedBlockPropertyCompositeFigure(); - } - - @Override - public NestedBlockPropertyCompositeFigure getPrimaryShape() { - return (NestedBlockPropertyCompositeFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID); - } - - /** - * <pre> - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void handleNotificationEvent(Notification event) { - - // A visual refresh may also be needed when the following properties are changing : aggregation, type, or the related association. - if (resolveSemanticElement() != null) { - EObject element = resolveSemanticElement(); - - if ((element != null) && (element.equals(event.getNotifier())) && (element instanceof Property)) { - - if (UMLPackage.eINSTANCE.getProperty_Aggregation().equals(event.getFeature())) { - refreshVisuals(); - } - - if (UMLPackage.eINSTANCE.getTypedElement_Type().equals(event.getFeature())) { - refreshVisuals(); - } - - if (UMLPackage.eINSTANCE.getProperty_Association().equals(event.getFeature())) { - refreshVisuals(); - } - } - } - - super.handleNotificationEvent(event); - } - - /** - * <pre> - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - - String tag = "property"; - int lineStyle = Graphics.LINE_SOLID; - - if (resolveSemanticElement() != null) { - EObject eObject = resolveSemanticElement(); - if (((ISpecializationType) SysMLElementTypes.PART_PROPERTY).getMatcher().matches(eObject)) { - tag = "part"; - - } else if (((ISpecializationType) SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(eObject)) { - tag = "reference"; - lineStyle = Graphics.LINE_CUSTOM; - - } else if (((ISpecializationType) SysMLElementTypes.ACTOR_PART_PROPERTY).getMatcher().matches(eObject)) { - tag = "actor part"; - - } else if (((ISpecializationType) SysMLElementTypes.VALUE_PROPERTY).getMatcher().matches(eObject)) { - tag = "value"; - - } else { - // Consider the element is a Property... - } - } - - getPrimaryShape().setFigureTag(tag); - getPrimaryShape().setLineStyle(lineStyle); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockCompositeSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockCompositeSemanticEditPolicy.java deleted file mode 100644 index 79e002153f3..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockCompositeSemanticEditPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateFlowPortWithFlowSpecificationConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Semantic edit policy for {@link Block} structure compartment. - */ -public class BlockCompositeSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.FLOW_PORT_NA == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateFlowPortWithFlowSpecificationConfigureCommandFactory()); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyCompositeSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyCompositeSemanticEditPolicy.java deleted file mode 100644 index 617b70b972a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyCompositeSemanticEditPolicy.java +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateFlowPortWithFlowSpecificationConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * Semantic edit policy for Property owned by a Block (Part or Reference especially). - */ -public class BlockPropertyCompositeSemanticEditPolicy extends DefaultSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - // Port - FlowPort creation is allowed if the semantic element is - // a Property typed by a Block, the new Port - FlowPort is created on this Block. - EObject eObject = req.getContainer(); - if ((eObject != null) && (eObject instanceof Property)) { - Type type = ((Property) eObject).getType(); - if ((type != null) && (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type))) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if ((SysMLElementTypes.FLOW_PORT == baseType) - || (SysMLElementTypes.FLOW_PORT_IN == baseType) - || (SysMLElementTypes.FLOW_PORT_OUT == baseType) - || (SysMLElementTypes.FLOW_PORT_IN_OUT == baseType) - || (SysMLElementTypes.FLOW_PORT_NA == baseType) - || (UMLElementTypes.PORT == baseType)) { - - req.setContainer(type); - } - - if (SysMLElementTypes.FLOW_PORT_NA == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateFlowPortWithFlowSpecificationConfigureCommandFactory()); - } - } - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java deleted file mode 100644 index ddd9bde7798..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,84 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import java.util.Arrays; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateValueWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * Semantic edit policy for {@link Block} structure compartment. - */ -public class BlockPropertyStructureCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - // Property (and variants) creation is allowed if the semantic element is - // a Property typed by a Block, the Property is created on this Block. - EObject eObject = req.getContainer(); - if ((eObject != null) && (eObject instanceof Property)) { - Type type = ((Property) eObject).getType(); - if ((type != null) && (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type))) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.PART_PROPERTY == baseType) { - req.setContainer(type); - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreatePartWithTypeConfigureCommandFactory()); - } else if (SysMLElementTypes.REFERENCE_PROPERTY == baseType) { - req.setContainer(type); - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateReferenceWithTypeConfigureCommandFactory()); - } else if (SysMLElementTypes.ACTOR_PART_PROPERTY == baseType) { - req.setContainer(type); - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateActorPartWithTypeConfigureCommandFactory()); - } else if (SysMLElementTypes.VALUE_PROPERTY == baseType) { - req.setContainer(type); - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory()); - } else if (UMLElementTypes.PROPERTY == baseType) { - req.setContainer(type); - } else if (SysMLElementTypes.CONSTRAINT_PROPERTY == req.getElementType()) { - req.setContainer(type); - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory()); - } - } else if ((UMLElementTypes.PROPERTY == req.getElementType()) || (Arrays.asList(req.getElementType().getAllSuperTypes()).contains(UMLElementTypes.PROPERTY))) { - // Forbid Property::qualifier creation - return UnexecutableCommand.INSTANCE; - } - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ConstraintParameterCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ConstraintParameterCompartmentSemanticEditPolicy.java deleted file mode 100644 index 8f025885fa7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ConstraintParameterCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.ConfigureFeatureCommandFactory; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Semantic edit policy for {@link ConstraintBlock} parameters (Property) compartment. - */ -public class ConstraintParameterCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (UMLElementTypes.PROPERTY == baseType) { - String name = NamedElementUtil.getDefaultNameWithIncrementFromBase("parameter", req.getContainer().eContents()); //$NON-NLS-1$ - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getNamedElement_Name(), name)); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java deleted file mode 100644 index 7e7c8304d80..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/CustomDuplicatePasteEditPolicy.java +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gmf.runtime.diagram.ui.requests.DuplicateRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - - -/** - * Specific edit policy for compartment, to forbid the duplication of ports as affixed children. - * - * @see bug 375041 - */ -public class CustomDuplicatePasteEditPolicy extends PasteEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command constructDuplicationCommand(List notationViewsToDuplicate, Set elementsToDuplicate, DuplicateRequest request, TransactionalEditingDomain editingDomain) { - if (notationViewsToDuplicate != null && !notationViewsToDuplicate.isEmpty()) { - for (Object o : notationViewsToDuplicate) { - if (o instanceof View) { - String type = ((View) o).getType(); - if (SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID.equals(type) || UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID.equals(type)) { - return UnexecutableCommand.INSTANCE; - } - } - } - } - - - return super.constructDuplicationCommand(notationViewsToDuplicate, elementsToDuplicate, request, editingDomain); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/FlowPortCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/FlowPortCompartmentSemanticEditPolicy.java deleted file mode 100644 index 32d56b25ccd..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/FlowPortCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateFlowPortWithFlowSpecificationConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Semantic edit policy for {@link Block} structure compartment. - */ -public class FlowPortCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.FLOW_PORT_NA == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateFlowPortWithFlowSpecificationConfigureCommandFactory()); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/NestedBlockPropertyCompositeSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/NestedBlockPropertyCompositeSemanticEditPolicy.java deleted file mode 100644 index 0e66162a1eb..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/NestedBlockPropertyCompositeSemanticEditPolicy.java +++ /dev/null @@ -1,70 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateFlowPortWithFlowSpecificationConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; - -/** - * Semantic edit policy for Property owned by a Block (Part or Reference especially). - */ -@Deprecated -public class NestedBlockPropertyCompositeSemanticEditPolicy extends DefaultSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - // Port - FlowPort creation is allowed if the semantic element is - // a Property typed by a Block, the new Port - FlowPort is created on this Block. - EObject eObject = req.getContainer(); - if ((eObject != null) && (eObject instanceof Property)) { - Type type = ((Property) eObject).getType(); - if ((type != null) && (((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type))) { - - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if ((SysMLElementTypes.FLOW_PORT == baseType) - || (SysMLElementTypes.FLOW_PORT_IN == baseType) - || (SysMLElementTypes.FLOW_PORT_OUT == baseType) - || (SysMLElementTypes.FLOW_PORT_IN_OUT == baseType) - || (SysMLElementTypes.FLOW_PORT_NA == baseType) - || (UMLElementTypes.PORT == baseType)) { - - req.setContainer(type); - } - - if (SysMLElementTypes.FLOW_PORT_NA == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateFlowPortWithFlowSpecificationConfigureCommandFactory()); - } - } - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java deleted file mode 100644 index 0e4c2c9e8c6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PartCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Semantic edit policy for {@link Block} part (Property) compartment. - */ -public class PartCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.PART_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreatePartWithTypeConfigureCommandFactory()); - } - - if (SysMLElementTypes.CONSTRAINT_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory()); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java deleted file mode 100644 index 13d12c9bb21..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateFlowPortWithFlowSpecificationConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateValueWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Semantic edit policy for {@link Block} property compartment. - */ -public class PropertyCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.PART_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreatePartWithTypeConfigureCommandFactory()); - } - if (SysMLElementTypes.REFERENCE_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateReferenceWithTypeConfigureCommandFactory()); - } - if (SysMLElementTypes.ACTOR_PART_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateActorPartWithTypeConfigureCommandFactory()); - } - if (SysMLElementTypes.VALUE_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory()); - } - if (SysMLElementTypes.FLOW_PORT_NA == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateFlowPortWithFlowSpecificationConfigureCommandFactory()); - } - if (SysMLElementTypes.CONSTRAINT_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory()); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ReferenceCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ReferenceCompartmentSemanticEditPolicy.java deleted file mode 100644 index 27d3bdde8f2..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ReferenceCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Semantic edit policy for {@link Block} reference (Property) compartment. - */ -public class ReferenceCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.REFERENCE_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateReferenceWithTypeConfigureCommandFactory()); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java deleted file mode 100644 index 7eaf6b6f49e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,65 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateConstraintPropertyWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateValueWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Semantic edit policy for {@link Block} structure compartment. - */ -public class StructureCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.PART_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreatePartWithTypeConfigureCommandFactory()); - } - - if (SysMLElementTypes.REFERENCE_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateReferenceWithTypeConfigureCommandFactory()); - } - - if (SysMLElementTypes.ACTOR_PART_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateActorPartWithTypeConfigureCommandFactory()); - } - - if (SysMLElementTypes.VALUE_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory()); - } - - if (SysMLElementTypes.CONSTRAINT_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateConstraintPropertyWithTypeConfigureCommandFactory()); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ValueCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ValueCompartmentSemanticEditPolicy.java deleted file mode 100644 index 35e42a9121d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/ValueCompartmentSemanticEditPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.policy; - -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.sysml.diagram.common.commands.CreateValueWithTypeConfigureCommandFactory; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; - -/** - * Semantic edit policy for {@link Block} value (Property) compartment. - */ -public class ValueCompartmentSemanticEditPolicy extends DefaultCompartmentSemanticEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getCreateCommand(CreateElementRequest req) { - - IElementType elementTypeToCreate = req.getElementType(); - IElementType baseType = elementTypeToCreate; - - if (SysMLElementTypes.VALUE_PROPERTY == baseType) { - req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory()); - } - - return super.getCreateCommand(req); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java deleted file mode 100644 index 9cd742a3cde..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/AssociationFigure.java +++ /dev/null @@ -1,120 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; -import org.eclipse.uml2.uml.Association; - -/** - * This figure is used to represent {@link Association} in SysML diagrams. - */ -public class AssociationFigure extends NamedElementEdgeFigure { - - /** The multiplicity source label. */ - private WrappingLabel fSourceMultiplicityLabel; - - /** The multiplicity target label. */ - private WrappingLabel fTargetMultiplicityLabel; - - /** The role source label. */ - private WrappingLabel fSourceRoleLabel; - - /** The role target label. */ - private WrappingLabel fTargetRoleLabel; - - /** - * Instantiates a new association figure. - */ - public AssociationFigure() { - super(); - createContents(); - } - - /** - * Creates the contents. - */ - @Override - protected void createContents() { - super.createContents(); - - fSourceRoleLabel = new PapyrusWrappingLabel(); - fSourceRoleLabel.setText(""); - - this.add(fSourceRoleLabel); - - fSourceMultiplicityLabel = new PapyrusWrappingLabel(); - fSourceMultiplicityLabel.setText(""); - - this.add(fSourceMultiplicityLabel); - - fTargetRoleLabel = new PapyrusWrappingLabel(); - fTargetRoleLabel.setText(""); - - this.add(fTargetRoleLabel); - - fTargetMultiplicityLabel = new PapyrusWrappingLabel(); - fTargetMultiplicityLabel.setText(""); - - this.add(fTargetMultiplicityLabel); - - } - - /** - * Gets the applied stereotype association label. - * - * @return the applied stereotype association label - */ - @Override - public WrappingLabel getAppliedStereotypeLabel() { - return appliedStereotypeLabel; - } - - /** - * Gets the multiplicity source label. - * - * @return the multiplicity source label - */ - public WrappingLabel getSourceMultiplicityLabel() { - return fSourceMultiplicityLabel; - } - - /** - * Gets the multiplicity target label. - * - * @return the multiplicity target label - */ - public WrappingLabel getTargetMultiplicityLabel() { - return fTargetMultiplicityLabel; - } - - /** - * Gets the role source label. - * - * @return the role source label - */ - public WrappingLabel getSourceRoleLabel() { - return fSourceRoleLabel; - } - - /** - * Gets the role target label. - * - * @return the role target label - */ - public WrappingLabel getTargetRoleLabel() { - return fTargetRoleLabel; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java deleted file mode 100644 index f26fbec1536..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/figure/FlowPortFigure.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure; -import org.eclipse.swt.graphics.Image; - - -/** - * Figure for Port representation. - */ -public class FlowPortFigure extends AffixedNamedElementFigure { - - /** - * Set the image in FlowPort figure. - * - * @param image - * the image to show in the FlowPort - */ - public void setImage(Image image) { - setIcon(image); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java deleted file mode 100644 index 2f69592839b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java +++ /dev/null @@ -1,160 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.messages; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - - public static String CreateOrSelectTypeDialog_DialogTitle; - - public static String CreateOrSelectTypeDialog_SelectionSectionTitle; - - public static String CreateOrSelectTypeDialog_SelectionSectionRadioLabel; - - public static String CreateOrSelectTypeDialog_CreationSectionTitle; - - public static String CreateOrSelectTypeDialog_CreationSectionRadioLabel; - - public static String CreateOrSelectTypeDialog_NewTypeNameLabel; - - public static String CreateOrSelectTypeDialog_NewTypeContainerNameLabel; - - public static String CreateOrSelectTypeDialog_SelectTypeDialogTitle; - - public static String CreateOrSelectTypeDialog_SelectTypeDialogMessage; - - public static String CreateOrSelectTypeDialog_SelectNewTypeContainerDialogTitle; - - public static String CreateOrSelectTypeDialog_SelectNewTypeContainerDialogMessage; - - public static String CreateOrSelectBlockPropertyTypeDialog_DialogTitle; - - public static String CreateOrSelectBlockPropertyTypeDialog_SelectionSectionTitle; - - public static String CreateOrSelectBlockPropertyTypeDialog_SelectionSectionRadioLabel; - - public static String CreateOrSelectBlockPropertyTypeDialog_CreationSectionTitle; - - public static String CreateOrSelectBlockPropertyTypeDialog_CreationSectionRadioLabel; - - public static String CreateOrSelectBlockPropertyTypeDialog_NewTypeNameLabel; - - public static String CreateOrSelectBlockPropertyTypeDialog_NewTypeContainerNameLabel; - - public static String CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogTitle; - - public static String CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage; - - public static String CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle; - - public static String CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage; - - public static String CreateOrSelectConstraintPropertyTypeDialog_DialogTitle; - - public static String CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionTitle; - - public static String CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionRadioLabel; - - public static String CreateOrSelectConstraintPropertyTypeDialog_CreationSectionTitle; - - public static String CreateOrSelectConstraintPropertyTypeDialog_CreationSectionRadioLabel; - - public static String CreateOrSelectConstraintPropertyTypeDialog_NewTypeNameLabel; - - public static String CreateOrSelectConstraintPropertyTypeDialog_NewTypeContainerNameLabel; - - public static String CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogTitle; - - public static String CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogMessage; - - public static String CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogTitle; - - public static String CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogMessage; - - public static String CreateOrSelectActorPartTypeDialog_DialogTitle; - - public static String CreateOrSelectActorPartTypeDialog_SelectionSectionTitle; - - public static String CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel; - - public static String CreateOrSelectActorPartTypeDialog_CreationSectionTitle; - - public static String CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel; - - public static String CreateOrSelectActorPartTypeDialog_NewTypeNameLabel; - - public static String CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel; - - public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle; - - public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage; - - public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle; - - public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage; - - public static String CreateOrSelectValuePropertyTypeDialog_DialogTitle; - - public static String CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle; - - public static String CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel; - - public static String CreateOrSelectValuePropertyTypeDialog_CreationSectionTitle; - - public static String CreateOrSelectValuePropertyTypeDialog_CreationSectionRadioLabel; - - public static String CreateOrSelectValuePropertyTypeDialog_NewTypeNameLabel; - - public static String CreateOrSelectValuePropertyTypeDialog_NewTypeContainerNameLabel; - - public static String CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogTitle; - - public static String CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogMessage; - - public static String CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogTitle; - - public static String CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogMessage; - - public static String CreateOrSelectValuePropertyTypeDialog_NewTypeKindLabel; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_DialogTitle; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionTitle; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionRadioLabel; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionTitle; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionRadioLabel; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeNameLabel; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeContainerNameLabel; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogTitle; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogMessage; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogTitle; - - public static String CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogMessage; - - static { - NLS.initializeMessages("org.eclipse.papyrus.sysml.diagram.common.messages.messages", Messages.class); //$NON-NLS-1$ - } - - private Messages() { - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties deleted file mode 100644 index a5d917ce35c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties +++ /dev/null @@ -1,92 +0,0 @@ - -CreateOrSelectTypeDialog_DialogTitle=Type initialization -CreateOrSelectTypeDialog_SelectionSectionTitle=Select an existing type -CreateOrSelectTypeDialog_SelectionSectionRadioLabel=Type selection mode - -CreateOrSelectTypeDialog_CreationSectionTitle=Create a new type -CreateOrSelectTypeDialog_CreationSectionRadioLabel=Type creation mode -CreateOrSelectTypeDialog_NewTypeNameLabel=Select new type name -CreateOrSelectTypeDialog_NewTypeContainerNameLabel=Select new type container - -CreateOrSelectTypeDialog_SelectTypeDialogTitle=Type selection -CreateOrSelectTypeDialog_SelectTypeDialogMessage=Select a type - -CreateOrSelectTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection -CreateOrSelectTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new type - -CreateOrSelectBlockPropertyTypeDialog_DialogTitle=Part or Reference type initialization -CreateOrSelectBlockPropertyTypeDialog_SelectionSectionTitle=Select an existing type (Block) -CreateOrSelectBlockPropertyTypeDialog_SelectionSectionRadioLabel=Block (type) selection mode - -CreateOrSelectBlockPropertyTypeDialog_CreationSectionTitle=Create a new type (Block) -CreateOrSelectBlockPropertyTypeDialog_CreationSectionRadioLabel=Block (type) creation mode -CreateOrSelectBlockPropertyTypeDialog_NewTypeNameLabel=Select new Block name -CreateOrSelectBlockPropertyTypeDialog_NewTypeContainerNameLabel=Select new Block container - -CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogTitle=Type selection -CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage=Select a Block to use as new element type - -CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection -CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new Block - -CreateOrSelectConstraintPropertyTypeDialog_DialogTitle=ConstraintProperty type initialization -CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionTitle=Select an existing type (ConstraintBlock) -CreateOrSelectConstraintPropertyTypeDialog_SelectionSectionRadioLabel=ConstraintBlock (type) selection mode - -CreateOrSelectConstraintPropertyTypeDialog_CreationSectionTitle=Create a new type (ConstraintBlock) -CreateOrSelectConstraintPropertyTypeDialog_CreationSectionRadioLabel=ConstraintBlock (type) creation mode -CreateOrSelectConstraintPropertyTypeDialog_NewTypeNameLabel=Select new ConstraintBlock name -CreateOrSelectConstraintPropertyTypeDialog_NewTypeContainerNameLabel=Select new ConstraintBlock container - -CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogTitle=Type selection -CreateOrSelectConstraintPropertyTypeDialog_SelectTypeDialogMessage=Select a ConstraintBlock to use as new element type - -CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection -CreateOrSelectConstraintPropertyTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new ConstraintBlock - - -CreateOrSelectActorPartTypeDialog_DialogTitle=ActorPart type initialization -CreateOrSelectActorPartTypeDialog_SelectionSectionTitle=Select an existing type (Actor) -CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel=Actor (type) selection mode - -CreateOrSelectActorPartTypeDialog_CreationSectionTitle=Create a new type (Actor) -CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel=Actor (type) creation mode -CreateOrSelectActorPartTypeDialog_NewTypeNameLabel=Select new Actor name -CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel=Select new Actor container - -CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle=Type selection -CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage=Select a Actor to use as new element type - -CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection -CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new Actor - -CreateOrSelectValuePropertyTypeDialog_DialogTitle=Value type initialization -CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle=Select an existing type (ValueType or DataType) -CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel=Type selection mode - -CreateOrSelectValuePropertyTypeDialog_CreationSectionTitle=Create a new type ((ValueType or DataType) -CreateOrSelectValuePropertyTypeDialog_CreationSectionRadioLabel=Type creation mode -CreateOrSelectValuePropertyTypeDialog_NewTypeNameLabel=Select new type name -CreateOrSelectValuePropertyTypeDialog_NewTypeKindLabel=Select new type kind -CreateOrSelectValuePropertyTypeDialog_NewTypeContainerNameLabel=Select new type container - -CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogTitle=Type selection -CreateOrSelectValuePropertyTypeDialog_SelectTypeDialogMessage=Select a DataType or Value type to use as new element type - -CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection -CreateOrSelectValuePropertyTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new type - -CreateOrSelectNonAtomicFlowPortTypeDialog_DialogTitle=Non atomic FlowPort type initialization -CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionTitle=Select an existing FlowSpecification -CreateOrSelectNonAtomicFlowPortTypeDialog_SelectionSectionRadioLabel=FlowSpecification (type) selection mode - -CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionTitle=Create a new FlowSpecification -CreateOrSelectNonAtomicFlowPortTypeDialog_CreationSectionRadioLabel=FlowSpecification (type) creation mode -CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeNameLabel=Select new FlowSpecification name -CreateOrSelectNonAtomicFlowPortTypeDialog_NewTypeContainerNameLabel=Select new FlowSpecification container - -CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogTitle=Type selection -CreateOrSelectNonAtomicFlowPortTypeDialog_SelectTypeDialogMessage=Select a FlowSpecification to use as new element type - -CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection -CreateOrSelectNonAtomicFlowPortTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new FlowSpecification
\ No newline at end of file diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java deleted file mode 100644 index f332eb80329..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPortLabelParser.java +++ /dev/null @@ -1,256 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.parser; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; -import org.eclipse.papyrus.sysml.portandflows.FlowDirection; -import org.eclipse.papyrus.sysml.portandflows.FlowPort; -import org.eclipse.papyrus.sysml.portandflows.FlowSpecification; -import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; -import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; -import org.eclipse.uml2.uml.InstanceValue; -import org.eclipse.uml2.uml.Port; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.uml2.uml.VisibilityKind; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Semantic Parser for {@link FlowPort} - */ -public class FlowPortLabelParser extends PropertyLabelParser { - - /** The String format for displaying a FlowProperty with direction */ - protected static final String DIRECTION_FORMAT = "%s %s"; - - /** The String format for displaying a FlowProperty with direction */ - protected static final String CONJUGATED_FORMAT = "~%s"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Port)) { - - Property property = (Property) eObject; - - FlowPort flowPort = UMLUtil.getStereotypeApplication(property, FlowPort.class); - if (flowPort != null) { - - // manage direction only if the FlowPort is type and type is not a FlowSpecification - if (maskValues.contains(ICustomAppearance.DISP_DIRECTION)) { - String direction; - switch (flowPort.getDirection().getValue()) { - case FlowDirection.IN_VALUE: - direction = "in"; - break; - case FlowDirection.OUT_VALUE: - direction = "out"; - break; - case FlowDirection.INOUT_VALUE: - direction = "inout"; - break; - default: - direction = "inout"; - break; - } - - // manage direction only if the FlowPort is not a FlowSpecification - if ((property.getType() == null) || ((property.getType() != null) && (UMLUtil.getStereotypeApplication(property.getType(), FlowSpecification.class) == null))) { - result = String.format(DIRECTION_FORMAT, direction, result); - } - } - } - - // manage visibility - if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { - String visibility; - switch (property.getVisibility().getValue()) { - case VisibilityKind.PACKAGE: - visibility = "~"; - break; - case VisibilityKind.PUBLIC: - visibility = "+"; - break; - case VisibilityKind.PROTECTED: - visibility = "#"; - break; - case VisibilityKind.PRIVATE: - visibility = "-"; - break; - default: - visibility = "+"; - break; - } - result = String.format(VISIBILITY_FORMAT, visibility, result); - } - - // manage derived modifier - if ((maskValues.contains(ICustomAppearance.DISP_DERIVE)) && (property.isDerived())) { - result = String.format(DERIVED_FORMAT, result); - } - - // manage name - if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (property.isSetName())) { - String name = UMLLabelInternationalization.getInstance().getLabel(property); - result = String.format(NAME_FORMAT, result, name); - } - - // manage type and conjugated property - if ((maskValues.contains(ICustomAppearance.DISP_TYPE))) { - - String type = "<Undefined>"; - if (property.getType() != null) { - type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); - } - - // If type is undefined only show "<Undefined>" when explicitly asked. - if ((maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE)) || (!"<Undefined>".equals(type))) { - if ((flowPort != null) && (flowPort.isConjugated())) { - type = String.format(CONJUGATED_FORMAT, type); - } - result = String.format(TYPE_FORMAT, result, type); - } - } - - // manage multiplicity - if ((maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY))) { - - // TODO : add a case for default with multiplicity not set. - String multiplicity = SysMLMultiplicityElementUtil.formatMultiplicity(property, maskValues); - if (multiplicity != null && !multiplicity.isEmpty()) { - result += " " + multiplicity; - } - } - - // manage default value - if ((maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) && ((property.getDefaultValue() != null))) { - ValueSpecification valueSpecification = property.getDefaultValue(); - if (valueSpecification instanceof InstanceValue) { - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); - } - } - - // manage modifier - if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) { - StringBuffer sb = new StringBuffer(); - if (property.isReadOnly()) { - sb.append(sb.length() == 0 ? "readOnly" : ", readOnly"); - } - if (property.isOrdered()) { - sb.append(sb.length() == 0 ? "ordered" : ", ordered"); - } - if (property.isUnique()) { - sb.append(sb.length() == 0 ? "unique" : ", unique"); - } - if (property.isDerivedUnion()) { - sb.append(sb.length() == 0 ? "union" : ", union"); - } - EList<Property> redefinedProperties = property.getRedefinedProperties(); - if (redefinedProperties != null && !redefinedProperties.isEmpty()) { - for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); - } - } - if (sb.length() != 0) { - result = String.format(MODIFIER_FORMAT, result, sb.toString()); - } - } - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return PortandflowsPackage.eINSTANCE.getFlowPort_Direction().equals(feature) || PortandflowsPackage.eINSTANCE.getFlowPort_IsConjugated().equals(feature) || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = super.getSemanticElementsBeingParsed(element); - - if ((element != null) && (element instanceof Port)) { - Port semElement = (Port) element; - - FlowPort flowPort = UMLUtil.getStereotypeApplication(semElement, FlowPort.class); - if (flowPort != null) { - semanticElementsBeingParsed.add(flowPort); - } - } - return semanticElementsBeingParsed; - } - - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_DIRECTION, "Direction"); - masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility"); - masks.put(ICustomAppearance.DISP_DERIVE, "Is Derived"); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ICustomAppearance.DISP_TYPE, "Type"); - masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type"); - masks.put(ICustomAppearance.DISP_MULTIPLICITY, "Multiplicity"); - masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity"); - masks.put(ICustomAppearance.DISP_DEFAULT_VALUE, "Default Value"); - masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_DIRECTION, ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_TYPE, ILabelPreferenceConstants.DISP_UNDEFINED_TYPE); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java deleted file mode 100644 index 5c6240773ba..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/FlowPropertyLabelParser.java +++ /dev/null @@ -1,144 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.parser; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.portandflows.FlowDirection; -import org.eclipse.papyrus.sysml.portandflows.FlowProperty; -import org.eclipse.papyrus.sysml.portandflows.PortandflowsPackage; -import org.eclipse.papyrus.uml.diagram.common.parser.PropertyLabelParser; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Semantic Parser for {@link FlowProperty} - */ -public class FlowPropertyLabelParser extends PropertyLabelParser { - - /** The String format for displaying a FlowProperty with direction */ - protected static final String DIRECTION_FORMAT = "%s %s"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = super.getPrintString(element, flags); - - EObject eObject = EMFHelper.getEObject(element); - if ((eObject != null) && (eObject instanceof Property)) { - - Property property = (Property) eObject; - FlowProperty flowProperty = UMLUtil.getStereotypeApplication(property, FlowProperty.class); - if (flowProperty != null) { - - // manage direction - if (maskValues.contains(ICustomAppearance.DISP_DIRECTION)) { - String direction; - switch (flowProperty.getDirection().getValue()) { - case FlowDirection.IN_VALUE: - direction = "in"; - break; - case FlowDirection.OUT_VALUE: - direction = "out"; - break; - case FlowDirection.INOUT_VALUE: - direction = "inout"; - break; - default: - direction = "inout"; - break; - } - result = String.format(DIRECTION_FORMAT, direction, result); - } - } - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return PortandflowsPackage.eINSTANCE.getFlowProperty_Direction().equals(feature) || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = super.getSemanticElementsBeingParsed(element); - - if ((element != null) && (element instanceof Property)) { - Property semElement = (Property) element; - - FlowProperty flowProperty = UMLUtil.getStereotypeApplication(semElement, FlowProperty.class); - if (flowProperty != null) { - semanticElementsBeingParsed.add(flowProperty); - } - } - return semanticElementsBeingParsed; - } - - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(10); - masks.put(ICustomAppearance.DISP_DIRECTION, "Direction"); - masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility"); - masks.put(ICustomAppearance.DISP_DERIVE, "Is Derived"); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ICustomAppearance.DISP_TYPE, "Type"); - masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type"); - masks.put(ICustomAppearance.DISP_MULTIPLICITY, "Multiplicity"); - masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity"); - masks.put(ICustomAppearance.DISP_DEFAULT_VALUE, "Default Value"); - masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_DIRECTION, ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_TYPE, ILabelPreferenceConstants.DISP_UNDEFINED_TYPE); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java deleted file mode 100644 index c7984cb850b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/RequirementLabelParser.java +++ /dev/null @@ -1,117 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.requirements.Requirement; -import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Semantic Parser for {@link Requirement} - */ -public class RequirementLabelParser extends NamedElementLabelParser { - - /** The String format for displaying a Requirement name */ - protected static final String NAME_FORMAT = "%s"; - - /** The String format for displaying a FlowProperty with direction */ - protected static final String ID_FORMAT = "%s{id = %s}"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Class)) { - - Class clazz = (Class) eObject; - Requirement requirement = UMLUtil.getStereotypeApplication(clazz, Requirement.class); - - // manage name - if (maskValues.contains(ICustomAppearance.DISP_NAME)) { - String name = UMLLabelInternationalization.getInstance().getLabel(clazz); - result = String.format(NAME_FORMAT, name); - } - - - if (requirement != null) { - - // manage id - if (maskValues.contains(ILabelPreferenceConstants.DISP_ID)) { - String id = requirement.getId(); - result = String.format(ID_FORMAT, result, id); - } - } - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof Class)) { - Class semElement = (Class) element; - - semanticElementsBeingParsed.add(semElement); - - Requirement requirement = UMLUtil.getStereotypeApplication(semElement, Requirement.class); - if (requirement != null) { - semanticElementsBeingParsed.add(requirement); - } - } - return semanticElementsBeingParsed; - } - - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ILabelPreferenceConstants.DISP_ID, "Id"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_NAME, ILabelPreferenceConstants.DISP_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java deleted file mode 100644 index 10242f87699..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/parser/UnitLabelParser.java +++ /dev/null @@ -1,142 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.blocks.BlocksPackage; -import org.eclipse.papyrus.sysml.blocks.Dimension; -import org.eclipse.papyrus.sysml.blocks.Unit; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.InstanceSpecification; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Semantic Parser for {@link Unit} - */ -public class UnitLabelParser extends NamedElementLabelParser { - - /** The String format for displaying a {@link Unit} label with its name */ - protected static final String NAME_FORMAT = "%s"; - - /** The String format for displaying a {@link Unit} with direction */ - protected static final String DIMENSION_FORMAT = "%s {%s}"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof InstanceSpecification)) { - - InstanceSpecification iSpec = (InstanceSpecification) eObject; - - Unit unit = UMLUtil.getStereotypeApplication(iSpec, Unit.class); - - // manage name - if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (iSpec.isSetName())) { - String name = UMLLabelInternationalization.getInstance().getLabel(iSpec); - result = String.format(NAME_FORMAT, name); - } - - // manage dimension - if ((maskValues.contains(ILabelPreferenceConstants.DISP_DIMENSION))) { - String dimensionName = "<Undefined>"; - if ((unit != null) && (unit.getDimension() != null)) { - Dimension dim = unit.getDimension(); - if ((dim.getBase_InstanceSpecification() != null) && (dim.getBase_InstanceSpecification().isSetName())) { - dimensionName = UMLLabelInternationalization.getInstance().getLabel(dim.getBase_InstanceSpecification()); - } - } - result = String.format(DIMENSION_FORMAT, result, dimensionName); - } - - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return BlocksPackage.eINSTANCE.getUnit_Dimension().equals(feature) || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof InstanceSpecification)) { - InstanceSpecification semElement = (InstanceSpecification) element; - - semanticElementsBeingParsed.add(semElement); - - Unit unit = UMLUtil.getStereotypeApplication(semElement, Unit.class); - if (unit != null) { - semanticElementsBeingParsed.add(unit); - } - } - return semanticElementsBeingParsed; - } - - - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ILabelPreferenceConstants.DISP_DIMENSION, "Dimension"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_NAME, ILabelPreferenceConstants.DISP_DIMENSION); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java deleted file mode 100644 index 051fb3a681c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/ILabelPreferenceConstants.java +++ /dev/null @@ -1,46 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.preferences; - -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; - -/** - * Label constants for label mask preferences. - */ -public interface ILabelPreferenceConstants extends ICustomAppearance { - - /** preference id for display labels */ - public String LABEL_DISPLAY_PREFERENCE = "label.display"; //$NON-NLS-1$ - - /** Style constant for id info display in labels. */ - public final static String DISP_ID = "id"; //$NON-NLS-1$ - - /** Style constant for dimension info display in labels. */ - public final static String DISP_DIMENSION = "dimension"; //$NON-NLS-1$ - - /** Style constant for specification info display in labels. */ - public final static String DISP_SPECIFICATION = "specification"; //$NON-NLS-1$ - - /** Style constant for signal info display in labels. */ - public final static String DISP_SIGNAL = "signal"; //$NON-NLS-1$ - - /** Style constant forcing multiplicity display in labels. */ - public final static String DISP_DEFAULT_MULTIPLICITY = "defaultMultiplicity"; //$NON-NLS-1$ - - /** Style constant forcing type display in labels. */ - public final static String DISP_UNDEFINED_TYPE = "undefinedType"; //$NON-NLS-1$ - - /** Style constant forcing name display in labels. */ - public final static String DISP_NON_NAVIGABLE_ROLE = "nonNavigableRole"; //$NON-NLS-1$ -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java deleted file mode 100644 index 82cc7dd3ec7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/preferences/LabelPreferenceHelper.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.preferences; - -/** - * Utility class for building label preference constants. - */ -public class LabelPreferenceHelper { - - /** - * Create the preference constant for a label view. - * - * @param diagramType - * the type of diagram - * @param viewType - * the type of the view - * @param constantPreferenceKey - * the constant key of the preference to retrieve - * @return the complete preference key - * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=353193 - */ - @Deprecated - public static String getPreferenceConstant(String diagramType, String viewType, String constantPreferenceKey) { - return diagramType + '_' + viewType + '.' + constantPreferenceKey; - } - - /** - * Create the preference constant for a label view. - * - * @param elementkey - * the element key (including diagram hint) - * @param constantPreferenceKey - * the constant key of the preference to retrieve - * @return the complete preference key - */ - public static String getPreferenceConstant(String elementkey, String constantPreferenceKey) { - return elementkey + '.' + constantPreferenceKey; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java deleted file mode 100644 index 0f4f2fca2a9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/dnd/helper/LinkMappingHelper.java +++ /dev/null @@ -1,158 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.dnd.helper; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.ILinkMappingHelper; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.util.UMLSwitch; - -/** - * Original class {@link org.eclipse.papyrus.uml.diagram.common.helper.LinkMappingHelper} slightly - * modified to use EObject instead of UML Element in its interface. - */ -public class LinkMappingHelper implements ILinkMappingHelper { - - /** - * {@inheritDoc} - */ - @Override - public Collection<?> getSource(Element link) { - CommonSourceUMLSwitch umlSwitch = new CommonSourceUMLSwitch(); - return umlSwitch.doSwitch(link); - } - - /** - * {@inheritDoc} - */ - @Override - public Collection<?> getTarget(Element link) { - CommonTargetUMLSwitch umlSwitch = new CommonTargetUMLSwitch(); - return umlSwitch.doSwitch(link); - } - - /** - * Contains diagrams common behavior that need to be redefined - * - * @author eperico - */ - public static class CommonSourceUMLSwitch extends UMLSwitch<Collection<?>> { - - @Override - public java.util.Collection<?> caseAssociation(org.eclipse.uml2.uml.Association object) { - return object.getEndTypes(); - }; - - @Override - public java.util.Collection<?> caseComment(org.eclipse.uml2.uml.Comment object) { - ArrayList<EObject> result = new ArrayList<EObject>(); - result.add(object); - return result; - }; - - @Override - public Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) { - return object.getClients(); - }; - - @Override - public java.util.Collection<?> caseGeneralization(org.eclipse.uml2.uml.Generalization object) { - ArrayList<EObject> result = new ArrayList<EObject>(); - result.add(object.getOwner()); - return result; - }; - - @Override - public java.util.Collection<?> casePackageMerge(org.eclipse.uml2.uml.PackageMerge object) { - ArrayList<EObject> result = new ArrayList<EObject>(); - result.add(object.getReceivingPackage()); - return result; - }; - - @Override - public java.util.Collection<?> casePackageImport(org.eclipse.uml2.uml.PackageImport object) { - ArrayList<EObject> result = new ArrayList<EObject>(); - result.add(object.getImportingNamespace()); - return result; - }; - - @Override - public Collection<?> caseInformationFlow(org.eclipse.uml2.uml.InformationFlow object) { - return object.getInformationSources(); - }; - - @Override - public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) { - return Collections.EMPTY_LIST; - }; - } - - /** - * Contains diagrams common behavior that need to be redefined - * - * @author eperico - */ - public static class CommonTargetUMLSwitch extends UMLSwitch<Collection<?>> { - - @Override - public java.util.Collection<?> caseAssociation(org.eclipse.uml2.uml.Association object) { - return object.getEndTypes(); - }; - - @Override - public java.util.Collection<?> caseComment(org.eclipse.uml2.uml.Comment object) { - return object.getAnnotatedElements(); - }; - - @Override - public Collection<?> caseDependency(org.eclipse.uml2.uml.Dependency object) { - return object.getSuppliers(); - }; - - @Override - public java.util.Collection<?> caseGeneralization(org.eclipse.uml2.uml.Generalization object) { - ArrayList<EObject> result = new ArrayList<EObject>(); - result.add(object.getGeneral()); - return result; - }; - - @Override - public java.util.Collection<?> casePackageMerge(org.eclipse.uml2.uml.PackageMerge object) { - ArrayList<EObject> result = new ArrayList<EObject>(); - result.add(object.getMergedPackage()); - return result; - }; - - @Override - public java.util.Collection<?> casePackageImport(org.eclipse.uml2.uml.PackageImport object) { - ArrayList<EObject> result = new ArrayList<EObject>(); - result.add(object.getImportedPackage()); - return result; - }; - - @Override - public Collection<?> caseInformationFlow(org.eclipse.uml2.uml.InformationFlow object) { - return object.getInformationTargets(); - }; - - @Override - public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) { - return Collections.EMPTY_LIST; - }; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java deleted file mode 100644 index 64c394c0004..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementBorderEditPart.java +++ /dev/null @@ -1,235 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * Vincent Lorenzo (CEA-LIST) - vincent.lorenzo@cea.fr (bug 493876) - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.StackLayout; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.linklf.LinkLFNodeFigure; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure; -import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; -import org.eclipse.swt.graphics.Color; - -/** - * Abstract non-diagram specific edit part for border node. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public abstract class AbstractElementBorderEditPart extends AbstractBorderEditPart { - - protected IFigure contentPane; - - protected IFigure primaryShape; - - public AbstractElementBorderEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); - } - - protected abstract LayoutEditPolicy createLayoutEditPolicy(); - - protected IFigure createNodeShape() { - return primaryShape = new AffixedNamedElementFigure(); - } - - @Override - public AffixedNamedElementFigure getPrimaryShape() { - return (AffixedNamedElementFigure) primaryShape; - } - - /** - * {@inheritDoc} - */ - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator) constraint; - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected void handleNotificationEvent(Notification event) { - // When a node has external node labels, the methods refreshChildren() removes the label's - // edit part from the registry. Once removed from the registry the visibility cannot be set back to visible. - - // Copied from generated code for Affixed nodes to fix: - // 366504: [SysML Block Definition Diagram] Cannot make masked labels of border items (Port) visible - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366504 - // 366503: [SysML Internal Block Diagram] Cannot make masked labels of border items (Port) visible - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=366503 - - // (this sounds strange as the "Show all labels" manages to get labels back without trouble...). - if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { - Object notifier = event.getNotifier(); - List<?> modelChildren = ((View) getModel()).getChildren(); - if (!(notifier instanceof Edge)) { - if (modelChildren.contains(event.getNotifier())) { - return; - } - } - } - super.handleNotificationEvent(event); - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshBounds() { - if (getBorderItemLocator() != null) { - int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - Point loc = new Point(x, y); - - int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); - Dimension size = new Dimension(width, height); - - // Update locator constraint - IBorderItemLocator locator = getBorderItemLocator(); - locator.setConstraint(new Rectangle(loc, size)); - - // Set new constraint on parent figure - getFigure().getParent().setConstraint(getFigure(), locator); - - } else { - super.refreshBounds(); - } - } - - protected NodeFigure createNodePlate() { - String prefElementId = getNotationView().getType(); - IPreferenceStore store = Activator.getInstance().getPreferenceStore(); - String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.WIDTH); - String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.HEIGHT); - DefaultSizeNodeFigure result = new LinkLFNodeFigure(this,store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); - - // FIXME: workaround for #154536 - result.getBounds().setSize(result.getPreferredSize()); - return result; - } - - @Override - protected NodeFigure createMainFigure() { - NodeFigure figure = createNodePlate(); - figure.setLayoutManager(new StackLayout()); - IFigure shape = createNodeShape(); - figure.add(shape); - contentPane = setupContentPane(shape); - return figure; - } - - protected IFigure setupContentPane(IFigure nodeShape) { - return nodeShape; // use nodeShape itself as contentPane - } - - /** - * @generated - */ - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - @Override - protected void setForegroundColor(Color color) { - if (primaryShape != null) { - primaryShape.setForegroundColor(color); - } - } - - @Override - public abstract EditPart getPrimaryChildEditPart(); - - @Override - public Object getPreferredValue(EStructuralFeature feature) { - String prefKey = getNotationView().getType(); - - IPreferenceStore store = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore(); - Object result = null; - - if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) { - - String prefColor = null; - if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) { - prefColor = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_LINE); - - } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) { - prefColor = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_FONT); - - } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) { - prefColor = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_FILL); - - } - result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(store, prefColor)); - - } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) { - - String prefGradient = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_GRADIENT); - GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(prefGradient)); - if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) { - result = new Integer(gradientPreferenceConverter.getTransparency()); - - } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) { - result = gradientPreferenceConverter.getGradientData(); - - } - } - - if (result == null) { - result = getStructuralFeatureValue(feature); - } - return result; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java deleted file mode 100644 index 6f7f077df5c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementChildLabelEditPart.java +++ /dev/null @@ -1,889 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ConnectionAnchor; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.requests.DropRequest; -import org.eclipse.gef.requests.ReconnectRequest; -import org.eclipse.gef.requests.SelectionRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gef.tools.SelectEditPartTracker; -import org.eclipse.gmf.runtime.common.core.util.Log; -import org.eclipse.gmf.runtime.common.core.util.Trace; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConnectionHandleEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions; -import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin; -import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.IAnchorableFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.Anchor; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.IdentityAnchor; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextNonResizableEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.locator.CellEditorLocatorUtil; -import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper; -import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusAnchorableWrappingLabel; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter; -import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.PlatformUI; - -/** - * Abstract non-diagram specific edit part for child label node. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public class AbstractElementChildLabelEditPart extends GraphicalEditPart implements ITextAwareEditPart, IPrimaryEditPart, INodeEditPart { - - private DirectEditManager manager; - - protected IParser parser; - - private List<?> parserElements; - - private String defaultText; - - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - protected IDirectEditorConfiguration configuration; - - /** Constructor */ - public AbstractElementChildLabelEditPart(View view) { - super(view); - } - - @Override - public DragTracker getDragTracker(Request request) { - if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) { - return null; - } - // return new DragEditPartsTrackerEx(this); - // Disable current child label DnD as this is not correctly handled by Papyrus. - return new SelectEditPartTracker(this); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TextNonResizableEditPolicy()); - installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy()); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - installEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE, new ConnectionHandleEditPolicy()); - } - - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - public void setLabel(IFigure figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - @Override - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - @Override - public EObject getParserElement() { - return resolveSemanticElement(); - } - - protected Image getLabelIcon() { - EObject parserElement = getParserElement(); - if (parserElement == null) { - return null; - } - - List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for (View view : views) { - if (NameLabelIconHelper.showLabelIcon(view)) { - return Activator.getInstance().getLabelProvider().getImage(parserElement); - } - } - return null; - - } - - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(new SemanticAdapter(parserElement, getNotationView()), getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); - } - - protected boolean isEditable() { - return getParser() != null; - } - - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); - } - - @Override - public ParserOptions getParserOptions() { - if (getNotationView() == null || getNotationView().getDiagram() == null) { - return ParserOptions.NONE; - } - - // int displayOptions = AppearanceHelper.getLabelDisplay(getNotationView()); - - EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION); - if (display == null) { - return getDefaultParserOptions(); - } - - // display != null - int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE)); - return new ParserOptions(displayOptions); - } - - @Override - public ParserOptions getDefaultParserOptions() { - - if (getNotationView() == null || getNotationView().getDiagram() == null) { - return ParserOptions.NONE; - } - - IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE)); - if (displayOptions == 0) { - return ParserOptions.NONE; - } - - return new ParserOptions(displayOptions); - } - - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), resolveSemanticElement(), getNotationView().getType())); - } - return parser; - } - - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), CellEditorLocatorUtil.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - break; - default: - break; - } - } - - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - protected void refreshLabel() { - - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - protected void refreshUnderline() { - FontStyle style = (FontStyle) getView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - private View getView() { - return (View) getModel(); - } - - public int getDirectEditionType() { - if (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - - // not a named element. no specific editor => do nothing - return IDirectEdition.NO_DIRECT_EDITION; - } - - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); - } - return false; - } - - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); - } - } - } - - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getInstance().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else if (NotationPackage.eINSTANCE.getView_SourceEdges().equals(feature)) { - refreshSourceConnections(); - } else if (NotationPackage.eINSTANCE.getView_TargetEdges().equals(feature)) { - refreshTargetConnections(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - protected IFigure createFigurePrim() { - return new FigureDescriptor(); - } - - static final Font THIS_FONT = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL); - - public class FigureDescriptor extends PapyrusAnchorableWrappingLabel { - - public FigureDescriptor() { - this.setText(""); - this.setFont(THIS_FONT); - } - } - - private String getLabelPreferenceKey() { - String diagramType = getNotationView().getDiagram().getType(); - String labelType = getNotationView().getType(); - return diagramType + "_" + labelType; - } - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelSourceConnections() - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelSourceConnections() - */ - @Override - protected List getModelSourceConnections() { - return ViewUtil.getSourceConnectionsConnectingVisibleViews((View) getModel()); - } - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getModelTargetConnections() - * - * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelTargetConnections() - */ - @Override - protected List getModelTargetConnections() { - return ViewUtil.getTargetConnectionsConnectingVisibleViews((View) getModel()); - } - - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor() - * - * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart) - */ - @Override - public ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) { - final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) connEditPart; - String t = ""; //$NON-NLS-1$ - try { - t = (String) getEditingDomain().runExclusive(new RunnableWithResult.Impl() { - - @Override - public void run() { - Anchor a = ((Edge) connection.getModel()).getSourceAnchor(); - if (a instanceof IdentityAnchor) { - setResult(((IdentityAnchor) a).getId()); - } else { - setResult(""); //$NON-NLS-1$ - } - } - }); - } catch (InterruptedException e) { - Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), "getSourceConnectionAnchor", e); //$NON-NLS-1$ - Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, "getSourceConnectionAnchor", e); //$NON-NLS-1$ - } - return getAnchorableFigure().getConnectionAnchor(t); - } - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getAnchorableFigure() - * - * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request) - */ - protected IAnchorableFigure getAnchorableFigure() { - IFigure myFigure = getFigure(); - if (myFigure instanceof IAnchorableFigure) { - return (IAnchorableFigure) myFigure; - } - throw new RuntimeException("The figure of this element should be an IAnchorable Figure");// - } - - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getSourceConnectionAnchor() - * - * @see org.eclipse.gef.NodeEditPart#getSourceConnectionAnchor(org.eclipse.gef.Request) - */ - @Override - public ConnectionAnchor getSourceConnectionAnchor(Request request) { - if (request instanceof ReconnectRequest) { - if (((DropRequest) request).getLocation() == null) { - return getAnchorableFigure().getSourceConnectionAnchorAt(null); - } - Point pt = ((DropRequest) request).getLocation().getCopy(); - return getAnchorableFigure().getSourceConnectionAnchorAt(pt); - } else if (request instanceof DropRequest) { - return getAnchorableFigure().getSourceConnectionAnchorAt(((DropRequest) request).getLocation()); - } - return getAnchorableFigure().getSourceConnectionAnchorAt(null); - } - - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor() - * - * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart) - */ - @Override - public ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connEditPart) { - final org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart connection = (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) connEditPart; - - String t = ""; //$NON-NLS-1$ - try { - t = (String) getEditingDomain().runExclusive(new RunnableWithResult.Impl() { - - @Override - public void run() { - Anchor a = ((Edge) connection.getModel()).getTargetAnchor(); - if (a instanceof IdentityAnchor) { - setResult(((IdentityAnchor) a).getId()); - } else { - setResult(""); //$NON-NLS-1$ - } - } - }); - } catch (InterruptedException e) { - Trace.catching(DiagramUIPlugin.getInstance(), DiagramUIDebugOptions.EXCEPTIONS_CATCHING, getClass(), "getTargetConnectionAnchor", e); //$NON-NLS-1$ - Log.error(DiagramUIPlugin.getInstance(), DiagramUIStatusCodes.IGNORED_EXCEPTION_WARNING, "getTargetConnectionAnchor", e); //$NON-NLS-1$ - } - - return getAnchorableFigure().getConnectionAnchor(t); - } - - - - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#getTargetConnectionAnchor() - * - * @see org.eclipse.gef.NodeEditPart#getTargetConnectionAnchor(org.eclipse.gef.Request) - */ - @Override - public ConnectionAnchor getTargetConnectionAnchor(Request request) { - if (request instanceof ReconnectRequest) { - if (((DropRequest) request).getLocation() == null) { - return getAnchorableFigure().getTargetConnectionAnchorAt(null); - } - Point pt = ((DropRequest) request).getLocation().getCopy(); - return getAnchorableFigure().getTargetConnectionAnchorAt(pt); - } else if (request instanceof DropRequest) { - return getAnchorableFigure().getTargetConnectionAnchorAt(((DropRequest) request).getLocation()); - } - return getAnchorableFigure().getTargetConnectionAnchorAt(null); - } - - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapConnectionAnchorToTerminal() - * - * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapConnectionAnchorToTerminal(org.eclipse.draw2d.ConnectionAnchor) - */ - @Override - final public String mapConnectionAnchorToTerminal(ConnectionAnchor c) { - return getAnchorableFigure().getConnectionAnchorTerminal(c); - } - - /* - * (non-Javadoc) - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#mapTerminalToConnectionAnchor() - * - * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INodeEditPart#mapTerminalToConnectionAnchor(java.lang.String) - */ - @Override - final public ConnectionAnchor mapTerminalToConnectionAnchor(String terminal) { - return getAnchorableFigure().getConnectionAnchor(terminal); - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.gmf.runtime.diagram.ui.editparts.INotableEditPart#canAttachNote() - * Copied from @see org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart#canAttachNote() - */ - @Override - public boolean canAttachNote() { - return true; - } - - - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java deleted file mode 100644 index 2a8cb2f6702..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementEditPart.java +++ /dev/null @@ -1,191 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; -import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; -import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure; -import org.eclipse.papyrus.uml.diagram.common.helper.BasicClassifierCompartmentLayoutHelper; -import org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper; -import org.eclipse.swt.graphics.Color; - -/** - * Abstract non-diagram specific edit part for nodes. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public abstract class AbstractElementEditPart extends NamedElementEditPart { - - protected IFigure contentPane; - - protected IFigure primaryShape; - - public AbstractElementEditPart(View view) { - super(view); - setCompartmentLayoutHelper(BasicClassifierCompartmentLayoutHelper.getInstances()); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - } - - protected abstract LayoutEditPolicy createLayoutEditPolicy(); - - @Override - protected IFigure createNodeShape() { - return primaryShape = new ClassifierFigure(); - } - - @Override - public NodeNamedElementFigure getPrimaryShape() { - return (NodeNamedElementFigure) primaryShape; - } - - protected abstract boolean addFixedChild(EditPart childEditPart); - - protected abstract boolean removeFixedChild(EditPart childEditPart); - - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - @Override - protected abstract IFigure getContentPaneFor(IGraphicalEditPart editPart); - - - @Override - protected NodeFigure createNodePlate() { - String prefElementId = getNotationView().getType(); - IPreferenceStore store = Activator.getInstance().getPreferenceStore(); - String preferenceConstantWitdh = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.WIDTH); - String preferenceConstantHeight = PreferenceInitializerForElementHelper.getpreferenceKey(getNotationView(), prefElementId, PreferencesConstantsHelper.HEIGHT); - DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(store.getInt(preferenceConstantWitdh), store.getInt(preferenceConstantHeight)); - - return result; - } - - @Override - protected NodeFigure createMainFigure() { - return createMainFigureWithSVG(); - } - - @Override - protected IFigure setupContentPane(IFigure nodeShape) { - if (nodeShape.getLayoutManager() == null) { - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); - layout.setSpacing(5); - nodeShape.setLayoutManager(layout); - } - return nodeShape; // use nodeShape itself as contentPane - } - - @Override - public IFigure getContentPane() { - if (contentPane != null) { - return contentPane; - } - return super.getContentPane(); - } - - @Override - protected void setForegroundColor(Color color) { - if (primaryShape != null) { - primaryShape.setForegroundColor(color); - } - } - - @Override - public abstract EditPart getPrimaryChildEditPart(); - - @Override - public EditPart getTargetEditPart(Request request) { - return super.getTargetEditPart(request); - } - - @Override - public Object getPreferredValue(EStructuralFeature feature) { - String prefKey = getNotationView().getType(); - - IPreferenceStore store = (IPreferenceStore) getDiagramPreferencesHint().getPreferenceStore(); - Object result = null; - - if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor() || feature == NotationPackage.eINSTANCE.getFontStyle_FontColor() || feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) { - - String prefColor = null; - if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) { - prefColor = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_LINE); - - } else if (feature == NotationPackage.eINSTANCE.getFontStyle_FontColor()) { - prefColor = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_FONT); - - } else if (feature == NotationPackage.eINSTANCE.getFillStyle_FillColor()) { - prefColor = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_FILL); - - } - result = FigureUtilities.RGBToInteger(PreferenceConverter.getColor(store, prefColor)); - - } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency() || feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) { - - String prefGradient = PreferencesConstantsHelper.getElementConstant(prefKey, PreferencesConstantsHelper.COLOR_GRADIENT); - GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(store.getString(prefGradient)); - if (feature == NotationPackage.eINSTANCE.getFillStyle_Transparency()) { - result = new Integer(gradientPreferenceConverter.getTransparency()); - - } else if (feature == NotationPackage.eINSTANCE.getFillStyle_Gradient()) { - result = gradientPreferenceConverter.getGradientData(); - - } - } - - if (result == null) { - result = getStructuralFeatureValue(feature); - } - return result; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java deleted file mode 100644 index 9269beb8406..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java +++ /dev/null @@ -1,688 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSnapBackEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDefaultSemanticEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator; -import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SemanticAdapter; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; - -/** - * Abstract non-diagram specific edit part for labels. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public abstract class AbstractElementLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, ILabelRoleProvider { - - private DirectEditManager manager; - - private IParser parser; - - private List<?> parserElements; - - protected String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - */ - protected IDirectEditorConfiguration configuration; - - /** Constructor */ - public AbstractElementLabelEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy()); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new TextSelectionEditPolicy()); - installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new DefaultSnapBackEditPolicy()); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new LabelDefaultSemanticEditPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.MIDDLE; - } - - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - @Override - protected List<?> getModelChildren() { - return Collections.EMPTY_LIST; - } - - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - @Override - public EObject getParserElement() { - return resolveSemanticElement(); - } - - protected Image getLabelIcon() { - return null; - } - - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(new SemanticAdapter(parserElement, getNotationView()), getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(new SemanticAdapter(getParserElement(), getNotationView()), getParserOptions().intValue()); - } - - protected boolean isEditable() { - return getParser() != null; - } - - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); - } - - @Override - public ParserOptions getParserOptions() { - - if (getNotationView() == null || getNotationView().getDiagram() == null) { - return ParserOptions.NONE; - } - - EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION); - if (display == null) { - return getDefaultParserOptions(); - } - - // display != null - int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE)); - return new ParserOptions(displayOptions); - } - - @Override - public ParserOptions getDefaultParserOptions() { - - if (getNotationView() == null || getNotationView().getDiagram() == null) { - return ParserOptions.NONE; - } - - IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE)); - if (displayOptions == 0) { - return ParserOptions.NONE; - } - - return new ParserOptions(displayOptions); - } - - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), getParserElement(), getNotationView().getType())); - } - return parser; - } - - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), new TextCellEditorLocator((WrappingLabel) this.getFigure()))); - } - return manager; - } - - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - protected void performDirectEdit() { - getManager().show(); - } - - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { //$NON-NLS-1$ - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - break; - default: - break; - } - } - - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - protected void refreshLabel() { - - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = getParserElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * 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 - */ - public int getDirectEditionType() { - if (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - - // not a named element. no specific editor => do nothing - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { //$NON-NLS-1$ - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); - } - } - } - - /** - * Updates the preference configuration - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) { //$NON-NLS-1$ - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - // Bug 457470 : The label refreshment is not done if the following method is not called - // This call was comment to fix a text alignment issue (Bug 440226) - refreshLabel(); //Comment to fix text alignment issue - } - } - } - - super.handleNotificationEvent(event); - } - - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } - - protected void addSnapBackLocation() { - // Use default view position as snap back position - IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - - String xKey = PreferencesConstantsHelper.getElementConstant(getLabelPreferenceKey(), PreferencesConstantsHelper.LOCATION_X); - String yKey = PreferencesConstantsHelper.getElementConstant(getLabelPreferenceKey(), PreferencesConstantsHelper.LOCATION_Y); - - Point snapBackPosition = new Point(store.getInt(xKey), store.getInt(yKey)); - - registerSnapBackPosition(getLabelPreferenceKey(), snapBackPosition); - } - - private String getLabelPreferenceKey() { - String diagramType = getNotationView().getDiagram().getType(); - String parentType = ViewUtil.getViewContainer(getNotationView()).getType(); - String labelType = getNotationView().getType(); - return diagramType + "_" + parentType + "-" + labelType; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * {@inheritDoc} - */ - @Override - public abstract String getLabelRole(); - - /** - * {@inheritDoc} - */ - @Override - public abstract String getIconPathRole(); -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java deleted file mode 100644 index 126bb18e566..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLinkEditPart.java +++ /dev/null @@ -1,246 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.ColorConstants; -import org.eclipse.draw2d.PolygonDecoration; -import org.eclipse.draw2d.PolylineDecoration; -import org.eclipse.draw2d.RotatableDecoration; -import org.eclipse.draw2d.geometry.PointList; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editparts.UMLConnectionNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType; - -/** - * Abstract non-diagram specific edit part for links. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public abstract class AbstractElementLinkEditPart extends UMLConnectionNodeEditPart { - - /** - * Constructor. - */ - public AbstractElementLinkEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy()); - } - - /** - * Add fixed child edit part. - */ - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof AppliedStereotypeLinkLabelEditPart) { - ((AppliedStereotypeLinkLabelEditPart) childEditPart).setLabel(getPrimaryShape().getAppliedStereotypeLabel()); - return true; - } - return false; - } - - /** - * Remove fixed child edit part. - */ - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof AppliedStereotypeLinkLabelEditPart) { - return true; - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - protected void addChildVisual(EditPart childEditPart, int index) { - if (addFixedChild(childEditPart)) { - return; - } - super.addChildVisual(childEditPart, -1); - } - - /** - * {@inheritDoc} - */ - @Override - protected void removeChildVisual(EditPart childEditPart) { - if (removeFixedChild(childEditPart)) { - return; - } - super.removeChildVisual(childEditPart); - } - - /** - * {@inheritDoc} - */ - @Override - protected void handleNotificationEvent(Notification event) { - super.handleNotificationEvent(event); - - // Update the figure when the line width changes - Object feature = event.getFeature(); - if ((getModel() != null) && (getModel() == event.getNotifier())) { - - if (NotationPackage.eINSTANCE.getLineStyle_LineWidth().equals(feature)) { - refreshLineWidth(); - refreshArrowSource(); - refreshArrowTarget(); - } else if (NotationPackage.eINSTANCE.getLineTypeStyle_LineType().equals(feature)) { - refreshLineType(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLineType(); - refreshLineWidth(); - refreshArrowSource(); - refreshArrowTarget(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void setLineWidth(int width) { - if (width < 0) { - width = 1; - } - getPrimaryShape().setLineWidth(width); - } - - /** - * {@inheritDoc} - */ - @Override - protected void setLineType(int style) { - getPrimaryShape().setLineStyle(style); - } - - /** - * {@inheritDoc} - */ - @Override - protected void setArrowSource(RotatableDecoration arrowDecoration) { - getPrimaryShape().setSourceDecoration(arrowDecoration); - } - - /** - * {@inheritDoc} - */ - @Override - protected void setArrowTarget(RotatableDecoration arrowDecoration) { - getPrimaryShape().setTargetDecoration(arrowDecoration); - } - - /** - * <pre> - * {@inheritDoc} - * - * This method override parent implementation to add a new set of - * predefined decoration type. - * - * The arrowType available constants are given in {@link EdgeDecorationType}. - * </pre> - */ - @Override - protected RotatableDecoration getArrowDecoration(int arrowType) { - RotatableDecoration decoration = null; - int width = getLineWidth(); - if (width < 0) { - width = 1; - } - if (arrowType == EdgeDecorationType.OPEN_ARROW) { - IMapMode mm = getMapMode(); - decoration = new PolylineDecoration(); - ((PolylineDecoration) decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width)); - ((PolylineDecoration) decoration).setTemplate(PolylineDecoration.TRIANGLE_TIP); - ((PolylineDecoration) decoration).setLineWidth(mm.DPtoLP(width)); - - } else if (arrowType == EdgeDecorationType.SOLID_ARROW_FILLED) { - IMapMode mm = getMapMode(); - decoration = new PolygonDecoration(); - ((PolygonDecoration) decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width)); - ((PolygonDecoration) decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP); - ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width)); - ((PolygonDecoration) decoration).setFill(true); - - } else if (arrowType == EdgeDecorationType.SOLID_ARROW_EMPTY) { - IMapMode mm = getMapMode(); - decoration = new PolygonDecoration(); - ((PolygonDecoration) decoration).setScale(mm.DPtoLP(15 + width), mm.DPtoLP(5 + width)); - ((PolygonDecoration) decoration).setTemplate(PolygonDecoration.TRIANGLE_TIP); - ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width)); - - // Not really empty... filled with white color. - ((PolygonDecoration) decoration).setFill(true); - ((PolygonDecoration) decoration).setBackgroundColor(ColorConstants.white); - - } else if (arrowType == EdgeDecorationType.SOLID_DIAMOND_FILLED) { - IMapMode mm = getMapMode(); - decoration = new PolygonDecoration(); - ((PolygonDecoration) decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width)); - - PointList diamondPointList = new PointList(); - diamondPointList.addPoint(0, 0); - diamondPointList.addPoint(-1, 1); - diamondPointList.addPoint(-2, 0); - diamondPointList.addPoint(-1, -1); - - ((PolygonDecoration) decoration).setTemplate(diamondPointList); - ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width)); - ((PolygonDecoration) decoration).setFill(true); - - } else if (arrowType == EdgeDecorationType.SOLID_DIAMOND_EMPTY) { - IMapMode mm = getMapMode(); - decoration = new PolygonDecoration(); - ((PolygonDecoration) decoration).setScale(mm.DPtoLP(12 + width), mm.DPtoLP(6 + width)); - - PointList diamondPointList = new PointList(); - diamondPointList.addPoint(0, 0); - diamondPointList.addPoint(-1, 1); - diamondPointList.addPoint(-2, 0); - diamondPointList.addPoint(-1, -1); - - ((PolygonDecoration) decoration).setTemplate(diamondPointList); - ((PolygonDecoration) decoration).setLineWidth(mm.DPtoLP(width)); - - // Not really empty... filled with white color. - ((PolygonDecoration) decoration).setFill(true); - ((PolygonDecoration) decoration).setBackgroundColor(ColorConstants.white); - } - - return decoration; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java deleted file mode 100644 index 08ca11eb035..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementNodeLabelEditPart.java +++ /dev/null @@ -1,744 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.requests.SelectionRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.TopGraphicEditPart; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.gef.ui.internal.tools.DelegatingDragEditPartsTracker; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.LabelDirectEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextNonResizableEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.TextSelectionEditPolicy; -import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator; -import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper; -import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SemanticAdapter; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.MaskManagedLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter; -import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; - -/** - * Abstract non-diagram specific edit part for labels. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public abstract class AbstractElementNodeLabelEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, ILabelRoleProvider { - - private DirectEditManager manager; - - private IParser parser; - - private List<?> parserElements; - - protected String defaultText; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - */ - protected IDirectEditorConfiguration configuration; - - /** Constructor */ - public AbstractElementNodeLabelEditPart(View view) { - super(view); - } - - /** - * Compartment-like isSelectable implementation. - * - * By default, the edit parts get selectable only if - * the compartment's top level container matches the top level - * container of the editpart that currently has the keyboard focus - * i.e: you need to select the shape first before selecting a this label. - * - * @see CompartmentEditPart#isSelectable() - */ - @Override - public boolean isSelectable() { - if (super.isSelectable()) { - EditPart focusPart = getViewer().getFocusEditPart(); - if (focusPart instanceof IGraphicalEditPart) { - TopGraphicEditPart focusTopEP = ((IGraphicalEditPart) focusPart).getTopGraphicEditPart(); - TopGraphicEditPart myTopEP = getTopGraphicEditPart(); - if (myTopEP == focusTopEP) { - // check if the selection contains only editparts belonging to - // the same top level editpart - Iterator<?> selection = getViewer().getSelectedEditParts().iterator(); - while (selection.hasNext()) { - Object editPart = selection.next(); - if (editPart instanceof IGraphicalEditPart && (((IGraphicalEditPart) editPart).getTopGraphicEditPart() != myTopEP)) { - return false; - } - } - return true; - } - } - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public DragTracker getDragTracker(Request request) { - if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) { - return null; - } - // Delegate to the main edit part. - return new DelegatingDragEditPartsTracker(this, getTopGraphicEditPart()); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new MaskManagedLabelEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new TextNonResizableEditPolicy()); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - } - - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText(text); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - defaultText = getLabelTextHelper(figure); - registerVisuals(); - refreshVisuals(); - } - - @Override - protected List<?> getModelChildren() { - return Collections.emptyList(); - } - - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - @Override - public EObject getParserElement() { - return resolveSemanticElement(); - } - - protected Image getLabelIcon() { - EObject parserElement = getParserElement(); - if (parserElement == null) { - return null; - } - - List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for (View view : views) { - if (AppearanceHelper.showElementIcon(view)) { - return org.eclipse.papyrus.sysml.diagram.common.Activator.getInstance().getLabelProvider().getImage(parserElement); - } - } - return null; - - } - - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(new SemanticAdapter(parserElement, getNotationView()), getParserOptions().intValue()); - } - if (text == null || text.length() == 0) { - text = defaultText; - } - return text; - } - - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); - } - - protected boolean isEditable() { - return getParser() != null; - } - - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl<IParserEditStatus>() { - - @Override - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - - // shouldn't get here - return null; - } - }; - } - - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); - } - - @Override - public ParserOptions getParserOptions() { - - if (getNotationView() == null || getNotationView().getDiagram() == null) { - return ParserOptions.NONE; - } - - EAnnotation display = getNotationView().getEAnnotation(VisualInformationPapyrusConstants.CUSTOM_APPEARENCE_ANNOTATION); - if (display == null) { - return getDefaultParserOptions(); - } - - // display != null - int displayOptions = Integer.parseInt(display.getDetails().get(VisualInformationPapyrusConstants.CUSTOM_APPEARANCE_MASK_VALUE)); - return new ParserOptions(displayOptions); - } - - @Override - public ParserOptions getDefaultParserOptions() { - - if (getNotationView() == null || getNotationView().getDiagram() == null) { - return ParserOptions.NONE; - } - - IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - int displayOptions = store.getInt(LabelPreferenceHelper.getPreferenceConstant(getLabelPreferenceKey(), ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE)); - if (displayOptions == 0) { - return ParserOptions.NONE; - } - - return new ParserOptions(displayOptions); - } - - @Override - public IParser getParser() { - if (parser == null) { - parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), getParserElement(), getNotationView().getType())); - } - return parser; - } - - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), new TextCellEditorLocator((WrappingLabel) this.getFigure()))); - } - return manager; - } - - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - protected void performDirectEdit() { - getManager().show(); - } - - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - @Override - protected void performDirectEditRequest(Request request) { - - final Request theRequest = request; - - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); - - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - break; - default: - break; - } - } - - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - protected void refreshLabel() { - - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof TextSelectionEditPolicy) { - ((TextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - } - - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = getParserElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - } else { - super.addSemanticListeners(); - } - } - - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * 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 - */ - public int getDirectEditionType() { - if (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - - // not a named element. no specific editor => do nothing - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * Checks if an extended editor is present. - * - * @return <code>true</code> if an extended editor is present. - */ - protected boolean checkExtendedEditor() { - if (resolveSemanticElement() != null) { - return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); - } - return false; - } - - /** - * Checks if a default direct edition is available - * - * @return <code>true</code> if a default direct edition is available - */ - protected boolean checkDefaultEdition() { - return (getParser() != null); - } - - /** - * Initializes the extended editor configuration - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); - } - } - } - - /** - * Updates the preference configuration - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * Performs the direct edit usually used by GMF editors. - * - * @param theRequest - * the direct edit request that starts the direct edit system - */ - protected void performDefaultDirectEditorEdit(final Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - @Override - protected void handleNotificationEvent(Notification event) { - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - - if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) { - refreshLabel(); - } - - super.handleNotificationEvent(event); - } - - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } - - public String getLabelPreferenceKey() { - String diagramType = getNotationView().getDiagram().getType(); - String parentType = ViewUtil.getViewContainer(getNotationView()).getType(); - String labelType = getNotationView().getType(); - return diagramType + "_" + parentType + "-" + labelType; - } - - /** - * {@inheritDoc} - */ - @Override - public abstract String getLabelRole(); - - /** - * {@inheritDoc} - */ - @Override - public abstract String getIconPathRole(); -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java deleted file mode 100644 index 8da57dd5969..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractShapeCompartmentEditPart.java +++ /dev/null @@ -1,137 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.RequestConstants; -import org.eclipse.gef.requests.SelectionRequest; -import org.eclipse.gef.tools.DeselectAllTracker; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.internal.tools.RubberbandDragTracker; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.linklf.LinkLFShapeCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; - -/** - * Abstract non-diagram specific edit part for shape compartment. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public abstract class AbstractShapeCompartmentEditPart extends LinkLFShapeCompartmentEditPart { - - public AbstractShapeCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy()); - installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); - installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomContainerEditPolicy()); - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } - - @Override - protected void handleNotificationEvent(Notification notification) { - Object feature = notification.getFeature(); - if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { - refreshBounds(); - } - super.handleNotificationEvent(notification); - } - - protected void refreshBounds() { - int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); - Dimension size = new Dimension(width, height); - int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); - Point loc = new Point(x, y); - ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); - } - - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshBounds(); - } - - /** - * Install a drag tracker supporting double click (necessary for navigation). - */ - @Override - public DragTracker getDragTracker(Request req) { - if (!supportsDragSelection()) { - return super.getDragTracker(req); - } - - if (req instanceof SelectionRequest - && ((SelectionRequest) req).getLastButtonPressed() == 3) { - return new DeselectAllTracker(this) { - - @Override - protected boolean handleButtonDown(int button) { - getCurrentViewer().select(AbstractShapeCompartmentEditPart.this); - return true; - } - }; - } - - return new RubberbandDragTracker() { - - /* - * this method has been respecified in order to allow double click - * on the compartment. - * hence it allows the navigation by double click - */ - @Override - protected boolean handleDoubleClick(int button) { - SelectionRequest request = new SelectionRequest(); - request.setLocation(getLocation()); - request.setType(RequestConstants.REQ_OPEN); - performRequest(request); - return true; - } - - @Override - protected void handleFinished() { - if (getViewer().getSelectedEditParts().isEmpty()) { - getViewer().select(AbstractShapeCompartmentEditPart.this); - } - } - - }; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java deleted file mode 100644 index fca51315244..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeAffixedLabelEditPart.java +++ /dev/null @@ -1,116 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; - -/** - * This class implements an affixed label edit part for applied stereotype representation on border items. - */ -public class AppliedStereotypeAffixedLabelEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart, IPapyrusEditPart { - - /** Constructor */ - public AppliedStereotypeAffixedLabelEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); - } - - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return constraint instanceof IBorderItemLocator ? (IBorderItemLocator) constraint : null; - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - protected IFigure createFigurePrim() { - return new AppliedStereotypeWrappingLabelFigure(); - } - - @Override - public IFigure getPrimaryShape() { - return getFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean isEditable() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * Forbid direct edition on this label. - */ - @Override - public int getDirectEditionType() { - // The label is read-only (defined in GMFGen model) - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Stereotype";//$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return "";//$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java deleted file mode 100644 index ed7894be2d6..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AppliedStereotypeLinkLabelEditPart.java +++ /dev/null @@ -1,83 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; - -/** - * Abstract non-diagram specific edit part for link label representing applied stereotypes. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public class AppliedStereotypeLinkLabelEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public AppliedStereotypeLinkLabelEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean isEditable() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * Forbid direct edition on this label. - */ - @Override - public int getDirectEditionType() { - // The label is read-only (defined in GMFGen model) - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Stereotype";//$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return "";//$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java deleted file mode 100644 index 9475db9dc26..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceMultiplicityEditPart.java +++ /dev/null @@ -1,97 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils; -import org.eclipse.uml2.uml.Association; - -/** - * Edit Part for link label showing {@link Association} source multiplicity. - */ -public class AssociationLinkLabelSourceMultiplicityEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public AssociationLinkLabelSourceMultiplicityEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.SOURCE; - } - - /** - * {@inheritDoc} - */ - @Override - public EObject getParserElement() { - EObject semanticElement = resolveSemanticElement(); - if (!(semanticElement instanceof Association)) { - return null; - } - Association association = (Association) semanticElement; - if ((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) { - View owner = ViewUtil.getContainerView(getNotationView()); - - if ((association != null) && (association.getMemberEnds().size() == 2)) { - return AssociationViewUtils.getSourceSemanticEnd(owner); - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean isEditable() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "SourceMultiplicity"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java deleted file mode 100644 index deff0c57a04..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelSourceRoleEditPart.java +++ /dev/null @@ -1,89 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils; -import org.eclipse.uml2.uml.Association; - -/** - * Edit Part for link label showing {@link Association} source role. - */ -public class AssociationLinkLabelSourceRoleEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public AssociationLinkLabelSourceRoleEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.SOURCE; - } - - /** - * {@inheritDoc} - */ - @Override - public EObject getParserElement() { - EObject semanticElement = resolveSemanticElement(); - if (!(semanticElement instanceof Association)) { - return null; - } - Association association = (Association) semanticElement; - if ((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) { - View owner = ViewUtil.getContainerView(getNotationView()); - - if ((association != null) && (association.getMemberEnds().size() == 2)) { - return AssociationViewUtils.getSourceSemanticEnd(owner); - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "SourceRole"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java deleted file mode 100644 index 8a6ed49d0ec..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetMultiplicityEditPart.java +++ /dev/null @@ -1,97 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils; -import org.eclipse.uml2.uml.Association; - -/** - * Edit Part for link label showing {@link Association} target multiplicity. - */ -public class AssociationLinkLabelTargetMultiplicityEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public AssociationLinkLabelTargetMultiplicityEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.TARGET; - } - - /** - * {@inheritDoc} - */ - @Override - public EObject getParserElement() { - EObject semanticElement = resolveSemanticElement(); - if (!(semanticElement instanceof Association)) { - return null; - } - Association association = (Association) semanticElement; - if ((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) { - View owner = ViewUtil.getContainerView(getNotationView()); - - if ((association != null) && (association.getMemberEnds().size() == 2)) { - return AssociationViewUtils.getTargetSemanticEnd(owner); - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean isEditable() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "TargetMultiplicity"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java deleted file mode 100644 index d87bef97665..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AssociationLinkLabelTargetRoleEditPart.java +++ /dev/null @@ -1,89 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils; -import org.eclipse.uml2.uml.Association; - -/** - * Edit Part for link label showing {@link Association} target role. - */ -public class AssociationLinkLabelTargetRoleEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public AssociationLinkLabelTargetRoleEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.TARGET; - } - - /** - * {@inheritDoc} - */ - @Override - public EObject getParserElement() { - EObject semanticElement = resolveSemanticElement(); - if (!(semanticElement instanceof Association)) { - return null; - } - Association association = (Association) semanticElement; - if ((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) { - View owner = ViewUtil.getContainerView(getNotationView()); - - if ((association != null) && (association.getMemberEnds().size() == 2)) { - return AssociationViewUtils.getTargetSemanticEnd(owner); - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "TargetRole"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java deleted file mode 100644 index 2249fb48cac..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelEditPart.java +++ /dev/null @@ -1,55 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; - -/** - * Edit Part for link label showing {@link Connector} label. - */ -public class ConnectorLinkLabelEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public ConnectorLinkLabelEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Label"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java deleted file mode 100644 index e55d3f0cb2f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelSourceMultiplicityEditPart.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.ConnectorEnd; - -/** - * Edit Part for link label showing {@link Connector} source {@link ConnectorEnd} multiplicity. - */ -public class ConnectorLinkLabelSourceMultiplicityEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public ConnectorLinkLabelSourceMultiplicityEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.SOURCE; - } - - /** - * {@inheritDoc} - */ - @Override - public EObject getParserElement() { - Connector connector = (Connector) resolveSemanticElement(); - if ((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) { - View owner = ViewUtil.getContainerView(getNotationView()); - - if ((connector != null) && (connector.getEnds().size() == 2)) { - return connector.getEnds().get(0); - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean isEditable() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "SourceMultiplicity"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java deleted file mode 100644 index e628c640486..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorLinkLabelTargetMultiplicityEditPart.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.ConnectionLocator; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.ConnectorEnd; - -/** - * Edit Part for link label showing {@link Connector} target {@link ConnectorEnd} multiplicity. - */ -public class ConnectorLinkLabelTargetMultiplicityEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public ConnectorLinkLabelTargetMultiplicityEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public int getKeyPoint() { - return ConnectionLocator.TARGET; - } - - /** - * {@inheritDoc} - */ - @Override - public EObject getParserElement() { - Connector connector = (Connector) resolveSemanticElement(); - if ((getNotationView() != null) && (ViewUtil.getContainerView(getNotationView()) != null)) { - View owner = ViewUtil.getContainerView(getNotationView()); - - if ((connector != null) && (connector.getEnds().size() == 2)) { - connector.getEnds().get(1); - } - } - - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean isEditable() { - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "TargetMultiplicity"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java deleted file mode 100644 index 9fec4daad7b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintNodeLabelEditPart.java +++ /dev/null @@ -1,789 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.transaction.RecordingCommand; -import org.eclipse.emf.transaction.RunnableWithResult; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.AccessibleEditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.DirectEditRequest; -import org.eclipse.gef.tools.DirectEditManager; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; -import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; -import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.gmf.runtime.notation.FontStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.viewers.ICellEditorValidator; -import org.eclipse.jface.window.Window; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; -import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; -import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; -import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; -import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; -import org.eclipse.papyrus.infra.gmfdiag.common.commands.SemanticAdapter; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; -import org.eclipse.papyrus.uml.diagram.composite.edit.parts.UMLEditPartFactory; -import org.eclipse.papyrus.uml.diagram.composite.edit.policies.UMLTextSelectionEditPolicy; -import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry; -import org.eclipse.papyrus.uml.diagram.composite.providers.UMLElementTypes; -import org.eclipse.papyrus.uml.diagram.composite.providers.UMLParserProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.PlatformUI; -import org.eclipse.uml2.uml.Constraint; -import org.eclipse.uml2.uml.Feature; - -/** - * Abstract non-diagram specific edit part for node label representing {@link Constraint}. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public class ConstraintNodeLabelEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart { - - /** - * @generated - */ - private DirectEditManager manager; - - /** - * @generated - */ - private IParser parser; - - /** - * @generated - */ - private List<?> parserElements; - - /** - * direct edition mode (default, undefined, registered editor, etc.) - * - * @generated - */ - protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; - - /** - * configuration from a registered edit dialog - * - * @generated - */ - protected IDirectEditorConfiguration configuration; - - /** - * @generated - */ - public ConstraintNodeLabelEditPart(View view) { - super(view); - } - - /** - * @generated - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); - installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy()); - } - - /** - * @generated - */ - protected String getLabelTextHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getText(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getText(); - } else { - return ((Label) figure).getText(); - } - } - - /** - * @generated - */ - protected void setLabelTextHelper(IFigure figure, String text) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setText("{" + text + "}"); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setText(text); - } else { - ((Label) figure).setText(text); - } - } - - /** - * @generated - */ - protected Image getLabelIconHelper(IFigure figure) { - if (figure instanceof WrappingLabel) { - return ((WrappingLabel) figure).getIcon(); - } else if (figure instanceof ILabelFigure) { - return ((ILabelFigure) figure).getIcon(); - } else { - return ((Label) figure).getIcon(); - } - } - - /** - * @generated - */ - protected void setLabelIconHelper(IFigure figure, Image icon) { - if (figure instanceof WrappingLabel) { - ((WrappingLabel) figure).setIcon(icon); - } else if (figure instanceof ILabelFigure) { - ((ILabelFigure) figure).setIcon(icon); - } else { - ((Label) figure).setIcon(icon); - } - } - - /** - * @generated - */ - public void setLabel(WrappingLabel figure) { - unregisterVisuals(); - setFigure(figure); - registerVisuals(); - refreshVisuals(); - } - - /** - * @generated - */ - @Override - @SuppressWarnings("rawtypes") - protected List getModelChildren() { - return Collections.EMPTY_LIST; - } - - /** - * @generated - */ - @Override - public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { - return null; - } - - /** - * @generated - */ - protected EObject getParserElement() { - return resolveSemanticElement(); - } - - /** - * @generated - */ - protected Image getLabelIcon() { - return null; - } - - /** - * @generated - */ - protected String getLabelText() { - String text = null; - EObject parserElement = getParserElement(); - if (parserElement != null && getParser() != null) { - text = getParser().getPrintString(new SemanticAdapter(parserElement, getNotationView()), getParserOptions().intValue()); - } - if (text == null) { - text = ""; - } - return text; - } - - /** - * @generated - */ - @Override - public void setLabelText(String text) { - setLabelTextHelper(getFigure(), text); - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - @Override - public String getEditText() { - if (getParserElement() == null || getParser() == null) { - return ""; //$NON-NLS-1$ - } - return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()); - } - - /** - * @generated - */ - protected boolean isEditable() { - return getParser() != null; - } - - /** - * @generated - */ - @Override - public ICellEditorValidator getEditTextValidator() { - return new ICellEditorValidator() { - - @Override - @SuppressWarnings("rawtypes") - public String isValid(final Object value) { - if (value instanceof String) { - final EObject element = getParserElement(); - final IParser parser = getParser(); - try { - IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() { - - @Override - @SuppressWarnings("unchecked") - public void run() { - setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); - } - }); - return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); - } catch (InterruptedException ie) { - ie.printStackTrace(); - } - } - // shouldn't get here - return null; - } - }; - } - - /** - * @generated - */ - @Override - public IContentAssistProcessor getCompletionProcessor() { - if (getParserElement() == null || getParser() == null) { - return null; - } - return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); - } - - /** - * @generated - */ - @Override - public ParserOptions getParserOptions() { - return ParserOptions.NONE; - } - - /** - * @generated - */ - @Override - public IParser getParser() { - if (parser == null) { - parser = UMLParserProvider.getParser(UMLElementTypes.Constraint_Shape_CN, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.composite.edit.parts.ConstraintSpecificationEditPartCN.VISUAL_ID)); - } - return parser; - } - - /** - * @generated - */ - protected DirectEditManager getManager() { - if (manager == null) { - setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), UMLEditPartFactory.getTextCellEditorLocator(this))); - } - return manager; - } - - /** - * @generated - */ - protected void setManager(DirectEditManager manager) { - this.manager = manager; - } - - /** - * @generated - */ - protected void performDirectEdit() { - getManager().show(); - } - - /** - * @generated - */ - protected void performDirectEdit(Point eventLocation) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); - } - } - - /** - * @generated - */ - private void performDirectEdit(char initialCharacter) { - if (getManager() instanceof TextDirectEditManager) { - ((TextDirectEditManager) getManager()).show(initialCharacter); - } else { - performDirectEdit(); - } - } - - /** - * @generated - */ - @Override - protected void performDirectEditRequest(Request request) { - final Request theRequest = request; - if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { - directEditionMode = getDirectEditionType(); - } - switch (directEditionMode) { - case IDirectEdition.NO_DIRECT_EDITION: - // no direct edition mode => does nothing - return; - case IDirectEdition.EXTENDED_DIRECT_EDITOR: - updateExtendedEditorConfiguration(); - if (configuration == null || configuration.getLanguage() == null) { - performDefaultDirectEditorEdit(theRequest); - } else { - configuration.preEditAction(resolveSemanticElement()); - Dialog dialog = null; - if (configuration instanceof IPopupEditorConfiguration) { - IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); - helper.showEditor(); - return; - } else if (configuration instanceof IAdvancedEditorConfiguration) { - dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); - } else if (configuration instanceof IDirectEditorConfiguration) { - dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); - } else { - return; - } - final Dialog finalDialog = dialog; - if (Window.OK == dialog.open()) { - TransactionalEditingDomain domain = getEditingDomain(); - RecordingCommand command = new RecordingCommand(domain, "Edit Label") { - - @Override - protected void doExecute() { - configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); - } - }; - domain.getCommandStack().execute(command); - } - } - break; - case IDirectEdition.DEFAULT_DIRECT_EDITOR: - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - break; - default: - break; - } - } - - /** - * @generated - */ - @Override - protected void refreshVisuals() { - super.refreshVisuals(); - refreshLabel(); - refreshFont(); - refreshFontColor(); - refreshUnderline(); - refreshStrikeThrough(); - } - - /** - * @generated - */ - protected void refreshLabel() { - EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); - if (maskLabelPolicy == null) { - setLabelTextHelper(getFigure(), getLabelText()); - setLabelIconHelper(getFigure(), getLabelIcon()); - } - Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); - } - Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); - if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { - ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); - } - } - - /** - * @generated - */ - protected void refreshUnderline() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); - } - if (resolveSemanticElement() instanceof Feature) { - if (((Feature) resolveSemanticElement()).isStatic()) { - ((WrappingLabel) getFigure()).setTextUnderline(true); - } else { - ((WrappingLabel) getFigure()).setTextUnderline(false); - } - } - } - - /** - * @generated - */ - protected void refreshStrikeThrough() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null && getFigure() instanceof WrappingLabel) { - ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); - } - } - - /** - * @generated - */ - @Override - protected void refreshFont() { - FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle()); - if (style != null) { - FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); - setFont(fontData); - } - } - - /** - * @generated - */ - @Override - protected void setFontColor(Color color) { - getFigure().setForegroundColor(color); - } - - @Override - protected void addSemanticListeners() { - if (getParser() instanceof ISemanticParser) { - EObject element = resolveSemanticElement(); - parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); - for (int i = 0; i < parserElements.size(); i++) { - addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ - } - addListenerFilter("SemanticModelConstraintOwner", this, element); // in order to refresh label when ConstraintSpecification creation - } else { - super.addSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected void removeSemanticListeners() { - if (parserElements != null) { - for (int i = 0; i < parserElements.size(); i++) { - removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ - } - } else { - super.removeSemanticListeners(); - } - } - - /** - * @generated - */ - @Override - protected AccessibleEditPart getAccessibleEditPart() { - if (accessibleEP == null) { - accessibleEP = new AccessibleGraphicalEditPart() { - - @Override - public void getName(AccessibleEvent e) { - e.result = getLabelTextHelper(getFigure()); - } - }; - } - return accessibleEP; - } - - /** - * @generated - */ - private View getFontStyleOwnerView() { - return getPrimaryView(); - } - - /** - * 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 (checkExtendedEditor()) { - initExtendedEditorConfiguration(); - return IDirectEdition.EXTENDED_DIRECT_EDITOR; - } - if (checkDefaultEdition()) { - return IDirectEdition.DEFAULT_DIRECT_EDITOR; - } - // not a named element. no specific editor => do nothing - return IDirectEdition.NO_DIRECT_EDITION; - } - - /** - * 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 DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); - } - return false; - } - - /** - * 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); - } - - /** - * Initializes the extended editor configuration - * - * @generated - */ - protected void initExtendedEditorConfiguration() { - if (configuration == null) { - final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("")) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else { - configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); - } - } - } - - /** - * Updates the preference configuration - * - * @generated - */ - protected void updateExtendedEditorConfiguration() { - String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); - if (languagePreferred != null && !languagePreferred.equals("") && languagePreferred != configuration.getLanguage()) { - configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); - } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { - configuration = null; - } - } - - /** - * 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 Request theRequest) { - // initialize the direct edit manager - try { - getEditingDomain().runExclusive(new Runnable() { - - @Override - public void run() { - if (isActive() && isEditable()) { - if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { - Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); - performDirectEdit(initialChar.charValue()); - } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { - DirectEditRequest editRequest = (DirectEditRequest) theRequest; - performDirectEdit(editRequest.getLocation()); - } else { - performDirectEdit(); - } - } - } - }); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - /** - * @generated - */ - @Override - protected void addNotationalListeners() { - super.addNotationalListeners(); - addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void removeNotationalListeners() { - super.removeNotationalListeners(); - removeListenerFilter("PrimaryView"); //$NON-NLS-1$ - } - - /** - * @generated - */ - @Override - protected void handleNotificationEvent(Notification event) { - refreshLabel(); - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { - Integer c = (Integer) event.getNewValue(); - setFontColor(DiagramColorRegistry.getInstance().getColor(c)); - } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { - refreshUnderline(); - } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { - refreshStrikeThrough(); - } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) - || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { - refreshFont(); - } else { - if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { - refreshLabel(); - } - if (getParser() instanceof ISemanticParser) { - ISemanticParser modelParser = (ISemanticParser) getParser(); - if (modelParser.areSemanticElementsAffected(null, event)) { - removeSemanticListeners(); - if (resolveSemanticElement() != null) { - addSemanticListeners(); - } - refreshLabel(); - } - } - } - super.handleNotificationEvent(event); - } - - /** - * @generated - */ - @Override - protected IFigure createFigure() { - // Parent should assign one using setLabel() method - return null; - } - - /** - * @generated - */ - private static final String ADD_PARENT_MODEL = "AddParentModel"; - - /** - * @generated - */ - @Override - public void activate() { - super.activate(); - addOwnerElementListeners(); - } - - /** - * @generated - */ - protected void addOwnerElementListeners() { - addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); - } - - /** - * @generated - */ - @Override - public void deactivate() { - removeOwnerElementListeners(); - super.deactivate(); - } - - /** - * @generated - */ - protected void removeOwnerElementListeners() { - removeListenerFilter(ADD_PARENT_MODEL); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java deleted file mode 100644 index f444f354991..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/DefaultChildLabelEditPart.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; - -/** - * Default implementation for child label node. - */ -public class DefaultChildLabelEditPart extends AbstractElementChildLabelEditPart { - - /** Constructor */ - public DefaultChildLabelEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java deleted file mode 100644 index be434b24f66..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementAffixedLabelNameEditPart.java +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; -import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.NamedElement; - -/** - * Abstract non-diagram specific edit part for border node label representing {@link NamedElement}. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public class NamedElementAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart { - - /** Constructor */ - public NamedElementAffixedLabelNameEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return (IBorderItemLocator) constraint; - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected Image getLabelIcon() { - EObject parserElement = getParserElement(); - if (parserElement == null) { - return null; - } - - List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for (View view : views) { - if (NameLabelIconHelper.showLabelIcon(view)) { - return Activator.getInstance().getImage(parserElement.eClass()); - } - } - return null; - - } - - /** - * {@inheritDoc} - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - protected IFigure createFigurePrim() { - return new PapyrusWrappingLabel(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Name"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java deleted file mode 100644 index 9fd5a7198b0..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementLinkLabelNameEditPart.java +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.gef.EditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.PapyrusLinkLabelDragPolicy; -import org.eclipse.uml2.uml.NamedElement; - -/** - * Edit Part for link label showing {@link NamedElement} name. - */ -public class NamedElementLinkLabelNameEditPart extends AbstractElementLabelEditPart { - - /** Constructor */ - public NamedElementLinkLabelNameEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new PapyrusLinkLabelDragPolicy()); - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Name"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java deleted file mode 100644 index 321bb2fdca0..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/NamedElementNodeLabelNameEditPart.java +++ /dev/null @@ -1,52 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.NamedElement; - -/** - * Abstract non-diagram specific edit part for node label representing {@link NamedElement}. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public class NamedElementNodeLabelNameEditPart extends AbstractElementNodeLabelEditPart { - - public NamedElementNodeLabelNameEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Name"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java deleted file mode 100644 index 70d3db8ff42..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedLabelNameEditPart.java +++ /dev/null @@ -1,119 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.uml.diagram.common.util.DiagramEditPartsUtil; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.Port; - -/** - * This class implements a {@link Port} affixed label edit part. - */ -public class PortAffixedLabelNameEditPart extends AbstractElementLabelEditPart implements IBorderItemEditPart { - - /** Constructor */ - public PortAffixedLabelNameEditPart(View view) { - super(view); - addSnapBackLocation(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - /** - * @see org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart#getDefaultTextAlignment() - * - * @return - */ - @Override - protected int getDefaultTextAlignment() { - return PositionConstants.LEFT; - } - - @Override - public IBorderItemLocator getBorderItemLocator() { - IFigure parentFigure = getFigure().getParent(); - if (parentFigure != null && parentFigure.getLayoutManager() != null) { - Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); - return constraint instanceof IBorderItemLocator ? (IBorderItemLocator) constraint : null; - } - return null; - } - - /** - * {@inheritDoc} - */ - @Override - protected Image getLabelIcon() { - EObject parserElement = getParserElement(); - if (parserElement == null) { - return null; - } - - List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); - for (View view : views) { - if (AppearanceHelper.showElementIcon(view)) { - return Activator.getInstance().getLabelProvider().getImage(parserElement); - } - } - return null; - - } - - /** - * {@inheritDoc} - */ - @Override - protected IFigure createFigure() { - IFigure label = createFigurePrim(); - defaultText = getLabelTextHelper(label); - return label; - } - - protected IFigure createFigurePrim() { - return new PapyrusWrappingLabel(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Label"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java deleted file mode 100644 index 05446ab6a64..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyNodeLabelEditPart.java +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; - -/** - * Abstract non-diagram specific edit part for node label representing {@link Property}. - * This class is adapted from edit parts generated by GMF Tooling. - */ -public class PropertyNodeLabelEditPart extends AbstractElementNodeLabelEditPart { - - public PropertyNodeLabelEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } - - /** - * {@inheritDoc} - */ - @Override - public String getLabelRole() { - return "Label"; //$NON-NLS-1$ - } - - /** - * {@inheritDoc} - */ - @Override - public String getIconPathRole() { - return ""; //$NON-NLS-1$ - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java deleted file mode 100644 index fce649339b9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/SlotChildLabelEditPart.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Slot; - -/** - * Edit part for {@link Slot} used as Child label node. - */ -public class SlotChildLabelEditPart extends AbstractElementChildLabelEditPart { - - /** Constructor */ - public SlotChildLabelEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java deleted file mode 100644 index 683b933e63c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/EncapsulatedClassifierResizableShapeEditPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.policy; - -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; - -/** - * <pre> - * This class modifies EncapsulatedClassifier default resize command in order to move - * any Port IBorderItem possibly attached. - * See. bug. https://bugs.eclipse.org/bugs/show_bug.cgi?id=354814 - * Could not find a more general way to do this without making any assumption about - * the kind of attached IBorderItem and that would only rely on its IBorderItemLocator. - * </pre> - */ -public class EncapsulatedClassifierResizableShapeEditPolicy extends org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies.EncapsulatedClassifierResizableShapeEditPolicy { - - /** - * <pre> - * {@inheritDoc} - * - * Forbid AutoSize for elements that can hold Port, it currently - * leads to Port (FlowPort) with incorrect location stored in notation, - * and possible incorrect visual representation (FlowPort). - * </pre> - */ - @Override - protected Command getAutoSizeCommand(Request request) { - return UnexecutableCommand.INSTANCE; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java deleted file mode 100644 index b8c32595146..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/MaskManagedLabelEditPolicy.java +++ /dev/null @@ -1,107 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.policy; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.gef.editpolicies.GraphicalEditPolicy; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.edit.part.ITextAwareEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper; -import org.eclipse.papyrus.uml.diagram.common.parser.IMaskManagedSemanticParser; - - -/** - * <pre> - * Generic mask manage edit policy for {@link ITextAwareEditPart}, managed masks are assumed to be given by the - * {@link ITextAwareEditPart} parser (must implement {@link IMaskManagedSemanticParser}). - * </pre> - */ -public class MaskManagedLabelEditPolicy extends GraphicalEditPolicy implements IMaskManagedLabelEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - - IParser parser = getHostLabelEditPart().getParser(); - if (parser instanceof IMaskManagedSemanticParser) { - masks = ((IMaskManagedSemanticParser) parser).getMasks(); - } - - return masks; - } - - /** - * {@inheritDoc} - */ - @Override - public Collection<String> getCurrentDisplayValue() { - Collection<String> result = MaskLabelHelper.getMaskValues(getView()); - if (result == null) { - IParser parser = getHostLabelEditPart().getParser(); - if (parser instanceof IMaskManagedSemanticParser) { - result = ((IMaskManagedSemanticParser) parser).getDefaultValue(getHost()); - } - } - - if (result == null) { - return Collections.emptySet(); - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public void updateDisplayValue(Collection<String> maskValues) { - MaskLabelHelper.setMaskValues(getView(), maskValues); - } - - /** - * {@inheritDoc} - */ - @Override - public void setDefaultDisplayValue() { - MaskLabelHelper.unsetMaskValues(getView()); - } - - // @unused. - @Override - public void refreshDisplay() { - // Not implemented. - } - - /** - * Get the host label edit part (has to implement {@link ITextAwareEditPart}). - * - * @return the host label edit part. - */ - private ITextAwareEditPart getHostLabelEditPart() { - return (ITextAwareEditPart) getHost(); - } - - private View getView() { - return (View) getHost().getModel(); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java deleted file mode 100644 index 08a6de67b6d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java +++ /dev/null @@ -1,191 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.policy; - -import java.util.Collections; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.SnapToHelper; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.commands.UnexecutableCommand; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.commands.CreateViewCommand; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool; -import org.eclipse.papyrus.infra.gmfdiag.common.snap.NodeSnapHelper; -import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; - -/** - * Replaces the {@link DefaultCreationEditPolicy} in order to manage Affixed Port position on creation or on drop. - */ -public class StructuredClassifierCreationEditPolicy extends CreationEditPolicy { - - /** - * {@inheritDoc} - */ - @Override - protected Command getReparentCommand(ChangeBoundsRequest request) { - // Forbid re-parent in this edit policy (to be used by compartment) - // in order to avoid node to be moved in compartments. - return UnexecutableCommand.INSTANCE; - } - - /** - * <pre> - * {@inheritDoc} - * - * The goal here is to create the view and to move it at the mouse location, - * respecting a given locator. It is assumed that only affixed Port can be created on - * edit part that have this edit policy, and the locator is a {@link PortPositionLocator}. - * - * @see DefaultCreationEditPolicy#getCreateCommand(). - * </pre> - */ - @Override - protected Command getCreateCommand(CreateViewRequest request) { - - // This overrides getCreateCommand in order to use a specific CreateViewCommand (instead of - // org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand. - - // The original CreateCommand#canExecute() implementation rely on ViewProvider#provides(CreateViewForKindOperation op) - // method to know if a view can be created. The problem is that this method is incorrectly generated by GMF Tooling and should be avoided. - - // CreateViewCommand replace the semantic adapter in its call to ViewService to know if a provider exists. - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - CompositeTransactionalCommand cc = new CompositeTransactionalCommand(editingDomain, DiagramUIMessages.AddCommand_Label); - - Iterator<? extends ViewDescriptor> descriptors = request.getViewDescriptors().iterator(); - while (descriptors.hasNext()) { - - CreateViewRequest.ViewDescriptor descriptor = descriptors.next(); - ICommand createCommand = new CreateViewCommand(editingDomain, descriptor, (View) (getHost().getModel())); - - // Add SetBounds - createCommand = CompositeCommand.compose(createCommand, getSetBoundsCommand(request, descriptor)); - // - - cc.compose(createCommand); - - } - - return new ICommandProxy(cc.reduce()); - - } - - /** - * Get a SetBoundsCommand to move a new view at current mouse position. - * - * @param request - * The creation request. - * @param descriptor - * The descriptor of the new element. - * @return The set bounds command. - */ - private ICommand getSetBoundsCommand(CreateViewRequest request, CreateViewRequest.ViewDescriptor descriptor) { - ICommand setBoundsCommand = null; - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - - // Retrieve parent location - Point parentLoc = getHostFigure().getBounds().getLocation().getCopy(); - - - final Point realWantedLocation; - Map<?, ?> params = request.getExtendedData(); - Point realLocation = (Point) params.get(AspectUnspecifiedTypeCreationTool.INITIAL_MOUSE_LOCATION_FOR_CREATION); - if (realLocation != null) { - realWantedLocation = realLocation.getCopy(); - } else { - // we use this location to be able to create Port in the corners of the figure - realWantedLocation = request.getLocation().getCopy(); - } - - // Compute relative creation location - Point requestedLocation = realWantedLocation.getCopy(); - - - - getHostFigure().translateToRelative(requestedLocation); - - // Create proposed creation bounds and use the locator to find the expected position - PortPositionLocator locator = new PortPositionLocator(getHostFigure(), PositionConstants.NONE); - final Rectangle preferredBounds = locator.getPreferredLocation(new Rectangle(requestedLocation, new Dimension(20, 20))); - Rectangle retainedBounds = preferredBounds.getCopy(); - - // find the current side of the wanted position - final Rectangle parentBounds = getHostFigure().getBounds().getCopy(); - // break all!!! getHostFigure().translateToAbsolute(parentBounds); - locator.setConstraint(preferredBounds.getCopy().translate(parentBounds.getLocation().getNegated())); - int currentSide = locator.getCurrentSideOfParent(); - if (request.isSnapToEnabled() && currentSide != PositionConstants.NORTH_EAST && currentSide != PositionConstants.NORTH_WEST && currentSide != PositionConstants.SOUTH_EAST && currentSide != PositionConstants.SOUTH_WEST) { // request for snap port at the - // creation - // we find the best location with snap - Point wantedPoint = preferredBounds.getLocation(); - getHostFigure().translateToAbsolute(wantedPoint); - Rectangle portBounds = new Rectangle(wantedPoint, new Dimension(20, 20)); - NodeSnapHelper helper = new NodeSnapHelper((SnapToHelper) getHost().getAdapter(SnapToHelper.class), portBounds, false, false, true); - final ChangeBoundsRequest tmpRequest = new ChangeBoundsRequest("move"); //$NON-NLS-1$ - tmpRequest.setEditParts(Collections.emptyList()); - tmpRequest.setSnapToEnabled(true); - tmpRequest.setLocation(portBounds.getLocation()); - helper.snapPoint(tmpRequest); - preferredBounds.translate(tmpRequest.getMoveDelta()); - - switch (currentSide) { - case PositionConstants.NORTH: - case PositionConstants.SOUTH: - preferredBounds.y = retainedBounds.y; - break; - case PositionConstants.EAST: - case PositionConstants.WEST: - preferredBounds.x = retainedBounds.x; - break; - default: - break; - } - } - // Convert the calculated preferred bounds as relative to parent location - Rectangle creationBounds = preferredBounds.getTranslated(parentLoc.getNegated()); - setBoundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, creationBounds); - return setBoundsCommand; - } - - /** - * Convenience method to return the host's Figure. - * - * @return The host GraphicalEditPart's Figure - */ - private IFigure getHostFigure() { - return ((GraphicalEditPart) getHost()).getFigure(); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/factory/AssociationLinkViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/factory/AssociationLinkViewFactory.java deleted file mode 100644 index 8cedb0f8335..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/factory/AssociationLinkViewFactory.java +++ /dev/null @@ -1,100 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.EObjectValueStyle; -import org.eclipse.gmf.runtime.notation.Edge; -import org.eclipse.gmf.runtime.notation.NotationFactory; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ConnectorViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.AssociationViewUtils; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.Property; - -/** - * View factory for Association. - */ -public class AssociationLinkViewFactory extends ConnectorViewFactory { - - /** - * <pre> - * {@inheritDoc} - * - * Add two EObjectValueStyle in order to store the Properties that are associated with - * the Graphical ends. - * </pre> - */ - @Override - protected List createStyles(View view) { - - EObjectValueStyle sourceStyle = NotationFactory.eINSTANCE.createEObjectValueStyle(); - sourceStyle.setName(AssociationViewUtils.SEMANTIC_SOURCE_END); - - EObjectValueStyle targetStyle = NotationFactory.eINSTANCE.createEObjectValueStyle(); - targetStyle.setName(AssociationViewUtils.SEMANTIC_TARGET_END); - - view.getStyles().add(sourceStyle); - view.getStyles().add(targetStyle); - - return super.createStyles(view); - } - - /** - * <pre> - * {@inheritDoc} - * - * Store {@link Association} semantic ends (Property) in dedicated styles. - * </pre> - */ - @Override - public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) { - Edge view = (Edge) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint); - - if ((view != null) && (view.getElement() != null) && (view.getElement() instanceof Association)) { - Association association = (Association) view.getElement(); - - assert (association.getMemberEnds().size() == 2); - - Property propertySource = association.getMemberEnds().get(0); - Property propertyTarget = association.getMemberEnds().get(1); - - AssociationViewUtils.setSourceSemanticEnd(view, propertySource); - AssociationViewUtils.setTargetSemanticEnd(view, propertyTarget); - } - - return view; - } - - /** - * Creates Association view and add Label nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_ASSOCIATION_SOURCE_ROLE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_ASSOCIATION_SOURCE_MULTIPLICITY_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_ASSOCIATION_TARGET_ROLE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_ASSOCIATION_TARGET_MULTIPLICITY_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/factory/ClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/factory/ClassifierViewFactory.java deleted file mode 100644 index f52c3a73ce5..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/factory/ClassifierViewFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * View factory for UML Classifier. - * - * FIXME : NestedClassifier compartment is not yet supported. - */ -public class ClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates Classifier view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - - getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.COMPARTMENT_UML_PROPERTY_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.COMPARTMENT_UML_OPERATION_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java deleted file mode 100644 index dd9cf5719ed..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/ConnectorEdgeFigure.java +++ /dev/null @@ -1,85 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; - -/** - * Figure for UML {@link Connector} Edges. - */ -public class ConnectorEdgeFigure extends NamedElementEdgeFigure { - - /** The multiplicity source label. */ - private WrappingLabel fSourceMultiplicityLabel; - - /** The multiplicity target label. */ - private WrappingLabel fTargetMultiplicityLabel; - - /** - * Instantiates a new association figure. - */ - public ConnectorEdgeFigure() { - super(); - createContents(); - } - - /** - * Creates the contents. - */ - @Override - protected void createContents() { - super.createContents(); - - fSourceMultiplicityLabel = new PapyrusWrappingLabel(); - fSourceMultiplicityLabel.setText(""); - - this.add(fSourceMultiplicityLabel); - - fTargetMultiplicityLabel = new PapyrusWrappingLabel(); - fTargetMultiplicityLabel.setText(""); - - this.add(fTargetMultiplicityLabel); - - } - - /** - * Gets the applied stereotype association label. - * - * @return the applied stereotype association label - */ - @Override - public WrappingLabel getAppliedStereotypeLabel() { - return appliedStereotypeLabel; - } - - /** - * Gets the multiplicity source label. - * - * @return the multiplicity source label - */ - public WrappingLabel getSourceMultiplicityLabel() { - return fSourceMultiplicityLabel; - } - - /** - * Gets the multiplicity target label. - * - * @return the multiplicity target label - */ - public WrappingLabel getTargetMultiplicityLabel() { - return fTargetMultiplicityLabel; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java deleted file mode 100644 index 7a644b7cf30..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/EdgeDecorationType.java +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import org.eclipse.gmf.runtime.notation.ArrowType; - -/** - * <pre> - * The class provides a list of predefined ids to create edge decorations. - * - * Also see : org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLinkEditPart#getArrowDecoration(). - * </pre> - */ -public final class EdgeDecorationType { - - public static final int NONE = ArrowType.NONE; // 0 - - public static final int OPEN_ARROW = ArrowType.OPEN_ARROW; // 1 - - public static final int SOLID_ARROW_FILLED = ArrowType.SOLID_ARROW; // 2 - - public static final int SOLID_ARROW_EMPTY = 3; - - public static final int SOLID_DIAMOND_FILLED = 4; - - public static final int SOLID_DIAMOND_EMPTY = 5; - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java deleted file mode 100644 index 51a89d59f97..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/GeneralizationFigure.java +++ /dev/null @@ -1,26 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure; - -/** - * Figure for UML Generalization Edges. - */ -public class GeneralizationFigure extends UMLEdgeFigure { - - public GeneralizationFigure() { - super(); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java deleted file mode 100644 index 2511b00e612..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceRealizationFigure.java +++ /dev/null @@ -1,24 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -/** - * Figure for UML InterfaceRealization Edges. - */ -public class InterfaceRealizationFigure extends NamedElementEdgeFigure { - - public InterfaceRealizationFigure() { - super(); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java deleted file mode 100644 index 889906a6b2d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/figure/NamedElementEdgeFigure.java +++ /dev/null @@ -1,64 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.papyrus.uml.diagram.common.figure.edge.UMLEdgeFigure; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; - -/** - * <pre> - * This edge figure support stereotype application and name labels, - * and does not make any assumption on style, decorations, and width. - * These properties are managed by the edit part. - * - * This figure also provides its own custom dash pattern that can be use calling - * setLineType(Graphics.LINE_CUSTOM); - * </pre> - */ -public class NamedElementEdgeFigure extends UMLEdgeFigure { - - private WrappingLabel nameLabel; - - /** Dashes used to paint line. */ - private final int[] dashes = new int[10]; - - public NamedElementEdgeFigure() { - super(); - - // set dashes - for (int i = 0; i < 10; i++) { - dashes[i] = 5; - } - setLineDash(dashes); - - createContents(); - } - - public WrappingLabel getNameLabel() { - return nameLabel; - } - - /** - * @generated - */ - @Override - protected void createContents() { - super.createContents(); - nameLabel = new PapyrusWrappingLabel(); - nameLabel.setText(""); - - this.add(nameLabel); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java deleted file mode 100644 index 9cb1c33b8fd..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/AssociationEndLabelParser.java +++ /dev/null @@ -1,183 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.uml2.uml.VisibilityKind; - -/** - * Semantic Parser for {@link Property} used as {@link Association} end. - */ -public class AssociationEndLabelParser extends PropertyLabelParser { - - /** The String format for displaying a {@link Property} label with modifiers */ - protected static final String ALT_MODIFIER_FORMAT = "{%s}%s"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Property)) { - - Property property = (Property) eObject; - - // manage visibility - if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { - String visibility; - switch (property.getVisibility().getValue()) { - case VisibilityKind.PACKAGE: - visibility = "~"; - break; - case VisibilityKind.PUBLIC: - visibility = "+"; - break; - case VisibilityKind.PROTECTED: - visibility = "#"; - break; - case VisibilityKind.PRIVATE: - visibility = "-"; - break; - default: - visibility = "+"; - break; - } - result = String.format(VISIBILITY_FORMAT, visibility, result); - } - - // manage derived modifier - if (maskValues.contains(ICustomAppearance.DISP_DERIVE) && property.isDerived()) { - result = String.format(DERIVED_FORMAT, result); - } - - // manage name - if (maskValues.contains(ICustomAppearance.DISP_NAME) && property.isSetName()) { - String name = UMLLabelInternationalization.getInstance().getLabel(property); - - // If property is owned by Association (non navigable) only show the name when explicitly asked. - - if (maskValues.contains(ILabelPreferenceConstants.DISP_NON_NAVIGABLE_ROLE) || !((property.getOwningAssociation() != null) && (property.getOwningAssociation().getOwnedEnds().contains(property)))) { - - result = String.format(NAME_FORMAT, result, name); - } - } - - // manage type - if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { - String type = "<Undefined>"; - if (property.getType() != null) { - type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); - } - - // If type is undefined only show "<Undefined>" when explicitly asked. - - if (maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) { - - result = String.format(TYPE_FORMAT, result, type); - } - } - - // manage multiplicity - if (maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY)) { - - String multiplicity = SysMLMultiplicityElementUtil.formatMultiplicity(property, maskValues); - if (multiplicity != null && !multiplicity.isEmpty()) { - result += " " + multiplicity; - } - } - - // manage default value - if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) { - ValueSpecification valueSpecification = property.getDefaultValue(); - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); - } - - // manage modifier - if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) { - StringBuffer sb = new StringBuffer(); - if (property.isReadOnly()) { - sb.append(sb.length() == 0 ? "readOnly" : ", readOnly"); - } - if (property.isOrdered()) { - sb.append(sb.length() == 0 ? "ordered" : ", ordered"); - } - if (property.isUnique()) { - sb.append(sb.length() == 0 ? "unique" : ", unique"); - } - if (property.isDerivedUnion()) { - sb.append(sb.length() == 0 ? "union" : ", union"); - } - EList<Property> redefinedProperties = property.getRedefinedProperties(); - if (redefinedProperties != null && !redefinedProperties.isEmpty()) { - for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); - } - } - if (sb.length() != 0) { - result = String.format(ALT_MODIFIER_FORMAT, sb.toString(), result); - } - } - } - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - return super.getMasks(); - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - View view = (View) element.getAdapter(View.class); - if (view == null) { - return super.getDefaultValue(element); - } - - if (view.getType() != null && view.getType().contains("multiplicity")) { - return Arrays.asList(ICustomAppearance.DISP_MULTIPLICITY, ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY); - } else if (view.getType() != null && view.getType().contains("role")) { - return Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_VISIBILITY, ICustomAppearance.DISP_DERIVE); - } - - return super.getDefaultValue(element); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java deleted file mode 100644 index dba310651f9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConnectorLabelParser.java +++ /dev/null @@ -1,134 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Semantic Parser for {@link Connector} - */ -public class ConnectorLabelParser extends NamedElementLabelParser { - - /** The String format for displaying a {@link Connector} label with its name */ - protected static final String NAME_FORMAT = "%s"; - - /** The String format for displaying a {@link Connector} label with its type */ - protected static final String TYPE_FORMAT = "%s: %s"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Connector)) { - - Connector connector = (Connector) eObject; - - // manage name - if (maskValues.contains(ICustomAppearance.DISP_NAME) && (connector.isSetName())) { - String name = UMLLabelInternationalization.getInstance().getLabel(connector); - result = String.format(NAME_FORMAT, name); - } - - // manage type - if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { - String type = "<Undefined>"; - if (connector.getType() != null) { - type = UMLLabelInternationalization.getInstance().getLabel(connector.getType()); - } - - // If type is undefined only show "<Undefined>" when explicitly asked. - if (maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || !"<Undefined>".equals(type)) { - result = String.format(TYPE_FORMAT, result, type); - } - } - - } - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof Connector)) { - Connector semElement = (Connector) element; - - semanticElementsBeingParsed.add(semElement); - if (semElement.getType() != null) { - semanticElementsBeingParsed.add(semElement.getType()); - } - } - return semanticElementsBeingParsed; - } - - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ICustomAppearance.DISP_TYPE, "Type"); - masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_TYPE); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java deleted file mode 100644 index 72ad2e82762..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java +++ /dev/null @@ -1,240 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; -import org.eclipse.gmf.runtime.emf.type.core.IClientContext; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; -import org.eclipse.papyrus.infra.services.edit.context.TypeContext; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.uml.diagram.common.Activator; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; -import org.eclipse.uml2.uml.Constraint; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.ValueSpecification; - -/** - * Semantic Parser for {@link Constraint}. - */ -public class ConstraintLabelParser extends NamedElementLabelParser { - - /** The String format for displaying a Property label with derived modifier */ - protected static final String NAME_FORMAT = "%s"; - - /** The String format for displaying a Property with visibility */ - protected static final String SPECIFICATION_FORMAT = "%s{%s}"; - - /** - * {@inheritDoc} - */ - @Override - public String getEditString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String editString = ""; - - EObject eObject = EMFHelper.getEObject(element); - if ((eObject != null) && (eObject instanceof Constraint)) { - Constraint semElement = (Constraint) eObject; - - // edit name - if ((maskValues.contains(ICustomAppearance.DISP_NAME))) { - if (semElement.isSetName()) { - editString = UMLLabelInternationalization.getInstance().getLabel(semElement); - } - - // (try to) edit constraint specification - } else if ((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) { - if (semElement.getSpecification() != null) { - editString = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification()); - if (editString == null) { - editString = ""; - } - } - } - } - return editString; - } - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Constraint)) { - - Constraint semElement = (Constraint) eObject; - - // manage name - if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (semElement.isSetName())) { - String name = UMLLabelInternationalization.getInstance().getLabel(semElement); - result = String.format(NAME_FORMAT, name); - } - - // manage specification - if ((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) { - String spec = "<Undefined>"; - if (semElement.getSpecification() != null) { - spec = ValueSpecificationUtil.getSpecificationValue(semElement.getSpecification(), true); - if (spec == null || "".equals(spec)) { - spec = "<Undefined>"; - } - } - result = String.format(SPECIFICATION_FORMAT, result, spec); - } - } - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public ICommand getParseCommand(IAdaptable element, String newString, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - ICommand command = UnexecutableCommand.INSTANCE; - SetRequest updateRequest = null; - - Constraint constraint = (Constraint) EMFHelper.getEObject(element); - if (constraint == null) { - return UnexecutableCommand.INSTANCE; - } - - // prepare set name request - if ((maskValues.contains(ICustomAppearance.DISP_NAME))) { - if(InternationalizationPreferencesUtils.getInternationalizationPreference(constraint) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML(constraint)){ - final ModelSet modelSet = (ModelSet)constraint.eResource().getResourceSet(); - command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), constraint, newString, null)); - }else{ - updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getNamedElement_Name(), newString); - updateRequest.setLabel("Update Constraint Label"); - } - - // prepare set specification request - } else if ((maskValues.contains(ILabelPreferenceConstants.DISP_SPECIFICATION))) { - ValueSpecification spec = constraint.getSpecification(); - if (spec == null) { - return UnexecutableCommand.INSTANCE; - } - - ValueSpecification specCopy = EcoreUtil.copy(spec); - ValueSpecificationUtil.restoreSpecificationValue(specCopy, newString); - - updateRequest = new SetRequest(constraint, UMLPackage.eINSTANCE.getConstraint_Specification(), specCopy); - updateRequest.setLabel("Update Constraint Label"); - } - - try { - if (updateRequest != null) { - IClientContext context = TypeContext.getContext(constraint); - command = ElementEditServiceUtils.getEditServiceProvider(context).getEditService(constraint).getEditCommand(updateRequest); - } - - } catch (ServiceException e) { - Activator.log.error(e); - } - - - return command; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return UMLPackage.eINSTANCE.getValueSpecification__BooleanValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__IntegerValue().equals(feature) || UMLPackage.eINSTANCE.getValueSpecification__StringValue().equals(feature) - || UMLPackage.eINSTANCE.getValueSpecification__UnlimitedValue().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Body().equals(feature) || UMLPackage.eINSTANCE.getOpaqueExpression_Language().equals(feature) - || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof Constraint)) { - Constraint semElement = (Constraint) element; - - semanticElementsBeingParsed.add(semElement); - if (semElement.getSpecification() != null) { - semanticElementsBeingParsed.add(semElement.getSpecification()); - } - } - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(2); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ILabelPreferenceConstants.DISP_SPECIFICATION, "Specification"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ILabelPreferenceConstants.DISP_SPECIFICATION); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java deleted file mode 100644 index 1bfb39d67da..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/DefaultParserHintAdapter.java +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter; -import org.eclipse.gmf.runtime.notation.Diagram; - -public class DefaultParserHintAdapter extends ParserHintAdapter { - - private Diagram diagram = null; - - /** Constructor */ - public DefaultParserHintAdapter(Diagram diagram, EObject element, String parserHint) { - super(element, parserHint); - this.diagram = diagram; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("rawtypes") - @Override - public Object getAdapter(Class adapter) { - - if (adapter.equals(Diagram.class)) { - return diagram; - } - - return super.getAdapter(adapter); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java deleted file mode 100644 index 1f0d3ceb89e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/MultiplicityElementLabelParser.java +++ /dev/null @@ -1,188 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.MultiplicityElement; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Semantic Parser for {@link MultiplicityElement} - */ -public class MultiplicityElementLabelParser implements IMaskManagedSemanticParser { - - /** The String format for displaying a {@link Property} label with multiplicity */ - protected static final String MULTIPLICITY_FORMAT = "[%s..%s]"; - - /** The String format for displaying a {@link Property} label with multiplicity */ - protected static final String MULTIPLICITY_FORMAT_ALT = "[%s]"; - - /** - * {@inheritDoc} - */ - @Override - public String getEditString(IAdaptable element, int flags) { - return getPrintString(element, flags); - } - - /** - * {@inheritDoc} - */ - @Override - public IParserEditStatus isValidEditString(IAdaptable element, String editString) { - return ParserEditStatus.UNEDITABLE_STATUS; - } - - /** - * {@inheritDoc} - */ - @Override - public ICommand getParseCommand(IAdaptable element, String newString, int flags) { - return UnexecutableCommand.INSTANCE; - } - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof MultiplicityElement)) { - - MultiplicityElement multElt = (MultiplicityElement) eObject; - - // manage multiplicity - if ((maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY))) { - - // TODO : add a case for default with multiplicity not set. - String multiplicity = SysMLMultiplicityElementUtil.formatMultiplicity(multElt, maskValues); - if (multiplicity != null && !multiplicity.isEmpty()) { - result += " " + multiplicity; - } - } - } - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return EcorePackage.eINSTANCE.getEAnnotation_Details().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public IContentAssistProcessor getCompletionProcessor(IAdaptable element) { - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof MultiplicityElement)) { - MultiplicityElement semElement = (MultiplicityElement) element; - - semanticElementsBeingParsed.add(semElement); - if (semElement.getLowerValue() != null) { - semanticElementsBeingParsed.add(semElement.getLowerValue()); - } - if (semElement.getUpperValue() != null) { - semanticElementsBeingParsed.add(semElement.getUpperValue()); - } - } - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean areSemanticElementsAffected(EObject listener, Object notification) { - return true; - } - - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_MULTIPLICITY, "Multiplicity"); - masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity"); - return masks; - } - - protected Collection<String> getMaskValues(IAdaptable element) { - View view = (View) element.getAdapter(View.class); - if (view == null) { - return getDefaultValue(element); - } - - Collection<String> result = MaskLabelHelper.getMaskValues(view); - if (result == null) { - result = getDefaultValue(element); - } - return result; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_MULTIPLICITY); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java deleted file mode 100644 index da7801a0797..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java +++ /dev/null @@ -1,189 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.emf.type.core.IClientContext; -import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper; -import org.eclipse.papyrus.infra.services.edit.context.TypeContext; -import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.uml.diagram.common.Activator; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.uml2.uml.NamedElement; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Semantic Parser for {@link NamedElement} name. - */ -public class NamedElementLabelParser implements IMaskManagedSemanticParser { - - /** - * {@inheritDoc} - */ - @Override - public String getEditString(IAdaptable element, int flags) { - String editString = ""; - - EObject eObject = EMFHelper.getEObject(element); - if ((eObject != null) && (eObject instanceof NamedElement)) { - NamedElement semElement = (NamedElement) eObject; - if (semElement.isSetName()) { - editString = UMLLabelInternationalization.getInstance().getLabel(semElement); - } - } - return editString; - } - - /** - * {@inheritDoc} - */ - @Override - public IParserEditStatus isValidEditString(IAdaptable element, String editString) { - return ParserEditStatus.EDITABLE_STATUS; - } - - /** - * {@inheritDoc} - */ - @Override - public ICommand getParseCommand(IAdaptable element, String newString, int flags) { - - ICommand command = UnexecutableCommand.INSTANCE; - - EObject objectToEdit = EMFHelper.getEObject(element); - if (objectToEdit == null) { - return UnexecutableCommand.INSTANCE; - } - - try { - if(InternationalizationPreferencesUtils.getInternationalizationPreference(objectToEdit) && null != UMLLabelInternationalization.getInstance().getLabelWithoutUML((NamedElement)objectToEdit)){ - final ModelSet modelSet = (ModelSet)objectToEdit.eResource().getResourceSet(); - command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement)objectToEdit, newString, null)); - }else{ - IClientContext context = TypeContext.getContext(objectToEdit); - command = ElementEditServiceUtils.getEditServiceProvider(context).getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); - } - } catch (ServiceException e) { - Activator.log.error(e); - } - - return command; - } - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if (eObject instanceof NamedElement) { - return UMLLabelInternationalization.getInstance().getLabel((NamedElement) eObject); - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return EcorePackage.eINSTANCE.getEAnnotation_Details().equals(feature) || UMLPackage.eINSTANCE.getNamedElement_Name().equals(feature); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public IContentAssistProcessor getCompletionProcessor(IAdaptable element) { - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - semanticElementsBeingParsed.add(element); - - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean areSemanticElementsAffected(EObject listener, Object notification) { - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - return Collections.emptyMap(); - } - - protected Collection<String> getMaskValues(IAdaptable element) { - View view = (View) element.getAdapter(View.class); - if (view == null) { - return getDefaultValue(element); - } - - Collection<String> result = MaskLabelHelper.getMaskValues(view); - if (result == null) { - result = getDefaultValue(element); - } - return result; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Collections.emptySet(); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java deleted file mode 100644 index 81ef14ccf77..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/OperationLabelParser.java +++ /dev/null @@ -1,236 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.infra.tools.util.StringHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.uml.diagram.common.utils.ParameterLabelUtil; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.Operation; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.ParameterDirectionKind; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.VisibilityKind; - -/** - * Semantic Parser for {@link Operation} - */ -public class OperationLabelParser extends NamedElementLabelParser { - - /** Parameter parser */ - protected IMaskManagedSemanticParser parameterParser = new ParameterLabelParser(); - - /** The String format for displaying {@link Operation} label with visibility */ - protected static final String VISIBILITY_FORMAT = "%s "; - - /** The String format for displaying a {@link Operation} label with its name */ - protected static final String NAME_FORMAT = "%s%s(%s)"; - - /** The String format for displaying a {@link Operation} label with its type */ - protected static final String TYPE_FORMAT = "%s: %s"; - - /** The String format for displaying a {@link Operation} label with modifiers */ - protected static final String MODIFIER_FORMAT = "%s{%s}"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Operation)) { - - Operation operation = (Operation) eObject; - - // manage visibility - if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { - String visibility; - switch (operation.getVisibility().getValue()) { - case VisibilityKind.PACKAGE: - visibility = "~"; - break; - case VisibilityKind.PUBLIC: - visibility = "+"; - break; - case VisibilityKind.PROTECTED: - visibility = "#"; - break; - case VisibilityKind.PRIVATE: - visibility = "-"; - break; - default: - visibility = "+"; - break; - } - result = String.format(VISIBILITY_FORMAT, visibility); - } - - // manage name and parameters - if ((maskValues.contains(ICustomAppearance.DISP_NAME)) && (operation.isSetName())) { - String name = UMLLabelInternationalization.getInstance().getLabel(operation); - - StringBuffer params = new StringBuffer(); - for (Parameter parameter : operation.getOwnedParameters()) { - if (parameter.getDirection() != ParameterDirectionKind.RETURN_LITERAL) { - String currentParamLabel = ParameterLabelUtil.getPrintString(parameter, extractParameterMaskValues(maskValues)); - params.append(params.length() == 0 ? currentParamLabel : ", " + currentParamLabel); - } - } - - result = String.format(NAME_FORMAT, result, name, params); - } - - // manage type - if ((maskValues.contains(ICustomAppearance.DISP_TYPE))) { - String type = "<Undefined>"; - if (operation.getType() != null) { - type = UMLLabelInternationalization.getInstance().getLabel(operation.getType()); - } - - // If type is undefined only show "<Undefined>" when explicitly asked. - if ((maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE)) || (!"<Undefined>".equals(type))) { - result = String.format(TYPE_FORMAT, result, type); - } - } - - // manage modifier - if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) { - StringBuffer sb = new StringBuffer(); - if (operation.isAbstract()) { - sb.append(sb.length() == 0 ? "abstract" : ", abstract"); - } - if (operation.isStatic()) { - sb.append(sb.length() == 0 ? "static" : ", static"); - } - if (operation.isUnique()) { - sb.append(sb.length() == 0 ? "unique" : ", unique"); - } - if (operation.isQuery()) { - sb.append(sb.length() == 0 ? "query" : ", query"); - } - if (operation.isLeaf()) { - sb.append(sb.length() == 0 ? "leaf" : ", leaf"); - } - - if (sb.length() != 0) { - result = String.format(MODIFIER_FORMAT, result, sb.toString()); - } - } - } - return result; - } - - private static Collection<String> extractParameterMaskValues(Collection<String> operationMaskValues) { - Set<String> result = new HashSet<String>(); - - for (String maskValue : operationMaskValues) { - if (maskValue.startsWith(ICustomAppearance.PARAMETERS_PREFIX)) { - String newValue = StringHelper.firstToLower(maskValue.replace(ICustomAppearance.PARAMETERS_PREFIX, "")); - result.add(newValue); - } - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return UMLPackage.eINSTANCE.getNamedElement_Visibility().equals(feature) || UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getBehavioralFeature_IsAbstract().equals(feature) - || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getOperation_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getOperation_IsQuery().equals(feature) - || UMLPackage.eINSTANCE.getRedefinableElement_IsLeaf().equals(feature) || parameterParser.isAffectingEvent(event, flags) || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @SuppressWarnings("unchecked") - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof Operation)) { - Operation semElement = (Operation) element; - - semanticElementsBeingParsed.add(semElement); - if (semElement.getType() != null) { - semanticElementsBeingParsed.add(semElement.getType()); - } - for (Parameter parameter : semElement.getOwnedParameters()) { - semanticElementsBeingParsed.addAll(parameterParser.getSemanticElementsBeingParsed(parameter)); - } - } - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(5); - masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility"); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ICustomAppearance.DISP_TYPE, "Type"); - masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type"); - masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers"); - - masks.put(ICustomAppearance.DISP_PARAMETER_DIRECTION, "Parameter direction"); - masks.put(ICustomAppearance.DISP_PARAMETER_NAME, "Parameter name"); - masks.put(ICustomAppearance.DISP_PARAMETER_TYPE, "Parameter type"); - masks.put(ICustomAppearance.DISP_PARAMETER_MULTIPLICITY, "Parameter multiplicity"); - masks.put(ICustomAppearance.DISP_PARAMETER_DEFAULT, "Parameter default value"); - masks.put(ICustomAppearance.DISP_PARAMETER_MODIFIERS, "Parameter modifiers"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_TYPE, ICustomAppearance.DISP_PARAMETER_DIRECTION, ICustomAppearance.DISP_PARAMETER_NAME, ICustomAppearance.DISP_PARAMETER_TYPE); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java deleted file mode 100644 index 0c37c6078ba..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ParameterLabelParser.java +++ /dev/null @@ -1,143 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.uml.diagram.common.utils.ParameterLabelUtil; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Semantic Parser for {@link Parameter} - */ -public class ParameterLabelParser extends NamedElementLabelParser { - - /** The String format for displaying a {@link Parameter} with direction */ - protected static final String DIRECTION_FORMAT = "%s %s"; - - /** The String format for displaying a {@link Parameter} label with its name */ - protected static final String NAME_FORMAT = "%s%s"; - - /** The String format for displaying a {@link Parameter} label with its type */ - protected static final String TYPE_FORMAT = "%s: %s"; - - /** The String format for displaying a {@link Parameter} label with its multiplicity */ - protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]"; - - /** The String format for displaying a {@link Parameter} label with its default value */ - protected static final String DEFAULT_VALUE_FORMAT = "%s= %s"; - - /** The String format for displaying a {@link Parameter} label with its modifiers */ - protected static final String MODIFIER_FORMAT = "%s{%s}"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - EObject eObject = EMFHelper.getEObject(element); - - if (eObject != null && eObject instanceof Parameter) { - Parameter parameter = (Parameter) eObject; - return ParameterLabelUtil.getPrintString(parameter, maskValues); - } - - return ""; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getParameter_Direction().equals(feature) || UMLPackage.eINSTANCE.getParameter_DefaultValue().equals(feature) - || UMLPackage.eINSTANCE.getParameter_IsStream().equals(feature) || UMLPackage.eINSTANCE.getParameter_IsException().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) - || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) - || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof Parameter)) { - Parameter semElement = (Parameter) element; - - semanticElementsBeingParsed.add(semElement); - if (semElement.getType() != null) { - semanticElementsBeingParsed.add(semElement.getType()); - } - if (semElement.getDefaultValue() != null) { - semanticElementsBeingParsed.add(semElement.getDefaultValue()); - } - if (semElement.getLowerValue() != null) { - semanticElementsBeingParsed.add(semElement.getLowerValue()); - } - if (semElement.getUpperValue() != null) { - semanticElementsBeingParsed.add(semElement.getUpperValue()); - } - } - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_DIRECTION, "Direction"); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ICustomAppearance.DISP_TYPE, "Type"); - masks.put(ICustomAppearance.DISP_MULTIPLICITY, "Multiplicity"); - masks.put(ICustomAppearance.DISP_DEFAULT_VALUE, "Default value"); - masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java deleted file mode 100644 index 89ea3a8e1d7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/PropertyLabelParser.java +++ /dev/null @@ -1,248 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.ValueSpecification; -import org.eclipse.uml2.uml.VisibilityKind; - -/** - * Semantic Parser for {@link Property} - */ -public class PropertyLabelParser extends NamedElementLabelParser { - - /** The String format for displaying a {@link Property} with visibility */ - protected static final String VISIBILITY_FORMAT = "%s %s"; - - /** The String format for displaying a {@link Property} label with derived modifier */ - protected static final String DERIVED_FORMAT = "%s/"; - - /** The String format for displaying a {@link Property} label with its name */ - protected static final String NAME_FORMAT = "%s%s"; - - /** The String format for displaying a {@link Property} label with its type */ - protected static final String TYPE_FORMAT = "%s: %s"; - - /** The String format for displaying a {@link Property} label with multiplicity */ - protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]"; - - /** The String format for displaying a {@link Property} label with multiplicity */ - protected static final String MULTIPLICITY_FORMAT_ALT = "%s [%s]"; - - /** The String format for displaying a {@link Property} label with default value */ - protected static final String DEFAULT_VALUE_FORMAT = "%s= %s"; - - /** The String format for displaying a {@link Property} label with modifiers */ - protected static final String MODIFIER_FORMAT = "%s{%s}"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Property)) { - - Property property = (Property) eObject; - - // manage visibility - if (maskValues.contains(ICustomAppearance.DISP_VISIBILITY)) { - String visibility; - switch (property.getVisibility().getValue()) { - case VisibilityKind.PACKAGE: - visibility = "~"; - break; - case VisibilityKind.PUBLIC: - visibility = "+"; - break; - case VisibilityKind.PROTECTED: - visibility = "#"; - break; - case VisibilityKind.PRIVATE: - visibility = "-"; - break; - default: - visibility = "+"; - break; - } - result = String.format(VISIBILITY_FORMAT, visibility, result); - } - - // manage derived modifier - if (maskValues.contains(ICustomAppearance.DISP_DERIVE) && (property.isDerived())) { - result = String.format(DERIVED_FORMAT, result); - } - - // manage name - if (maskValues.contains(ICustomAppearance.DISP_NAME) && (property.isSetName())) { - String name = UMLLabelInternationalization.getInstance().getLabel(property); - result = String.format(NAME_FORMAT, result, name); - } - - // manage type - if (maskValues.contains(ICustomAppearance.DISP_TYPE)) { - String type = "<Undefined>"; - if (property.getType() != null) { - type = UMLLabelInternationalization.getInstance().getLabel(property.getType()); - } - - // If type is undefined only show "<Undefined>" when explicitly asked. - if (maskValues.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) { - result = String.format(TYPE_FORMAT, result, type); - } - } - - // manage multiplicity - if (maskValues.contains(ICustomAppearance.DISP_MULTIPLICITY)) { - - // TODO : add a case for default with multiplicity not set. - String multiplicity = SysMLMultiplicityElementUtil.formatMultiplicity(property, maskValues); - if (multiplicity != null && !multiplicity.isEmpty()) { - result += " " + multiplicity; - } - } - - // manage default value - if (maskValues.contains(ICustomAppearance.DISP_DEFAULT_VALUE) && property.getDefaultValue() != null) { - ValueSpecification valueSpecification = property.getDefaultValue(); - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); - } - - // manage modifier - if (maskValues.contains(ICustomAppearance.DISP_MODIFIERS)) { - StringBuffer sb = new StringBuffer(); - if (property.isReadOnly()) { - sb.append(sb.length() == 0 ? "readOnly" : ", readOnly"); - } - if (property.isOrdered()) { - sb.append(sb.length() == 0 ? "ordered" : ", ordered"); - } - if (property.isUnique()) { - sb.append(sb.length() == 0 ? "unique" : ", unique"); - } - if (property.isDerivedUnion()) { - sb.append(sb.length() == 0 ? "union" : ", union"); - } - EList<Property> redefinedProperties = property.getRedefinedProperties(); - if (redefinedProperties != null && !redefinedProperties.isEmpty()) { - for (Property p : redefinedProperties) { - sb.append(sb.length() == 0 ? UMLLabelInternationalization.getInstance().getLabel(p) : ", redefines " + UMLLabelInternationalization.getInstance().getLabel(p)); - } - } - if (sb.length() != 0) { - result = String.format(MODIFIER_FORMAT, result, sb.toString()); - } - } - } - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - - if (feature instanceof EStructuralFeature) { // UMLPackage.eINSTANCE.getLiteralString_Value().equals(feature) || - return UMLPackage.eINSTANCE.getTypedElement_Type().equals(feature) || UMLPackage.eINSTANCE.getInstanceValue_Instance().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_IsOrdered().equals(feature) - || UMLPackage.eINSTANCE.getMultiplicityElement_IsUnique().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_LowerValue().equals(feature) || UMLPackage.eINSTANCE.getMultiplicityElement_UpperValue().equals(feature) - || UMLPackage.eINSTANCE.getStructuralFeature_IsReadOnly().equals(feature) || UMLPackage.eINSTANCE.getFeature_IsStatic().equals(feature) || UMLPackage.eINSTANCE.getProperty_IsDerived().equals(feature) - || UMLPackage.eINSTANCE.getProperty_IsDerivedUnion().equals(feature) || UMLPackage.eINSTANCE.getProperty_RedefinedProperty().equals(feature) || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof Property)) { - Property semElement = (Property) element; - - semanticElementsBeingParsed.add(semElement); - if (semElement.getType() != null) { - semanticElementsBeingParsed.add(semElement.getType()); - } - if (semElement.getLowerValue() != null) { - semanticElementsBeingParsed.add(semElement.getLowerValue()); - } - if (semElement.getUpperValue() != null) { - semanticElementsBeingParsed.add(semElement.getUpperValue()); - } - if (semElement.getDefaultValue() != null) { - semanticElementsBeingParsed.add(semElement.getDefaultValue()); - } - } - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_VISIBILITY, "Visibility"); - masks.put(ICustomAppearance.DISP_DERIVE, "Is Derived"); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ICustomAppearance.DISP_TYPE, "Type"); - masks.put(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE, "Show <Undefined> type"); - masks.put(ICustomAppearance.DISP_MULTIPLICITY, "Multiplicity"); - masks.put(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY, "Show default multiplicity"); - masks.put(ICustomAppearance.DISP_DEFAULT_VALUE, "Default Value"); - masks.put(ICustomAppearance.DISP_MODIFIERS, "Modifiers"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_NAME, ICustomAppearance.DISP_TYPE, ICustomAppearance.DISP_MULTIPLICITY, ILabelPreferenceConstants.DISP_UNDEFINED_TYPE); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java deleted file mode 100644 index a5fbfaef55c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/ReceptionLabelParser.java +++ /dev/null @@ -1,135 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.uml2.uml.Reception; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Semantic Parser for {@link Reception} - */ -public class ReceptionLabelParser extends NamedElementLabelParser implements IMaskManagedSemanticParser { - - /** The String format for displaying a Property with visibility */ - protected static final String PREFIX = "\u00ABsignal\u00BB "; - - /** The String format for displaying a Property label with its name */ - protected static final String NAME_FORMAT = "%s%s"; - - /** The String format for displaying a Property label with its type */ - protected static final String TYPE_FORMAT = "%s: %s"; - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - - Collection<String> maskValues = getMaskValues(element); - - if (maskValues.isEmpty()) { - return MaskedLabel; - } - - String result = PREFIX; - EObject eObject = EMFHelper.getEObject(element); - - if ((eObject != null) && (eObject instanceof Reception)) { - - Reception reception = (Reception) eObject; - - // manage name - if (maskValues.contains(ICustomAppearance.DISP_NAME) && reception.isSetName()) { - String name = UMLLabelInternationalization.getInstance().getLabel(reception); - result = String.format(NAME_FORMAT, result, name); - } - - // manage signal - if (maskValues.contains(ILabelPreferenceConstants.DISP_SIGNAL)) { - String type = "<Undefined>"; - if (reception.getSignal() != null) { - type = UMLLabelInternationalization.getInstance().getLabel(reception.getSignal()); - } - result = String.format(TYPE_FORMAT, result, type); - } - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return UMLPackage.eINSTANCE.getReception_Signal().equals(feature) || super.isAffectingEvent(event, flags); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - - if ((element != null) && (element instanceof Reception)) { - Reception semElement = (Reception) element; - - semanticElementsBeingParsed.add(semElement); - if (semElement.getSignal() != null) { - semanticElementsBeingParsed.add(semElement.getSignal()); - } - } - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public Map<String, String> getMasks() { - Map<String, String> masks = new HashMap<String, String>(); - masks.put(ICustomAppearance.DISP_NAME, "Name"); - masks.put(ILabelPreferenceConstants.DISP_SIGNAL, "Signal"); - return masks; - } - - @Override - public Collection<String> getDefaultValue(IAdaptable element) { - return Arrays.asList(ICustomAppearance.DISP_NAME, ILabelPreferenceConstants.DISP_SIGNAL); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java deleted file mode 100644 index f1b973ad083..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/parser/SlotLabelParser.java +++ /dev/null @@ -1,151 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.parser; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; -import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; -import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; -import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.uml2.uml.InstanceValue; -import org.eclipse.uml2.uml.Slot; -import org.eclipse.uml2.uml.UMLPackage; -import org.eclipse.uml2.uml.ValueSpecification; - -/** - * Semantic Parser for {@link Slot} - */ -public class SlotLabelParser implements ISemanticParser { - - /** - * {@inheritDoc} - */ - @Override - public String getEditString(IAdaptable element, int flags) { - return getPrintString(element, flags); - } - - /** - * {@inheritDoc} - */ - @Override - public IParserEditStatus isValidEditString(IAdaptable element, String editString) { - return ParserEditStatus.UNEDITABLE_STATUS; - } - - /** - * {@inheritDoc} - */ - @Override - public ICommand getParseCommand(IAdaptable element, String newString, int flags) { - return UnexecutableCommand.INSTANCE; - } - - /** - * {@inheritDoc} - */ - @Override - public String getPrintString(IAdaptable element, int flags) { - String result = ""; - EObject eObject = EMFHelper.getEObject(element); - - if (eObject instanceof Slot) { - Slot slot = (Slot) eObject; - result = "<UNDEFINED>"; - - if (slot.getDefiningFeature() != null) { - - // Add defining feature - result = slot.getDefiningFeature().getName(); - - // Add values - if (!slot.getValues().isEmpty()) { - - String values = ""; - Iterator<ValueSpecification> iter = slot.getValues().iterator(); - while (iter.hasNext()) { - ValueSpecification currentSpecification = iter.next(); - - String currentValue = currentSpecification.stringValue(); - if ((currentSpecification instanceof InstanceValue) && ((InstanceValue) currentSpecification).getInstance() != null) { - currentValue = ((InstanceValue) currentSpecification).getInstance().getName(); - } - - values = values + currentValue; - if (iter.hasNext()) { - result = result + ", "; - } - } - - result = result + ": " + values; - } - } - } - - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isAffectingEvent(Object event, int flags) { - if (event instanceof Notification) { - Object feature = ((Notification) event).getFeature(); - if (feature instanceof EStructuralFeature) { - return UMLPackage.eINSTANCE.getSlot_DefiningFeature().equals(feature); - } - } - - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public IContentAssistProcessor getCompletionProcessor(IAdaptable element) { - return null; - } - - /** - * {@inheritDoc} - */ - @Override - public List<EObject> getSemanticElementsBeingParsed(EObject element) { - List<EObject> semanticElementsBeingParsed = new ArrayList<EObject>(); - semanticElementsBeingParsed.add(element); - - return semanticElementsBeingParsed; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean areSemanticElementsAffected(EObject listener, Object notification) { - return true; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java deleted file mode 100644 index a9be2ba4980..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/AssociationViewUtils.java +++ /dev/null @@ -1,81 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.utils; - -import org.eclipse.gmf.runtime.notation.EObjectValueStyle; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.Property; - -/** - * Utility class for Association graphical end - property mapping. - */ -public class AssociationViewUtils { - - /** ID for the source end - property mapping of an association */ - public static final String SEMANTIC_SOURCE_END = "semantic_source_end"; - - /** ID for the target end - property mapping of an association */ - public static final String SEMANTIC_TARGET_END = "semantic_target_end"; - - /** - * Get the semantic end from the source of an edge representing an Association. - * - * @param view - * the Association view. - * @return the Property corresponding to the source of the graphical end. - */ - public static Property getSourceSemanticEnd(View view) { - EObjectValueStyle semanticStyle = (EObjectValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_SOURCE_END); - return semanticStyle == null ? null : (Property) semanticStyle.getEObjectValue(); - } - - /** - * Get the semantic end from the target of an edge representing an Association. - * - * @param view - * the Association view. - * @return the Property corresponding to the target of the graphical end. - */ - public static Property getTargetSemanticEnd(View view) { - EObjectValueStyle semanticStyle = (EObjectValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_TARGET_END); - return semanticStyle == null ? null : (Property) semanticStyle.getEObjectValue(); - } - - /** - * Set the semantic end for the source of an edge representing an Association. - * - * @param view - * the Association view. - * @param end - * the Property corresponding to the source of the graphical end. - */ - public static void setSourceSemanticEnd(View view, Property end) { - EObjectValueStyle semanticStyle = (EObjectValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_SOURCE_END); - semanticStyle.setEObjectValue(end); - } - - /** - * Set the semantic end for the target of an edge representing an Association. - * - * @param view - * the Association view. - * @param end - * the Property corresponding to the target of the graphical end. - */ - public static void setTargetSemanticEnd(View view, Property end) { - EObjectValueStyle semanticStyle = (EObjectValueStyle) view.getNamedStyle(NotationPackage.eINSTANCE.getEObjectValueStyle(), SEMANTIC_TARGET_END); - semanticStyle.setEObjectValue(end); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/ParameterLabelUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/ParameterLabelUtil.java deleted file mode 100644 index edb3268fffb..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/utils/ParameterLabelUtil.java +++ /dev/null @@ -1,136 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.utils; - -import java.util.Collection; - -import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLMultiplicityElementUtil; -import org.eclipse.papyrus.uml.diagram.common.parser.IMaskManagedSemanticParser; -import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; -import org.eclipse.papyrus.uml.tools.utils.ICustomAppearance; -import org.eclipse.papyrus.uml.tools.utils.ValueSpecificationUtil; -import org.eclipse.uml2.uml.Parameter; -import org.eclipse.uml2.uml.ParameterDirectionKind; -import org.eclipse.uml2.uml.ValueSpecification; - - -public class ParameterLabelUtil { - - /** The String format for displaying a {@link Parameter} with direction */ - protected static final String DIRECTION_FORMAT = "%s %s"; - - /** The String format for displaying a {@link Parameter} label with its name */ - protected static final String NAME_FORMAT = "%s%s"; - - /** The String format for displaying a {@link Parameter} label with its type */ - protected static final String TYPE_FORMAT = "%s: %s"; - - /** The String format for displaying a {@link Parameter} label with its multiplicity */ - protected static final String MULTIPLICITY_FORMAT = "%s [%s..%s]"; - - /** The String format for displaying a {@link Parameter} label with its default value */ - protected static final String DEFAULT_VALUE_FORMAT = "%s= %s"; - - /** The String format for displaying a {@link Parameter} label with its modifiers */ - protected static final String MODIFIER_FORMAT = "%s{%s}"; - - public static String getPrintString(Parameter parameter, Collection<String> displayValue) { - if (displayValue.isEmpty()) { - return IMaskManagedSemanticParser.MaskedLabel; - } - - String result = ""; - - if (parameter != null) { - - // manage direction - if (displayValue.contains(ICustomAppearance.DISP_DIRECTION) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_DIRECTION)) { - String direction; - switch (parameter.getDirection().getValue()) { - case ParameterDirectionKind.IN: - direction = "in"; - break; - case ParameterDirectionKind.OUT: - direction = "out"; - break; - case ParameterDirectionKind.INOUT: - direction = "inout"; - break; - case ParameterDirectionKind.RETURN: - direction = "return"; - break; - default: - direction = "in"; - break; - } - result = String.format(DIRECTION_FORMAT, direction, result); - } - - // manage name - if ((displayValue.contains(ICustomAppearance.DISP_NAME) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_NAME)) && (parameter.isSetName())) { - String name = UMLLabelInternationalization.getInstance().getLabel(parameter); - result = String.format(NAME_FORMAT, result, name); - } - - // manage type - if (displayValue.contains(ICustomAppearance.DISP_TYPE) || displayValue.contains(ICustomAppearance.DISP_PARAMETER_TYPE)) { - String type = "<Undefined>"; - if (parameter.getType() != null) { - type = UMLLabelInternationalization.getInstance().getLabel(parameter.getType()); - } - - // If type is undefined only show "<Undefined>" when explicitly asked. - if (displayValue.contains(ILabelPreferenceConstants.DISP_UNDEFINED_TYPE) || (!"<Undefined>".equals(type))) { - result = String.format(TYPE_FORMAT, result, type); - } - } - - // manage multiplicity - String multiplicity = SysMLMultiplicityElementUtil.formatMultiplicity(parameter, displayValue); - if (multiplicity != null && !multiplicity.isEmpty()) { - result += " " + multiplicity; - } - - // manage default value - if ((displayValue.contains(ICustomAppearance.DISP_PARAMETER_DEFAULT) || displayValue.contains(ICustomAppearance.DISP_DEFAULT_VALUE)) && ((parameter.getDefaultValue() != null))) { - ValueSpecification valueSpecification = parameter.getDefaultValue(); - result = String.format(DEFAULT_VALUE_FORMAT, result, ValueSpecificationUtil.getSpecificationValue(valueSpecification, true)); - } - - // manage modifier - if (displayValue.contains(ICustomAppearance.DISP_PARAMETER_MODIFIERS) || displayValue.contains(ICustomAppearance.DISP_MODIFIERS)) { - StringBuffer sb = new StringBuffer(); - if (parameter.isOrdered()) { - sb.append(sb.length() == 0 ? "ordered" : ", ordered"); - } - if (parameter.isUnique()) { - sb.append(sb.length() == 0 ? "unique" : ", unique"); - } - if (parameter.isStream()) { - sb.append(sb.length() == 0 ? "stream" : ", stream"); - } - if (parameter.isException()) { - sb.append(sb.length() == 0 ? "exception" : ", exception"); - } - if (sb.length() != 0) { - result = String.format(MODIFIER_FORMAT, result, sb.toString()); - } - } - - } - return result; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockCompositeEditPart.java deleted file mode 100644 index 03205daf866..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockCompositeEditPart.java +++ /dev/null @@ -1,184 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.BlockCompositeFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; - -public class BlockCompositeEditPart extends AbstractElementEditPart { - - public BlockCompositeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new BlockCompositeSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy()); - // Start of user code custom policies - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy()); - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { - return new BorderItemResizableEditPolicy(); - } - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof BlockLabelNameEditPart) { - ((BlockLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((FlowPortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((PortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - if (childEditPart instanceof StructureCompartmentEditPart) { - IFigure pane = getPrimaryShape().getStructureCompartmentFigure(); - setupContentPane(pane); - pane.add(((StructureCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof BlockLabelNameEditPart) { - return true; - } - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((FlowPortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((PortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof StructureCompartmentEditPart) { - IFigure pane = getPrimaryShape().getStructureCompartmentFigure(); - setupContentPane(pane); - pane.remove(((StructureCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof StructureCompartmentEditPart) { - return getPrimaryShape().getStructureCompartmentFigure(); - } - if (editPart instanceof IBorderItemEditPart) { - return getBorderedFigure().getBorderItemContainer(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected NodeFigure createNodeFigure() { - return new SelectableBorderedNodeFigure(createMainFigure()); - } - - @Override - protected IFigure createNodeShape() { - return primaryShape = new BlockCompositeFigure(); - } - - @Override - public BlockCompositeFigure getPrimaryShape() { - return (BlockCompositeFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockConstraintCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockConstraintCompartmentEditPart.java deleted file mode 100644 index 8e1d6e67072..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockConstraintCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; - -public class BlockConstraintCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "constraints"; - - public BlockConstraintCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockEditPart.java deleted file mode 100644 index 334c8499427..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockEditPart.java +++ /dev/null @@ -1,291 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockCompositeSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.BlockFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator; - -public class BlockEditPart extends AbstractElementEditPart { - - public BlockEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new BlockCompositeSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy()); - // Start of user code custom policies - installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy()); - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { - return new BorderItemResizableEditPolicy(); - } - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof BlockLabelNameEditPart) { - ((BlockLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((FlowPortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE); - getBorderedFigure().getBorderItemContainer().add(((PortAffixedNodeEditPart) childEditPart).getFigure(), locator); - return true; - } - if (childEditPart instanceof BlockPropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((BlockPropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PartPropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPartPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((PartPropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof ReferencePropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getReferencePropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((ReferencePropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PortCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPortCompartmentFigure(); - setupContentPane(pane); - pane.add(((PortCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof FlowPortCompartmentEditPart) { - IFigure pane = getPrimaryShape().getFlowPortCompartmentFigure(); - setupContentPane(pane); - pane.add(((FlowPortCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.add(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof BlockConstraintCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockConstraintCompartmentFigure(); - setupContentPane(pane); - pane.add(((BlockConstraintCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof ValuePropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getValuePropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((ValuePropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof BlockLabelNameEditPart) { - return true; - } - if (childEditPart instanceof FlowPortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((FlowPortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PortAffixedNodeEditPart) { - getBorderedFigure().getBorderItemContainer().remove(((PortAffixedNodeEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof BlockPropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((BlockPropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PartPropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPartPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((PartPropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof ReferencePropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getReferencePropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((ReferencePropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof PortCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPortCompartmentFigure(); - setupContentPane(pane); - pane.remove(((PortCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof FlowPortCompartmentEditPart) { - IFigure pane = getPrimaryShape().getFlowPortCompartmentFigure(); - setupContentPane(pane); - pane.remove(((FlowPortCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.remove(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof BlockConstraintCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockConstraintCompartmentFigure(); - setupContentPane(pane); - pane.remove(((BlockConstraintCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof ValuePropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getValuePropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((ValuePropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof BlockPropertyCompartmentEditPart) { - return getPrimaryShape().getBlockPropertyCompartmentFigure(); - } - if (editPart instanceof PartPropertyCompartmentEditPart) { - return getPrimaryShape().getPartPropertyCompartmentFigure(); - } - if (editPart instanceof ReferencePropertyCompartmentEditPart) { - return getPrimaryShape().getReferencePropertyCompartmentFigure(); - } - if (editPart instanceof PortCompartmentEditPart) { - return getPrimaryShape().getPortCompartmentFigure(); - } - if (editPart instanceof FlowPortCompartmentEditPart) { - return getPrimaryShape().getFlowPortCompartmentFigure(); - } - if (editPart instanceof OperationCompartmentEditPart) { - return getPrimaryShape().getOperationCompartmentFigure(); - } - if (editPart instanceof BlockConstraintCompartmentEditPart) { - return getPrimaryShape().getBlockConstraintCompartmentFigure(); - } - if (editPart instanceof ValuePropertyCompartmentEditPart) { - return getPrimaryShape().getValuePropertyCompartmentFigure(); - } - if (editPart instanceof IBorderItemEditPart) { - return getBorderedFigure().getBorderItemContainer(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected NodeFigure createNodeFigure() { - return new SelectableBorderedNodeFigure(createMainFigure()); - } - - @Override - protected IFigure createNodeShape() { - return primaryShape = new BlockFigure(); - } - - @Override - public BlockFigure getPrimaryShape() { - return (BlockFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockLabelNameEditPart.java deleted file mode 100644 index 83af46d0cff..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockLabelNameEditPart.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart; - -public class BlockLabelNameEditPart extends NamedElementNodeLabelNameEditPart { - - /** Constructor */ - public BlockLabelNameEditPart(View view) { - super(view); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompartmentEditPart.java deleted file mode 100644 index 628a4f4c17f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.PropertyCompartmentSemanticEditPolicy; - -public class BlockPropertyCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "properties"; - - public BlockPropertyCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PropertyCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java deleted file mode 100644 index 87d8fdde8fa..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.CustomDuplicatePasteEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractShapeCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; - -public class BlockPropertyStructureCompartmentEditPart extends AbstractShapeCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "structure"; - - public BlockPropertyStructureCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new BlockPropertyStructureCompartmentSemanticEditPolicy()); - // Start of user code custom edit policies - installEditPolicy(PasteEditPolicy.PASTE_ROLE, new CustomDuplicatePasteEditPolicy()); - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockEditPart.java deleted file mode 100644 index b6d15b7806f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockEditPart.java +++ /dev/null @@ -1,157 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.ConstraintBlockFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; - -public class ConstraintBlockEditPart extends AbstractElementEditPart { - - public ConstraintBlockEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof ConstraintBlockLabelNameEditPart) { - ((ConstraintBlockLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof ParameterCompartmentEditPart) { - IFigure pane = getPrimaryShape().getParameterCompartmentFigure(); - setupContentPane(pane); - pane.add(((ParameterCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof BlockConstraintCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockConstraintCompartmentFigure(); - setupContentPane(pane); - pane.add(((BlockConstraintCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof ConstraintBlockLabelNameEditPart) { - return true; - } - if (childEditPart instanceof ParameterCompartmentEditPart) { - IFigure pane = getPrimaryShape().getParameterCompartmentFigure(); - setupContentPane(pane); - pane.remove(((ParameterCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof BlockConstraintCompartmentEditPart) { - IFigure pane = getPrimaryShape().getBlockConstraintCompartmentFigure(); - setupContentPane(pane); - pane.remove(((BlockConstraintCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof ParameterCompartmentEditPart) { - return getPrimaryShape().getParameterCompartmentFigure(); - } - if (editPart instanceof BlockConstraintCompartmentEditPart) { - return getPrimaryShape().getBlockConstraintCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new ConstraintBlockFigure(); - } - - @Override - public ConstraintBlockFigure getPrimaryShape() { - return (ConstraintBlockFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.LABEL_SYSML_CONSTRAINTBLOCK_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockLabelNameEditPart.java deleted file mode 100644 index a863eb654d8..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ConstraintBlockLabelNameEditPart.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart; - -public class ConstraintBlockLabelNameEditPart extends NamedElementNodeLabelNameEditPart { - - /** Constructor */ - public ConstraintBlockLabelNameEditPart(View view) { - super(view); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/DimensionEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/DimensionEditPart.java deleted file mode 100644 index 108ace0b471..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/DimensionEditPart.java +++ /dev/null @@ -1,123 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.DimensionFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; - -public class DimensionEditPart extends AbstractElementEditPart { - - public DimensionEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof DimensionLabelNameEditPart) { - ((DimensionLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof DimensionLabelNameEditPart) { - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new DimensionFigure(); - } - - @Override - public DimensionFigure getPrimaryShape() { - return (DimensionFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.LABEL_SYSML_DIMENSION_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/DimensionLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/DimensionLabelNameEditPart.java deleted file mode 100644 index cc012285d49..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/DimensionLabelNameEditPart.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart; - -public class DimensionLabelNameEditPart extends NamedElementNodeLabelNameEditPart { - - /** Constructor */ - public DimensionLabelNameEditPart(View view) { - super(view); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortCompartmentEditPart.java deleted file mode 100644 index 6e0c6cec59b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPortCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.FlowPortCompartmentSemanticEditPolicy; - -public class FlowPortCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "flow ports"; - - public FlowPortCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new FlowPortCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyCompartmentEditPart.java deleted file mode 100644 index b61127fa01e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowPropertyCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; - -public class FlowPropertyCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "flow properties"; - - public FlowPropertyCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowSpecificationEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowSpecificationEditPart.java deleted file mode 100644 index 00fb8ffa5b9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowSpecificationEditPart.java +++ /dev/null @@ -1,142 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.FlowSpecificationFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; - -public class FlowSpecificationEditPart extends AbstractElementEditPart { - - public FlowSpecificationEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof FlowSpecificationLabelNameEditPart) { - ((FlowSpecificationLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof FlowPropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getFlowPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((FlowPropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof FlowSpecificationLabelNameEditPart) { - return true; - } - if (childEditPart instanceof FlowPropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getFlowPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((FlowPropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof FlowPropertyCompartmentEditPart) { - return getPrimaryShape().getFlowPropertyCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new FlowSpecificationFigure(); - } - - @Override - public FlowSpecificationFigure getPrimaryShape() { - return (FlowSpecificationFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.LABEL_SYSML_FLOWSPECIFICATION_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowSpecificationLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowSpecificationLabelNameEditPart.java deleted file mode 100644 index bb44d904f9d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/FlowSpecificationLabelNameEditPart.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart; - -public class FlowSpecificationLabelNameEditPart extends NamedElementNodeLabelNameEditPart { - - /** Constructor */ - public FlowSpecificationLabelNameEditPart(View view) { - super(view); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ParameterCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ParameterCompartmentEditPart.java deleted file mode 100644 index 853e3dde4b9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ParameterCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.ConstraintParameterCompartmentSemanticEditPolicy; - -public class ParameterCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "parameters"; - - public ParameterCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConstraintParameterCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/PartPropertyCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/PartPropertyCompartmentEditPart.java deleted file mode 100644 index 2c1112d7dd7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/PartPropertyCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.PartCompartmentSemanticEditPolicy; - -public class PartPropertyCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "parts"; - - public PartPropertyCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new PartCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ReferencePropertyCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ReferencePropertyCompartmentEditPart.java deleted file mode 100644 index 736ceb8aaac..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ReferencePropertyCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.ReferenceCompartmentSemanticEditPolicy; - -public class ReferencePropertyCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "references"; - - public ReferencePropertyCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ReferenceCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/StructureCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/StructureCompartmentEditPart.java deleted file mode 100644 index 5bfd6a12e93..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/StructureCompartmentEditPart.java +++ /dev/null @@ -1,44 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.CustomDuplicatePasteEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.StructureCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractShapeCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; - -public class StructureCompartmentEditPart extends AbstractShapeCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "structure"; - - public StructureCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new StructureCompartmentSemanticEditPolicy()); - // Start of user code custom edit policies - installEditPolicy(PasteEditPolicy.PASTE_ROLE, new CustomDuplicatePasteEditPolicy()); - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/UnitEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/UnitEditPart.java deleted file mode 100644 index 09c89bd841b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/UnitEditPart.java +++ /dev/null @@ -1,123 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.UnitFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; - -public class UnitEditPart extends AbstractElementEditPart { - - public UnitEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof UnitLabelNameEditPart) { - ((UnitLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof UnitLabelNameEditPart) { - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new UnitFigure(); - } - - @Override - public UnitFigure getPrimaryShape() { - return (UnitFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.LABEL_SYSML_UNIT_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/UnitLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/UnitLabelNameEditPart.java deleted file mode 100644 index f160a7651be..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/UnitLabelNameEditPart.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart; - -public class UnitLabelNameEditPart extends NamedElementNodeLabelNameEditPart { - - /** Constructor */ - public UnitLabelNameEditPart(View view) { - super(view); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValuePropertyCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValuePropertyCompartmentEditPart.java deleted file mode 100644 index 4c49454d343..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValuePropertyCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.edit.policy.ValueCompartmentSemanticEditPolicy; - -public class ValuePropertyCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "values"; - - public ValuePropertyCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ValueCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValueTypeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValueTypeEditPart.java deleted file mode 100644 index b3e1b126e9c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValueTypeEditPart.java +++ /dev/null @@ -1,159 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.diagram.common.figure.ValueTypeFigure; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; - -public class ValueTypeEditPart extends AbstractElementEditPart { - - public ValueTypeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof ValueTypeLabelNameEditPart) { - ((ValueTypeLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.add(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof ValueTypeLabelNameEditPart) { - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.remove(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof PropertyCompartmentEditPart) { - return getPrimaryShape().getPropertyCompartmentFigure(); - } - if (editPart instanceof OperationCompartmentEditPart) { - return getPrimaryShape().getOperationCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new ValueTypeFigure(); - } - - @Override - public ValueTypeFigure getPrimaryShape() { - return (ValueTypeFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(SysMLGraphicalTypes.LABEL_SYSML_VALUETYPE_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValueTypeLabelNameEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValueTypeLabelNameEditPart.java deleted file mode 100644 index b2fe15c129d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/ValueTypeLabelNameEditPart.java +++ /dev/null @@ -1,25 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.edit.part; - -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.uml.diagram.common.edit.part.NamedElementNodeLabelNameEditPart; - -public class ValueTypeLabelNameEditPart extends NamedElementNodeLabelNameEditPart { - - /** Constructor */ - public ValueTypeLabelNameEditPart(View view) { - super(view); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockClassifierViewFactory.java deleted file mode 100644 index 3c4cb2154b7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockClassifierViewFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class BlockClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates Block view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_PROPERTY_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_PART_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_REFERENCE_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.COMPARTMENT_UML_PORT_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_FLOWPORT_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.COMPARTMENT_UML_OPERATION_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_CONSTRAINT_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_VALUE_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - - // Start of user code preferences - @Override - protected void initializeFromPreferences(View view) { - super.initializeFromPreferences(view); - org.eclipse.jface.preference.IPreferenceStore store = (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - // Get default size from preferences use set view size. - String preferenceConstantWitdh = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.WIDTH); - String preferenceConstantHeight = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.HEIGHT); - ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width(), store.getInt(preferenceConstantWitdh)); - ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height(), store.getInt(preferenceConstantHeight)); - } - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockCompositeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockCompositeClassifierViewFactory.java deleted file mode 100644 index f993010bb16..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockCompositeClassifierViewFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; - -public class BlockCompositeClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates BlockComposite view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.LABEL_SYSML_BLOCK_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - - // Start of user code preferences - @Override - protected void initializeFromPreferences(View view) { - super.initializeFromPreferences(view); - org.eclipse.jface.preference.IPreferenceStore store = (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - // Get default size from preferences use set view size. - String preferenceConstantWitdh = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.WIDTH); - String preferenceConstantHeight = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.HEIGHT); - ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width(), store.getInt(preferenceConstantWitdh)); - ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height(), store.getInt(preferenceConstantHeight)); - } - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockPropertyCompositeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockPropertyCompositeClassifierViewFactory.java deleted file mode 100644 index 4fde8d208f4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/BlockPropertyCompositeClassifierViewFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class BlockPropertyCompositeClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates BlockPropertyComposite view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - - // Start of user code preferences - @Override - protected void initializeFromPreferences(View view) { - super.initializeFromPreferences(view); - org.eclipse.jface.preference.IPreferenceStore store = (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore(); - if (store == null) { - return; - } - // Get default size from preferences use set view size. - String preferenceConstantWitdh = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.WIDTH); - String preferenceConstantHeight = org.eclipse.papyrus.uml.diagram.common.helper.PreferenceInitializerForElementHelper.getpreferenceKey(view, view.getType(), org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.HEIGHT); - ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width(), store.getInt(preferenceConstantWitdh)); - ViewUtil.setStructuralFeatureValue(view, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height(), store.getInt(preferenceConstantHeight)); - } - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockClassifierViewFactory.java deleted file mode 100644 index 2c722b9a94a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockClassifierViewFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; - -public class ConstraintBlockClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates ConstraintBlock view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.LABEL_SYSML_CONSTRAINTBLOCK_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_PARAMETER_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_CONSTRAINT_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockPropertyCompositeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockPropertyCompositeClassifierViewFactory.java deleted file mode 100644 index 097b114915f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ConstraintBlockPropertyCompositeClassifierViewFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.infra.emf.utils.EMFHelper; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.sysml.constraints.ConstraintProperty; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; -import org.eclipse.uml2.uml.Class; -import org.eclipse.uml2.uml.Constraint; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.Type; -import org.eclipse.uml2.uml.util.UMLUtil; - -public class ConstraintBlockPropertyCompositeClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates ConstraintBlockPropertyComposite view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - - getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - if (ConstraintBlockPropertyCompositeEditPart.lastRepresentationIsSquareWithStructure()) { - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - } - - if (element != null) { - EObject newElement = EMFHelper.getEObject(element); - if (newElement instanceof Property && UMLUtil.getStereotypeApplication((Property) newElement, ConstraintProperty.class) != null) { - Property constraintProperty = (Property) newElement; - ViewService.createNode(view, getConstraint(constraintProperty), UMLGraphicalTypes.SHAPE_UML_CONSTRAINT_AS_LABEL_ID, getPreferencesHint()); - } - } - - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - - private Constraint getConstraint(Property constraintProperty) { - Type type = constraintProperty.getType(); - if (type instanceof Class && UMLUtil.getStereotypeApplication(type, ConstraintBlock.class) != null) { // instanceof ensure type is not null - Class constraintBlock = (Class) type; - EList<Constraint> ownedRules = constraintBlock.getOwnedRules(); - for (Constraint constraint : ownedRules) { - return constraint; - } - } - return null; - } - - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/DimensionClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/DimensionClassifierViewFactory.java deleted file mode 100644 index 4c9538eb7f9..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/DimensionClassifierViewFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; - -public class DimensionClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates Dimension view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.LABEL_SYSML_DIMENSION_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/FlowPortAffixedNodeViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/FlowPortAffixedNodeViewFactory.java deleted file mode 100644 index fa9338933fb..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/FlowPortAffixedNodeViewFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class FlowPortAffixedNodeViewFactory extends ShapeViewFactory { - - /** - * Creates FlowPort view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/FlowSpecificationClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/FlowSpecificationClassifierViewFactory.java deleted file mode 100644 index f94d5a153cc..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/FlowSpecificationClassifierViewFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; - -public class FlowSpecificationClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates FlowSpecification view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.LABEL_SYSML_FLOWSPECIFICATION_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, SysMLGraphicalTypes.COMPARTMENT_SYSML_FLOWPROPERTY_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/NestedBlockPropertyCompositeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/NestedBlockPropertyCompositeClassifierViewFactory.java deleted file mode 100644 index fc990300597..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/NestedBlockPropertyCompositeClassifierViewFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class NestedBlockPropertyCompositeClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates NestedBlockPropertyComposite view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/UnitClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/UnitClassifierViewFactory.java deleted file mode 100644 index 7413b11f4d1..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/UnitClassifierViewFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; - -public class UnitClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates Unit view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.LABEL_SYSML_UNIT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ValueTypeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ValueTypeClassifierViewFactory.java deleted file mode 100644 index 15d2b60264f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/ValueTypeClassifierViewFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class ValueTypeClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates ValueType view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, SysMLGraphicalTypes.LABEL_SYSML_VALUETYPE_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.COMPARTMENT_UML_PROPERTY_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.COMPARTMENT_UML_OPERATION_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockCompositeFigure.java deleted file mode 100644 index 878ae768b3a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockCompositeFigure.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class BlockCompositeFigure extends ClassifierFigure { - - public BlockCompositeFigure() { - super(); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(StructureCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getStructureCompartmentFigure() { - return getCompartment(StructureCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockFigure.java deleted file mode 100644 index 601395e4d3c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockFigure.java +++ /dev/null @@ -1,93 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockConstraintCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.PartPropertyCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.ReferencePropertyCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.ValuePropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PortCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class BlockFigure extends ClassifierFigure { - - public BlockFigure() { - super(); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(BlockPropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(PartPropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(ReferencePropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(PortCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(FlowPortCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(OperationCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(BlockConstraintCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(ValuePropertyCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getBlockPropertyCompartmentFigure() { - return getCompartment(BlockPropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - public IFigure getPartPropertyCompartmentFigure() { - return getCompartment(PartPropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - public IFigure getReferencePropertyCompartmentFigure() { - return getCompartment(ReferencePropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - public IFigure getPortCompartmentFigure() { - return getCompartment(PortCompartmentEditPart.COMPARTMENT_NAME); - } - - public IFigure getFlowPortCompartmentFigure() { - return getCompartment(FlowPortCompartmentEditPart.COMPARTMENT_NAME); - } - - @Override - public IFigure getOperationCompartmentFigure() { - return getCompartment(OperationCompartmentEditPart.COMPARTMENT_NAME); - } - - public IFigure getBlockConstraintCompartmentFigure() { - return getCompartment(BlockConstraintCompartmentEditPart.COMPARTMENT_NAME); - } - - public IFigure getValuePropertyCompartmentFigure() { - return getCompartment(ValuePropertyCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockPropertyCompositeFigure.java deleted file mode 100644 index 0122cafd541..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/BlockPropertyCompositeFigure.java +++ /dev/null @@ -1,54 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyStructureCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class BlockPropertyCompositeFigure extends ClassifierFigure { - - public BlockPropertyCompositeFigure() { - super("undefined"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(BlockPropertyStructureCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getBlockPropertyStructureCompartmentFigure() { - return getCompartment(BlockPropertyStructureCompartmentEditPart.COMPARTMENT_NAME); - } - - public void setFigureTag(String newTag) { - getTaggedLabel().setText(String.valueOf("\u00AB") + newTag + String.valueOf("\u00BB")); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockFigure.java deleted file mode 100644 index 4fbda1071ee..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockFigure.java +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockConstraintCompartmentEditPart; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.ParameterCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class ConstraintBlockFigure extends ClassifierFigure { - - public ConstraintBlockFigure() { - super("constraint"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(ParameterCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(BlockConstraintCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getParameterCompartmentFigure() { - return getCompartment(ParameterCompartmentEditPart.COMPARTMENT_NAME); - } - - public IFigure getBlockConstraintCompartmentFigure() { - return getCompartment(BlockConstraintCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockPropertyCompositeFigure.java deleted file mode 100644 index 6a941aab4be..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ConstraintBlockPropertyCompositeFigure.java +++ /dev/null @@ -1,278 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.draw2d.text.FlowPage; -import org.eclipse.gmf.runtime.diagram.ui.figures.ShapeCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.ConstraintBlockPropertyCompositeEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure; - -public class ConstraintBlockPropertyCompositeFigure extends PapyrusRoundedNodeFigure { - - protected WrappingLabel constraintLabel; - protected WrappingLabel tagLabel; - - private static final String tagConstraintText = String.valueOf("\u00AB") + "constraint" + String.valueOf("\u00BB"); - - /** main flow page */ - protected FlowPage page; - - public ConstraintBlockPropertyCompositeFigure() { - this(ConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION); - } - - public ConstraintBlockPropertyCompositeFigure(String representationMode) { - super(); - - ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout() { - - @Override - /** - * Always strech figure for StructureCompartment - * @see org.eclipse.draw2d.LayoutManager#layout(IFigure) - */ - public void layout(IFigure parent) { - if (!parent.isVisible()) { - return; - } - List<?> children = getChildren(parent); - int numChildren = children.size(); - Rectangle clientArea = transposer.t(parent.getClientArea()); - int x = clientArea.x; - int y = clientArea.y; - int availableHeight = clientArea.height; - - Dimension prefSizes[] = new Dimension[numChildren]; - Dimension minSizes[] = new Dimension[numChildren]; - Dimension maxSizes[] = new Dimension[numChildren]; - - // Calculate the width and height hints. If it's a vertical ToolBarLayout, - // then ignore the height hint (set it to -1); otherwise, ignore the - // width hint. These hints will be passed to the children of the parent - // figure when getting their preferred size. - int wHint = -1; - int hHint = -1; - if (isHorizontal()) { - hHint = parent.getClientArea(Rectangle.SINGLETON).height; - } else { - wHint = parent.getClientArea(Rectangle.SINGLETON).width; - } - - /* - * Calculate sum of preferred heights of all children(totalHeight). - * Calculate sum of minimum heights of all children(minHeight). - * Cache Preferred Sizes and Minimum Sizes of all children. - * - * totalHeight is the sum of the preferred heights of all children - * totalMinHeight is the sum of the minimum heights of all children - * prefMinSumHeight is the sum of the difference between all children's - * preferred heights and minimum heights. (This is used as a ratio to - * calculate how much each child will shrink). - */ - IFigure child; - int totalHeight = 0; - int totalMinHeight = 0; - double totalMaxHeight = 0; - int prefMinSumHeight = 0; - double prefMaxSumHeight = 0; - - for (int i = 0; i < numChildren; i++) { - child = (IFigure) children.get(i); - - prefSizes[i] = transposer.t(child.getPreferredSize(wHint, hHint)); - minSizes[i] = transposer.t(child.getMinimumSize(wHint, hHint)); - maxSizes[i] = transposer.t(child.getMaximumSize()); - - if (getConstraint(child) != null) { - double ratio = ((Double) getConstraint(child)).doubleValue(); - int prefHeight = (int) (ratio * availableHeight); - prefHeight = Math.max(prefHeight, minSizes[i].height); - prefHeight = Math.min(prefHeight, maxSizes[i].height); - prefSizes[i].height = prefHeight; - } - - totalHeight += prefSizes[i].height; - totalMinHeight += minSizes[i].height; - totalMaxHeight += maxSizes[i].height; - } - totalHeight += (numChildren - 1) * getSpacing(); - totalMinHeight += (numChildren - 1) * getSpacing(); - totalMaxHeight += (numChildren - 1) * getSpacing(); - prefMinSumHeight = totalHeight - totalMinHeight; - prefMaxSumHeight = totalMaxHeight - totalHeight; - - /* - * The total amount that the children must be shrunk is the - * sum of the preferred Heights of the children minus - * Max(the available area and the sum of the minimum heights of the children). - * - * amntShrinkHeight is the combined amount that the children must shrink - * amntShrinkCurrentHeight is the amount each child will shrink respectively - */ - int amntShrinkHeight = - totalHeight - Math.max(availableHeight, totalMinHeight); - - for (int i = 0; i < numChildren; i++) { - int amntShrinkCurrentHeight = 0; - int prefHeight = prefSizes[i].height; - int minHeight = minSizes[i].height; - int maxHeight = maxSizes[i].height; - int prefWidth = prefSizes[i].width; - int minWidth = minSizes[i].width; - int maxWidth = maxSizes[i].width; - Rectangle newBounds = new Rectangle(x, y, prefWidth, prefHeight); - - child = (IFigure) children.get(i); - if (getStretchMajorAxis() || child instanceof ShapeCompartmentFigure) { - if (amntShrinkHeight > 0 && prefMinSumHeight != 0) { - amntShrinkCurrentHeight = (int) ((long) (prefHeight - minHeight) - * amntShrinkHeight / (prefMinSumHeight)); - } else if (amntShrinkHeight < 0 && totalHeight != 0) { - amntShrinkCurrentHeight = - (int) (((maxHeight - prefHeight) / prefMaxSumHeight) - * amntShrinkHeight); - } - } - - int width = Math.min(prefWidth, maxWidth); - if (isStretchMinorAxis()) { - width = maxWidth; - } - width = Math.max(minWidth, Math.min(clientArea.width, width)); - newBounds.width = width; - - int adjust = clientArea.width - width; - switch (getMinorAlignment()) { - case ALIGN_TOPLEFT: - adjust = 0; - break; - case ALIGN_CENTER: - adjust /= 2; - break; - case ALIGN_BOTTOMRIGHT: - break; - } - newBounds.x += adjust; - if (newBounds.height - amntShrinkCurrentHeight > maxHeight) { - amntShrinkCurrentHeight = newBounds.height - maxHeight; - } - newBounds.height -= amntShrinkCurrentHeight; - child.setBounds(transposer.t(newBounds)); - - amntShrinkHeight -= amntShrinkCurrentHeight; - prefMinSumHeight -= (prefHeight - minHeight); - prefMaxSumHeight -= (maxHeight - prefHeight); - totalHeight -= prefHeight; - y += newBounds.height + getSpacing(); - } - } - - /** - * Gets the list of children after applying the layout options of - * ignore invisible children & reverse children - */ - private List<?> getChildren(IFigure container) { - @SuppressWarnings({ "rawtypes", "unchecked" }) - List<?> children = new ArrayList(container.getChildren()); - if (getIgnoreInvisibleChildren()) { - Iterator<?> iter = children.iterator(); - while (iter.hasNext()) { - IFigure f = (IFigure) iter.next(); - if (!f.isVisible()) { - iter.remove(); - } - } - } - if (isReversed()) { - Collections.reverse(children); - } - return children; - } - - }; - - layout.setStretchMajorAxis(false); - setLayoutManager(layout); - - tagLabel = new WrappingLabel(); - tagLabel.setAlignment(PositionConstants.MIDDLE); - add(tagLabel); - - if (ConstraintBlockPropertyCompositeEditPart.ROUNDED_REPRESENTATION.equals(representationMode)) { - corner = 50; - } - else { - corner = 0; - tagLabel.setText(tagConstraintText); - } - - add(nameLabel); - - constraintLabel = new WrappingLabel(); - constraintLabel.setAlignment(PositionConstants.RIGHT); - add(constraintLabel); - } - - /** - * - * @see org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure#getNameLabel() - * - * @return - */ - @Override - public WrappingLabel getNameLabel() { - return nameLabel; - } - - /** - * - * @return the textflow of the constraint that contain the string of the - * specification - */ - public WrappingLabel getConstraintLabel() { - return constraintLabel; - } - - public int getCorner() { - return corner; - } - - public void setCorner(int newCorner) { - this.corner = newCorner; - } - - public WrappingLabel getTagLabel() { - return tagLabel; - } - - public void setTagLabel(String newTag) { - this.tagLabel.setText(newTag); - } - - public static boolean isCompleteRepresentation() { - return false; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/DimensionFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/DimensionFigure.java deleted file mode 100644 index c154cd80685..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/DimensionFigure.java +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class DimensionFigure extends ClassifierFigure { - - public DimensionFigure() { - super(); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - return compartments; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/FlowSpecificationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/FlowSpecificationFigure.java deleted file mode 100644 index f05f3cde6aa..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/FlowSpecificationFigure.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class FlowSpecificationFigure extends ClassifierFigure { - - public FlowSpecificationFigure() { - super("flowSpecification"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(FlowPropertyCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getFlowPropertyCompartmentFigure() { - return getCompartment(FlowPropertyCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/NestedBlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/NestedBlockPropertyCompositeFigure.java deleted file mode 100644 index 638d17864f0..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/NestedBlockPropertyCompositeFigure.java +++ /dev/null @@ -1,47 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class NestedBlockPropertyCompositeFigure extends ClassifierFigure { - - public NestedBlockPropertyCompositeFigure() { - super("undefined"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - return compartments; - } - - public void setFigureTag(String newTag) { - getTaggedLabel().setText(String.valueOf("\u00AB") + newTag + String.valueOf("\u00BB")); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/SysMLDiagramFrameFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/SysMLDiagramFrameFigure.java deleted file mode 100644 index ad42f9d085d..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/SysMLDiagramFrameFigure.java +++ /dev/null @@ -1,176 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.MarginBorder; -import org.eclipse.draw2d.OrderedLayout; -import org.eclipse.draw2d.RectangleFigure; -import org.eclipse.draw2d.ToolbarLayout; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.gmf.runtime.diagram.ui.figures.ShapeCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.papyrus.uml.diagram.common.draw2d.InteractionFigure; -import org.eclipse.papyrus.uml.diagram.common.draw2d.LeftToolbarLayout; -import org.eclipse.papyrus.uml.diagram.common.figure.node.AutomaticCompartmentLayoutManager; -import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure; - -public class SysMLDiagramFrameFigure extends NodeNamedElementFigure { - - private WrappingLabel stereotypeLabel; - - private WrappingLabel frameLabel; - - private RectangleFigure frameLabelContainerFigure; - - private InteractionFigure interactionFigure; - - private int structureOffset; - - public SysMLDiagramFrameFigure() { - super(); - createContents(); - } - - protected void createContents() { - add(createFigureHeader()); - setLayoutManager(new SysMLLayoutLayoutManager()); - } - - protected RectangleFigure createFigureHeader() { - - if (this.stereotypeLabel == null) { - this.stereotypeLabel = new WrappingLabel() { - - @Override - public Dimension getPreferredSize(final int wHint, final int hHint) { - final Dimension preferredSize = super.getPreferredSize(wHint, hHint); - if (preferredSize.width == 0) { - return preferredSize; - } - return new Dimension(preferredSize.width + 2, preferredSize.height); - } - }; - } - - stereotypeLabel.setAlignment(OrderedLayout.ALIGN_CENTER); - if (this.frameLabel == null) { - this.frameLabel = new WrappingLabel() { - - @Override - public Dimension getPreferredSize(final int wHint, final int hHint) { - final Dimension preferredSize = super.getPreferredSize(wHint, hHint); - if (preferredSize.width == 0) { - return preferredSize; - } - return new Dimension(preferredSize.width + 9, preferredSize.height); - } - }; - } - - interactionFigure = new InteractionFigure(); - interactionFigure.setBorder(new MarginBorder(3, 3, 6, 3)); - interactionFigure.setLayoutManager(new LeftToolbarLayout()); - interactionFigure.add(frameLabel); - - frameLabelContainerFigure = new RectangleFigure(); - frameLabelContainerFigure.setOutline(false); - frameLabelContainerFigure.setFill(false); - frameLabelContainerFigure.setLayoutManager(new ToolbarLayout(false)); - frameLabelContainerFigure.add(interactionFigure, OrderedLayout.ALIGN_CENTER); - return frameLabelContainerFigure; - } - - @Override - public WrappingLabel getNameLabel() { - if (frameLabel == null) { - createFigureHeader(); - } - return frameLabel; - } - - public RectangleFigure getLabelContainer() { - return frameLabelContainerFigure; - } - - /** - * this is the layout manager in charge to place element in the enumeration - * - */ - private class SysMLLayoutLayoutManager extends AutomaticCompartmentLayoutManager { - - /** - * - * {@inheritDoc} - */ - @Override - public void layout(final IFigure container) { - List<IFigure> figuresToRemove = new ArrayList<IFigure>(); - for (int i = 0; i < container.getChildren().size(); i++) { - IFigure currentCompartment = (IFigure) container.getChildren().get(i); - // this is a visible compartment - if (currentCompartment instanceof ShapeCompartmentFigure) { - Rectangle bound = new Rectangle(currentCompartment.getBounds()); - currentCompartment.invalidate(); - Dimension pref = currentCompartment.getPreferredSize(); - currentCompartment.invalidate(); - Dimension prefConstraint = currentCompartment.getPreferredSize(container.getBounds().width - 40, -1); - if (pref.width < prefConstraint.width) { - bound.setSize(pref); - } else { - bound.setSize(prefConstraint); - } - bound.x = container.getBounds().x + 10; - bound.y = container.getBounds().y + structureOffset; - bound.width = container.getBounds().width - 20; - bound.height = container.getBounds().height - structureOffset - 10; - currentCompartment.setBounds(bound); - } else if (currentCompartment == frameLabelContainerFigure) { - Rectangle boundLabel = new Rectangle(frameLabelContainerFigure.getBounds()); - Dimension frameLabelDimension = frameLabelContainerFigure.getPreferredSize(); - boundLabel.setSize(frameLabelDimension); - frameLabelContainerFigure.setBounds(boundLabel); - } else { - // remove other figure - figuresToRemove.add(currentCompartment); - } - } - for (IFigure iFigure : figuresToRemove) { - container.getChildren().remove(iFigure); - } - } - } - - public void setStereotypeLabel(String stereotypeText) { - interactionFigure.remove(frameLabel); - if (interactionFigure.getChildren().contains(stereotypeLabel)) { - interactionFigure.remove(stereotypeLabel); - } - if (stereotypeText != null && !stereotypeText.isEmpty()) { - stereotypeLabel.setText(String.valueOf("\u00AB") + stereotypeText + String.valueOf("\u00BB")); - interactionFigure.add(stereotypeLabel); - structureOffset = 41; - } - else { - // no stereotype - structureOffset = 26; - } - interactionFigure.add(frameLabel); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/UnitFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/UnitFigure.java deleted file mode 100644 index 21d1c2521eb..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/UnitFigure.java +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class UnitFigure extends ClassifierFigure { - - public UnitFigure() { - super(); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - return compartments; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ValueTypeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ValueTypeFigure.java deleted file mode 100644 index 0536e5f8fc4..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/ValueTypeFigure.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class ValueTypeFigure extends ClassifierFigure { - - public ValueTypeFigure() { - super(); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(PropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(OperationCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getPropertyCompartmentFigure() { - return getCompartment(PropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - @Override - public IFigure getOperationCompartmentFigure() { - return getCompartment(OperationCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java deleted file mode 100644 index 572c2de388f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.utils; - -public class SysMLGraphicalTypes { - - /** ********************************************************* */ - /** Diagram custom graphical types id *********************** */ - /** ********************************************************* */ - /** Custom nodes */ - public static final String SHAPE_SYSML_BLOCK_AS_CLASSIFIER_ID = "shape_sysml_block_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID = "shape_sysml_block_as_composite"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID = "shape_sysml_blockproperty_as_composite"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_CONSTRAINTBLOCKPROPERTY_AS_COMPOSITE_ID = "shape_sysml_constraintblockproperty_as_composite"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_DIMENSION_AS_CLASSIFIER_ID = "shape_sysml_dimension_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_CONSTRAINTBLOCK_AS_CLASSIFIER_ID = "shape_sysml_constraintblock_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_FLOWSPECIFICATION_AS_CLASSIFIER_ID = "shape_sysml_flowspecification_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_UNIT_AS_CLASSIFIER_ID = "shape_sysml_unit_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_VALUETYPE_AS_CLASSIFIER_ID = "shape_sysml_valuetype_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID = "shape_sysml_flowport_as_affixed"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_REQUIREMENT_AS_CLASSIFER_ID = "shape_sysml_requirement_as_classifier"; //$NON-NLS-1$ - - @Deprecated - public static final String SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID = "shape_sysml_nestedblockproperty_as_composite"; //$NON-NLS-1$ - - /** Custom label nodes */ - public static final String SHAPE_SYSML_CONSTRAINTPROPERTY_AS_LABEL_ID = "shape_sysml_constraintproperty_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_FLOWPORT_AS_LABEL_ID = "shape_sysml_flowport_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_FLOWPROPERTY_AS_LABEL_ID = "shape_sysml_flowproperty_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_PART_AS_LABEL_ID = "shape_sysml_part_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_REFERENCE_AS_LABEL_ID = "shape_sysml_reference_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_SYSML_VALUE_AS_LABEL_ID = "shape_sysml_value_as_label"; //$NON-NLS-1$ - - /** Custom inner labels */ - public static final String LABEL_SYSML_BLOCK_NAME_ID = "label_sysml_block_name"; //$NON-NLS-1$ - - public static final String LABEL_SYSML_CONSTRAINTBLOCK_NAME_ID = "label_sysml_constraintblock_name"; //$NON-NLS-1$ - - public static final String LABEL_SYSML_DIMENSION_NAME_ID = "label_sysml_dimension_name"; //$NON-NLS-1$ - - public static final String LABEL_SYSML_FLOWSPECIFICATION_NAME_ID = "label_sysml_flowspecification_name"; //$NON-NLS-1$ - - public static final String LABEL_SYSML_UNIT_NAME_ID = "label_sysml_unit_name"; //$NON-NLS-1$ - - public static final String LABEL_SYSML_VALUETYPE_NAME_ID = "label_sysml_valuetype_name"; //$NON-NLS-1$ - - public static final String LABEL_SYSML_REQUIREMENT_ID_ID = "label_sysml_requirement_id"; //$NON-NLS-1$ - - public static final String LABEL_SYSML_REQUIREMENT_TEXT_ID = "label_sysml_requirement_text"; //$NON-NLS-1$ - - /** Custom affixed labels */ - public static final String AFFIXEDLABEL_SYSML_FLOWPORT_LABEL_ID = "affixedlabel_sysml_flowport_label"; //$NON-NLS-1$ - - /** Custom compartments */ - public static final String COMPARTMENT_SYSML_CONSTRAINT_AS_LIST_ID = "compartment_sysml_constraint_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_FLOWPORT_AS_LIST_ID = "compartment_sysml_flowport_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_FLOWPROPERTY_AS_LIST_ID = "compartment_sysml_flowproperty_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_PARAMETER_AS_LIST_ID = "compartment_sysml_parameter_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_PART_AS_LIST_ID = "compartment_sysml_part_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_PROPERTY_AS_LIST_ID = "compartment_sysml_property_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_REFERENCE_AS_LIST_ID = "compartment_sysml_reference_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_STRUCTURE_ID = "compartment_sysml_structure"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID = "compartment_sysml_blockproperty_structure"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_VALUE_AS_LIST_ID = "compartment_sysml_value_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_SYSML_REQUIREMENT_IDINFO_AS_LIST_ID = "compartment_sysml_requirement_idinfo_as_list"; //$NON-NLS-1$ - - /** Custom links */ - public static final String LINK_SYSML_ASSOCIATION_ID = "link_sysml_association"; //$NON-NLS-1$ -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ActorEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ActorEditPart.java deleted file mode 100644 index d98baf375aa..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ActorEditPart.java +++ /dev/null @@ -1,156 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.ActorFigure; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class ActorEditPart extends AbstractElementEditPart { - - public ActorEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - ((NamedElementNodeLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.add(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.remove(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof PropertyCompartmentEditPart) { - return getPrimaryShape().getPropertyCompartmentFigure(); - } - if (editPart instanceof OperationCompartmentEditPart) { - return getPrimaryShape().getOperationCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new ActorFigure(); - } - - @Override - public ActorFigure getPrimaryShape() { - return (ActorFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java deleted file mode 100644 index 699f630a164..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConnectorEditPart.java +++ /dev/null @@ -1,112 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.Connection; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.sysml.blocks.BindingConnector; -import org.eclipse.papyrus.uml.diagram.common.figure.ConnectorEdgeFigure; -import org.eclipse.uml2.uml.Element; - -public class ConnectorEditPart extends AbstractElementLinkEditPart { - - /** - * Constructor. - */ - public ConnectorEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - // Start of user code custom policies - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof ConnectorLinkLabelEditPart) { - ((ConnectorLinkLabelEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof ConnectorLinkLabelSourceMultiplicityEditPart) { - ((ConnectorLinkLabelSourceMultiplicityEditPart) childEditPart).setLabel(getPrimaryShape().getSourceMultiplicityLabel()); - return true; - } - if (childEditPart instanceof ConnectorLinkLabelTargetMultiplicityEditPart) { - ((ConnectorLinkLabelTargetMultiplicityEditPart) childEditPart).setLabel(getPrimaryShape().getTargetMultiplicityLabel()); - return true; - } - return super.addFixedChild(childEditPart); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof ConnectorLinkLabelEditPart) { - return true; - } - if (childEditPart instanceof ConnectorLinkLabelSourceMultiplicityEditPart) { - return true; - } - if (childEditPart instanceof ConnectorLinkLabelTargetMultiplicityEditPart) { - return true; - } - return super.removeFixedChild(childEditPart); - } - - /** - * Creates figure for this edit part. - */ - @Override - protected Connection createConnectionFigure() { - return new ConnectorEdgeFigure(); - } - - /** - * Creates primary shape for this edit part. - */ - @Override - public ConnectorEdgeFigure getPrimaryShape() { - return (ConnectorEdgeFigure) getFigure(); - } - - @Override - protected void refreshLineWidth() { - int width = getLineWidth(); - if (width < 1) { - width = 1; - } - - if (org.eclipse.uml2.uml.util.UMLUtil.getStereotypeApplication((Element) resolveSemanticElement(), BindingConnector.class) != null) { - setLineWidth(width * 2); - } else { - setLineWidth(width); - } - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintCompartmentEditPart.java deleted file mode 100644 index 81395657cb7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; - -public class ConstraintCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "constraints"; - - public ConstraintCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintParameterAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintParameterAffixedNodeEditPart.java deleted file mode 100644 index 436f87d7959..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/ConstraintParameterAffixedNodeEditPart.java +++ /dev/null @@ -1,206 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.LayoutListener; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.NotationPackage; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.ExternalLabelPrimaryDragRoleEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeIconlDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.node.AffixedNamedElementFigure; -import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusUMLElementFigure; -import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class ConstraintParameterAffixedNodeEditPart extends AbstractElementBorderEditPart { - - private LayoutListener.Stub layoutInitializationListener; - - public ConstraintParameterAffixedNodeEditPart(View view) { - super(view); - } - - - @Override - protected EditPart createChild(Object model) { - return super.createChild(model); - } - - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeIconlDisplayEditPolicy() { - - /** - * <pre> - * {@inheritDoc} - * - * This modifies the edit policy in order to call refreshVisuals() whenever the stereotype image to show is null. - * (required to show the Port default image correctly). - * </pre> - */ - @Override - protected void refreshStereotypeDisplay() { - if (getHost() instanceof IPapyrusEditPart) { - IFigure figure = ((IPapyrusEditPart) getHost()).getPrimaryShape(); - - if ((figure instanceof IPapyrusUMLElementFigure) && (stereotypeIconToDisplay() != null)) { - ((IPapyrusUMLElementFigure) figure).setStereotypeDisplay(null, stereotypeIconToDisplay()); - } else { - refreshVisuals(); - } - } - } - - }); - - installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { // External labels - return new ExternalLabelPrimaryDragRoleEditPolicy() { - - @Override - @SuppressWarnings("rawtypes") - protected List createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - }; - } - - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - return; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID); - } - - /** - * <pre> - * Calls the figure refresh when a change event is detected on - * UMLPackage.eINSTANCE.getProperty_Aggregation(). - * - * {@inheritDoc} - * </pre> - */ - @Override - protected void handleNotificationEvent(Notification event) { - - // When the constraint parameter position changes, its position on parent side may change and requires a visual refresh. - Object feature = event.getFeature(); - if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { - refreshVisuals(); - } - - super.handleNotificationEvent(event); - } - - /** - * {@inheritDoc} - */ - @Override - protected IFigure createNodeShape() { - return primaryShape = new AffixedNamedElementFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - public AffixedNamedElementFigure getPrimaryShape() { - return (AffixedNamedElementFigure) primaryShape; - } - - /** - * <pre> - * A post layout listener is added during activate and remove the first time the layout occurs. - * This is required in order to be able to find the side of this border item on its parent when opening the model. - * Without this, the locator is unable to guess the parent side because the parent constraint is not set yet. - * - * Once the initialization is done, the listener become useless and can be removed. - * - * {@inheritDoc} - * </pre> - */ - @Override - public void activate() { - - layoutInitializationListener = new LayoutListener.Stub() { - - @Override - public void postLayout(IFigure container) { - refreshVisuals(); - // getBorderedFigure().getBorderItemContainer().removeLayoutListener(layoutInitializationListener); - layoutInitializationListener = null; - } - }; - getBorderedFigure().getBorderItemContainer().addLayoutListener(layoutInitializationListener); - - super.activate(); - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/DataTypeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/DataTypeEditPart.java deleted file mode 100644 index 9493d1aee61..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/DataTypeEditPart.java +++ /dev/null @@ -1,156 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.DataTypeFigure; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class DataTypeEditPart extends AbstractElementEditPart { - - public DataTypeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - ((NamedElementNodeLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.add(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.remove(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof PropertyCompartmentEditPart) { - return getPrimaryShape().getPropertyCompartmentFigure(); - } - if (editPart instanceof OperationCompartmentEditPart) { - return getPrimaryShape().getOperationCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new DataTypeFigure(); - } - - @Override - public DataTypeFigure getPrimaryShape() { - return (DataTypeFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/DependencyEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/DependencyEditPart.java deleted file mode 100644 index 795bae58205..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/DependencyEditPart.java +++ /dev/null @@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType; -import org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure; - -public class DependencyEditPart extends AbstractElementLinkEditPart { - - /** - * Constructor. - */ - public DependencyEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - // Start of user code custom policies - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - ((NamedElementLinkLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - return super.addFixedChild(childEditPart); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - return true; - } - return super.removeFixedChild(childEditPart); - } - - /** - * Creates figure for this edit part. - */ - @Override - protected Connection createConnectionFigure() { - return new NamedElementEdgeFigure(); - } - - /** - * Creates primary shape for this edit part. - */ - @Override - public NamedElementEdgeFigure getPrimaryShape() { - return (NamedElementEdgeFigure) getFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshLineType() { - // Start of user code custom line type - setLineType(Graphics.LINE_CUSTOM); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowSource() { - // Start of user code custom source decoration - setArrowSource(getArrowDecoration(EdgeDecorationType.NONE)); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowTarget() { - // Start of user code custom target decoration - setArrowTarget(getArrowDecoration(EdgeDecorationType.OPEN_ARROW)); - // End of user code - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/EnumerationEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/EnumerationEditPart.java deleted file mode 100644 index 9b8c7323269..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/EnumerationEditPart.java +++ /dev/null @@ -1,141 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.EnumerationFigure; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class EnumerationEditPart extends AbstractElementEditPart { - - public EnumerationEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - ((NamedElementNodeLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof EnumerationLiteralCompartmentEditPart) { - IFigure pane = getPrimaryShape().getEnumerationLiteralCompartmentFigure(); - setupContentPane(pane); - pane.add(((EnumerationLiteralCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - return true; - } - if (childEditPart instanceof EnumerationLiteralCompartmentEditPart) { - IFigure pane = getPrimaryShape().getEnumerationLiteralCompartmentFigure(); - setupContentPane(pane); - pane.remove(((EnumerationLiteralCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof EnumerationLiteralCompartmentEditPart) { - return getPrimaryShape().getEnumerationLiteralCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new EnumerationFigure(); - } - - @Override - public EnumerationFigure getPrimaryShape() { - return (EnumerationFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/EnumerationLiteralCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/EnumerationLiteralCompartmentEditPart.java deleted file mode 100644 index c8e2aead54c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/EnumerationLiteralCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; - -public class EnumerationLiteralCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "literals"; - - public EnumerationLiteralCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/GeneralizationEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/GeneralizationEditPart.java deleted file mode 100644 index ad314da2305..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/GeneralizationEditPart.java +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType; -import org.eclipse.papyrus.uml.diagram.common.figure.GeneralizationFigure; - -public class GeneralizationEditPart extends AbstractElementLinkEditPart { - - /** - * Constructor. - */ - public GeneralizationEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - // Start of user code custom policies - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean addFixedChild(EditPart childEditPart) { - return super.addFixedChild(childEditPart); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - return super.removeFixedChild(childEditPart); - } - - /** - * Creates figure for this edit part. - */ - @Override - protected Connection createConnectionFigure() { - return new GeneralizationFigure(); - } - - /** - * Creates primary shape for this edit part. - */ - @Override - public GeneralizationFigure getPrimaryShape() { - return (GeneralizationFigure) getFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshLineType() { - // Start of user code custom line type - setLineType(Graphics.LINE_SOLID); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowSource() { - // Start of user code custom source decoration - setArrowSource(getArrowDecoration(EdgeDecorationType.NONE)); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowTarget() { - // Start of user code custom target decoration - setArrowTarget(getArrowDecoration(EdgeDecorationType.SOLID_ARROW_EMPTY)); - // End of user code - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/InterfaceEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/InterfaceEditPart.java deleted file mode 100644 index f2947a5d2b2..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/InterfaceEditPart.java +++ /dev/null @@ -1,156 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.InterfaceFigure; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class InterfaceEditPart extends AbstractElementEditPart { - - public InterfaceEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - ((NamedElementNodeLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.add(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.remove(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof PropertyCompartmentEditPart) { - return getPrimaryShape().getPropertyCompartmentFigure(); - } - if (editPart instanceof OperationCompartmentEditPart) { - return getPrimaryShape().getOperationCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new InterfaceFigure(); - } - - @Override - public InterfaceFigure getPrimaryShape() { - return (InterfaceFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/InterfaceRealizationEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/InterfaceRealizationEditPart.java deleted file mode 100644 index 1d11426d928..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/InterfaceRealizationEditPart.java +++ /dev/null @@ -1,113 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType; -import org.eclipse.papyrus.uml.diagram.common.figure.InterfaceRealizationFigure; - -public class InterfaceRealizationEditPart extends AbstractElementLinkEditPart { - - /** - * Constructor. - */ - public InterfaceRealizationEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - // Start of user code custom policies - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - ((NamedElementLinkLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - return super.addFixedChild(childEditPart); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - return true; - } - return super.removeFixedChild(childEditPart); - } - - /** - * Creates figure for this edit part. - */ - @Override - protected Connection createConnectionFigure() { - return new InterfaceRealizationFigure(); - } - - /** - * Creates primary shape for this edit part. - */ - @Override - public InterfaceRealizationFigure getPrimaryShape() { - return (InterfaceRealizationFigure) getFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshLineType() { - // Start of user code custom line type - setLineType(Graphics.LINE_CUSTOM); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowSource() { - // Start of user code custom source decoration - setArrowSource(getArrowDecoration(EdgeDecorationType.NONE)); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowTarget() { - // Start of user code custom target decoration - setArrowTarget(getArrowDecoration(EdgeDecorationType.SOLID_ARROW_EMPTY)); - // End of user code - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/OperationCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/OperationCompartmentEditPart.java deleted file mode 100644 index 29dd59c92d5..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/OperationCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; - -public class OperationCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "operations"; - - public OperationCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedNodeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedNodeEditPart.java deleted file mode 100644 index e8715b7db88..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PortAffixedNodeEditPart.java +++ /dev/null @@ -1,102 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.LayoutEditPolicy; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.handles.MoveHandle; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; -import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.edit.policy.ExternalLabelPrimaryDragRoleEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeIconlDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideLabelEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class PortAffixedNodeEditPart extends AbstractElementBorderEditPart { - - public PortAffixedNodeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeIconlDisplayEditPolicy()); - installEditPolicy(ShowHideLabelEditPolicy.SHOW_HIDE_LABEL_ROLE, new ShowHideLabelEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - if (child instanceof IBorderItemEditPart) { // External labels - return new ExternalLabelPrimaryDragRoleEditPolicy() { - - @Override - protected List createSelectionHandles() { - MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); - mh.setBorder(null); - return Collections.singletonList(mh); - } - }; - } - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { - IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); - borderItemContainer.add(borderItemEditPart.getFigure(), locator); - return; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PortCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PortCompartmentEditPart.java deleted file mode 100644 index f70d5b19b79..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PortCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; - -public class PortCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "standard ports"; - - public PortCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PrimitiveTypeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PrimitiveTypeEditPart.java deleted file mode 100644 index 6d027342cc8..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PrimitiveTypeEditPart.java +++ /dev/null @@ -1,122 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.PrimitiveTypeFigure; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class PrimitiveTypeEditPart extends AbstractElementEditPart { - - public PrimitiveTypeEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - ((NamedElementNodeLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new PrimitiveTypeFigure(); - } - - @Override - public PrimitiveTypeFigure getPrimaryShape() { - return (PrimitiveTypeFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyCompartmentEditPart.java deleted file mode 100644 index a42db06ab62..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/PropertyCompartmentEditPart.java +++ /dev/null @@ -1,66 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; -import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; - -public class PropertyCompartmentEditPart extends ResizeableListCompartmentEditPart { - - public final static String COMPARTMENT_NAME = "properties"; - - public PropertyCompartmentEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy()); - installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy()); - // Start of user code custom edit policies - // End of user code - } - - @Override - public String getCompartmentName() { - return COMPARTMENT_NAME; - } - - @Override - protected boolean hasModelChildrenChanged(Notification evt) { - return false; - } - - @Override - public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); - result.setTitleVisibility(false); - return result; - } - - @Override - protected void setRatio(Double ratio) { - if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { - super.setRatio(ratio); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/SignalEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/SignalEditPart.java deleted file mode 100644 index 3411cbe80af..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/SignalEditPart.java +++ /dev/null @@ -1,156 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.EditPart; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gef.commands.Command; -import org.eclipse.gef.editpolicies.NonResizableEditPolicy; -import org.eclipse.gef.requests.CreateRequest; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideClassifierContentsEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.SignalFigure; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class SignalEditPart extends AbstractElementEditPart { - - public SignalEditPart(View view) { - super(view); - } - - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy()); - installEditPolicy(ShowHideClassifierContentsEditPolicy.SHOW_HIDE_CLASSIFIER_CONTENTS_POLICY, new ShowHideClassifierContentsEditPolicy()); - installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); - // Start of user code custom policies - // End of user code - } - - @Override - protected LayoutEditPolicy createLayoutEditPolicy() { - org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { - - @Override - protected EditPolicy createChildEditPolicy(EditPart child) { - EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - if (result == null) { - result = new NonResizableEditPolicy(); - } - return result; - } - - @Override - protected Command getMoveChildrenCommand(Request request) { - return null; - } - - @Override - protected Command getCreateCommand(CreateRequest request) { - return null; - } - }; - return lep; - } - - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - ((NamedElementNodeLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.add(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.add(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementNodeLabelNameEditPart) { - return true; - } - if (childEditPart instanceof PropertyCompartmentEditPart) { - IFigure pane = getPrimaryShape().getPropertyCompartmentFigure(); - setupContentPane(pane); - pane.remove(((PropertyCompartmentEditPart) childEditPart).getFigure()); - return true; - } - if (childEditPart instanceof OperationCompartmentEditPart) { - IFigure pane = getPrimaryShape().getOperationCompartmentFigure(); - setupContentPane(pane); - pane.remove(((OperationCompartmentEditPart) childEditPart).getFigure()); - return true; - } - return false; - } - - @Override - protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { - if (editPart instanceof PropertyCompartmentEditPart) { - return getPrimaryShape().getPropertyCompartmentFigure(); - } - if (editPart instanceof OperationCompartmentEditPart) { - return getPrimaryShape().getOperationCompartmentFigure(); - } - return getContentPane(); - } - - // public EditPart getTargetEditPart(Request request) { - // if(request instanceof CreateViewAndElementRequest) { - // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter(); - // IElementType type = (IElementType)adapter.getAdapter(IElementType.class); - // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) { - // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT); - // } - // } - // return super.getTargetEditPart(request); - // } - @Override - protected IFigure createNodeShape() { - return primaryShape = new SignalFigure(); - } - - @Override - public SignalFigure getPrimaryShape() { - return (SignalFigure) primaryShape; - } - - @Override - public EditPart getPrimaryChildEditPart() { - return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/UsageEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/UsageEditPart.java deleted file mode 100644 index cfab37bf90f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/edit/part/UsageEditPart.java +++ /dev/null @@ -1,116 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.edit.part; - -import org.eclipse.draw2d.Connection; -import org.eclipse.draw2d.Graphics; -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLinkLabelDisplayEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.figure.EdgeDecorationType; -import org.eclipse.papyrus.uml.diagram.common.figure.NamedElementEdgeFigure; - -public class UsageEditPart extends AbstractElementLinkEditPart { - - /** - * Constructor. - */ - public UsageEditPart(View view) { - super(view); - } - - /** - * {@inheritDoc} - */ - @Override - protected void createDefaultEditPolicies() { - super.createDefaultEditPolicies(); - installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); - installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy("use")); - // Start of user code custom policies - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean addFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - ((NamedElementLinkLabelNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); - return true; - } - return super.addFixedChild(childEditPart); - } - - /** - * {@inheritDoc} - */ - @Override - protected boolean removeFixedChild(EditPart childEditPart) { - if (childEditPart instanceof NamedElementLinkLabelNameEditPart) { - return true; - } - return super.removeFixedChild(childEditPart); - } - - /** - * Creates figure for this edit part. - */ - @Override - protected Connection createConnectionFigure() { - return new NamedElementEdgeFigure(); - } - - /** - * Creates primary shape for this edit part. - */ - @Override - public NamedElementEdgeFigure getPrimaryShape() { - return (NamedElementEdgeFigure) getFigure(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshLineType() { - // Start of user code custom line type - setLineType(Graphics.LINE_CUSTOM); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowSource() { - // Start of user code custom source decoration - setArrowSource(getArrowDecoration(EdgeDecorationType.NONE)); - // End of user code - } - - /** - * {@inheritDoc} - */ - @Override - protected void refreshArrowTarget() { - // Start of user code custom target decoration - setArrowTarget(getArrowDecoration(EdgeDecorationType.OPEN_ARROW)); - // End of user code - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConnectorLinkViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConnectorLinkViewFactory.java deleted file mode 100644 index f1851011c66..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConnectorLinkViewFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ConnectorViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * View factory for Connector. - */ -public class ConnectorLinkViewFactory extends ConnectorViewFactory { - - /** - * Creates Connector view and add Label nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConstraintPropertyAffixedNodeViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConstraintPropertyAffixedNodeViewFactory.java deleted file mode 100644 index 96460cb9c40..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/ConstraintPropertyAffixedNodeViewFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - - - -public class ConstraintPropertyAffixedNodeViewFactory extends PortAffixedNodeViewFactory { -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/DependencyLinkViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/DependencyLinkViewFactory.java deleted file mode 100644 index 15aba6f4db5..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/DependencyLinkViewFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ConnectorViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * View factory for Dependency. - */ -public class DependencyLinkViewFactory extends ConnectorViewFactory { - - /** - * Creates Dependency view and add Label nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/EnumerationClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/EnumerationClassifierViewFactory.java deleted file mode 100644 index 4b300693973..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/EnumerationClassifierViewFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class EnumerationClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates Enumeration view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.COMPARTMENT_UML_ENUMERATIONLITERAL_AS_LIST_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/GeneralizationLinkViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/GeneralizationLinkViewFactory.java deleted file mode 100644 index 4459ac68e98..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/GeneralizationLinkViewFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ConnectorViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * View factory for Generalization. - */ -public class GeneralizationLinkViewFactory extends ConnectorViewFactory { - - /** - * Creates Generalization view and add Label nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/InterfaceRealizationLinkViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/InterfaceRealizationLinkViewFactory.java deleted file mode 100644 index 095d3582c4e..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/InterfaceRealizationLinkViewFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ConnectorViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * View factory for InterfaceRealization. - */ -public class InterfaceRealizationLinkViewFactory extends ConnectorViewFactory { - - /** - * Creates InterfaceRealization view and add Label nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/PortAffixedNodeViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/PortAffixedNodeViewFactory.java deleted file mode 100644 index 555236eacd7..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/PortAffixedNodeViewFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class PortAffixedNodeViewFactory extends ShapeViewFactory { - - /** - * Creates Port view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.AFFIXEDLABEL_UML_PORT_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/PrimitiveTypeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/PrimitiveTypeClassifierViewFactory.java deleted file mode 100644 index 0f603a562ef..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/PrimitiveTypeClassifierViewFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -public class PrimitiveTypeClassifierViewFactory extends ShapeViewFactory { - - /** - * Creates PrimitiveType view and add Label and Compartment nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_NAMEDELEMENT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - // this action needs to be done after the compartments creation - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } - // Start of user code preferences - // End of user code -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/UsageLinkViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/UsageLinkViewFactory.java deleted file mode 100644 index a02e00ede2a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/factory/UsageLinkViewFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.factory; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.gmf.diagram.common.factory.ConnectorViewFactory; -import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes; - -/** - * View factory for Usage. - */ -public class UsageLinkViewFactory extends ConnectorViewFactory { - - /** - * Creates Usage view and add Label nodes - */ - @Override - protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) { - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_APPLIEDSTEREOTYPE_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - getViewService().createNode(element, view, UMLGraphicalTypes.LINKLABEL_UML_NAMEDELEMENT_NAME_ID, ViewUtil.APPEND, persisted, getPreferencesHint()); - super.decorateView(containerView, view, element, semanticHint, index, persisted); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/ActorFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/ActorFigure.java deleted file mode 100644 index e7b5124b775..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/ActorFigure.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class ActorFigure extends ClassifierFigure { - - public ActorFigure() { - super("actor"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(PropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(OperationCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getPropertyCompartmentFigure() { - return getCompartment(PropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - @Override - public IFigure getOperationCompartmentFigure() { - return getCompartment(OperationCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/DataTypeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/DataTypeFigure.java deleted file mode 100644 index e6ab2cb91d3..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/DataTypeFigure.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class DataTypeFigure extends ClassifierFigure { - - public DataTypeFigure() { - super("datatype"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(PropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(OperationCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getPropertyCompartmentFigure() { - return getCompartment(PropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - @Override - public IFigure getOperationCompartmentFigure() { - return getCompartment(OperationCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/EnumerationFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/EnumerationFigure.java deleted file mode 100644 index 33839691c06..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/EnumerationFigure.java +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.EnumerationLiteralCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class EnumerationFigure extends ClassifierFigure { - - public EnumerationFigure() { - super("enumeration"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(EnumerationLiteralCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getEnumerationLiteralCompartmentFigure() { - return getCompartment(EnumerationLiteralCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceFigure.java deleted file mode 100644 index db162ee1a95..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/InterfaceFigure.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class InterfaceFigure extends ClassifierFigure { - - public InterfaceFigure() { - super("interface"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(PropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(OperationCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getPropertyCompartmentFigure() { - return getCompartment(PropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - @Override - public IFigure getOperationCompartmentFigure() { - return getCompartment(OperationCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/PrimitiveTypeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/PrimitiveTypeFigure.java deleted file mode 100644 index 596800a9789..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/PrimitiveTypeFigure.java +++ /dev/null @@ -1,43 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class PrimitiveTypeFigure extends ClassifierFigure { - - public PrimitiveTypeFigure() { - super("primitive"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - return compartments; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/SignalFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/SignalFigure.java deleted file mode 100644 index 8b78df6b131..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/figure/SignalFigure.java +++ /dev/null @@ -1,57 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.figure; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.papyrus.uml.diagram.common.edit.part.OperationCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure; - -public class SignalFigure extends ClassifierFigure { - - public SignalFigure() { - super("signal"); //$NON-NLS-1$ - } - - @Override - protected void createContentPane(List<String> compartments) { - super.createContentPane(getUpdatedListOfCompartments(compartments)); - } - - /** - * Get the list of compartments, updated with specific ones - * - * @param compartments - * the original list of compartments (untouched) - * @return the new completed list of compartments - */ - private List<String> getUpdatedListOfCompartments(List<String> compartments) { - compartments = new ArrayList<String>(compartments); - compartments.add(PropertyCompartmentEditPart.COMPARTMENT_NAME); - compartments.add(OperationCompartmentEditPart.COMPARTMENT_NAME); - return compartments; - } - - public IFigure getPropertyCompartmentFigure() { - return getCompartment(PropertyCompartmentEditPart.COMPARTMENT_NAME); - } - - @Override - public IFigure getOperationCompartmentFigure() { - return getCompartment(OperationCompartmentEditPart.COMPARTMENT_NAME); - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java deleted file mode 100644 index 494dea676aa..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/uml/diagram/common/utils/UMLGraphicalTypes.java +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.common.utils; - -public class UMLGraphicalTypes { - - /** ********************************************************* */ - /** Diagram custom graphical types id *********************** */ - /** ********************************************************* */ - /** Custom nodes */ - public static final String SHAPE_UML_ACTOR_AS_CLASSIFIER_ID = "shape_uml_actor_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_UML_DATATYPE_AS_CLASSIFIER_ID = "shape_uml_datatype_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_UML_ENUMERATION_AS_CLASSIFIER_ID = "shape_uml_enumeration_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_UML_INTERFACE_AS_CLASSIFIER_ID = "shape_uml_interface_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_UML_PRIMITIVETYPE_AS_CLASSIFIER_ID = "shape_uml_primitivetype_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_UML_SIGNAL_AS_CLASSIFIER_ID = "shape_uml_signal_as_classifier"; //$NON-NLS-1$ - - public static final String SHAPE_UML_PORT_AS_AFFIXED_ID = "shape_uml_port_as_affixed"; //$NON-NLS-1$ - - public static final String SHAPE_UML_PROPERTY_AS_AFFIXED_ID = "shape_uml_property_as_affixed"; //$NON-NLS-1$ - - /** Custom label nodes */ - public static final String SHAPE_UML_CONSTRAINT_AS_LABEL_ID = "shape_uml_constraint_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_UML_ENUMERATIONLITERAL_AS_LABEL_ID = "shape_uml_enumerationliteral_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_UML_OPERATION_AS_LABEL_ID = "shape_uml_operation_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_UML_PORT_AS_LABEL_ID = "shape_uml_port_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_UML_PROPERTY_AS_LABEL_ID = "shape_uml_property_as_label"; //$NON-NLS-1$ - - public static final String SHAPE_UML_RECEPTION_AS_LABEL_ID = "shape_uml_reception_as_label"; //$NON-NLS-1$ - - /** Custom inner labels */ - public static final String LABEL_UML_NAMEDELEMENT_NAME_ID = "label_uml_namedelement_name"; //$NON-NLS-1$ - - public static final String LABEL_UML_PROPERTY_LABEL_ID = "label_uml_property_label"; //$NON-NLS-1$ - - /** Custom affixed labels */ - public static final String AFFIXEDLABEL_UML_APPLIEDSTEREOTYPE_ID = "affixedlabel_uml_appliedstereotype"; //$NON-NLS-1$ - - public static final String AFFIXEDLABEL_UML_NAMEDELEMENT_NAME_ID = "affixedlabel_uml_namedelement_name"; //$NON-NLS-1$ - - public static final String AFFIXEDLABEL_UML_PORT_LABEL_ID = "affixedlabel_uml_port_label"; //$NON-NLS-1$ - - /** Custom compartments */ - public static final String COMPARTMENT_UML_CONSTRAINT_AS_LIST_ID = "compartment_uml_constraint_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_UML_ENUMERATIONLITERAL_AS_LIST_ID = "compartment_uml_enumerationliteral_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_UML_OPERATION_AS_LIST_ID = "compartment_uml_operation_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_UML_PORT_AS_LIST_ID = "compartment_uml_port_as_list"; //$NON-NLS-1$ - - public static final String COMPARTMENT_UML_PROPERTY_AS_LIST_ID = "compartment_uml_property_as_list"; //$NON-NLS-1$ - - /** Custom links */ - public static final String LINK_UML_DEPENDENCY_ID = "link_uml_dependency"; //$NON-NLS-1$ - - public static final String LINK_UML_CONNECTOR_ID = "link_uml_connector"; //$NON-NLS-1$ - - public static final String LINK_UML_GENERALIZATION_ID = "link_uml_generalization"; //$NON-NLS-1$ - - public static final String LINK_UML_INTERFACEREALIZATION_ID = "link_uml_interfacerealization"; //$NON-NLS-1$ - - public static final String LINK_UML_USAGE_ID = "link_uml_usage"; //$NON-NLS-1$ - - /** Custom link labels */ - public static final String LINKLABEL_UML_CONNECTOR_LABEL_ID = "linklabel_uml_connector_label"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_NAMEDELEMENT_NAME_ID = "linklabel_uml_namedelement_name"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_APPLIEDSTEREOTYPE_ID = "linklabel_uml_appliedstereotype"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_ASSOCIATION_SOURCE_ROLE_ID = "linklabel_uml_association_source_role"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_ASSOCIATION_SOURCE_MULTIPLICITY_ID = "linklabel_uml_association_source_multiplicity"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_ASSOCIATION_TARGET_ROLE_ID = "linklabel_uml_association_target_role"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_ASSOCIATION_TARGET_MULTIPLICITY_ID = "linklabel_uml_association_target_multiplicity"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_CONNECTOR_SOURCE_MULTIPLICITY_ID = "linklabel_uml_connector_source_multiplicity"; //$NON-NLS-1$ - - public static final String LINKLABEL_UML_CONNECTOR_TARGET_MULTIPLICITY_ID = "linklabel_uml_connector_target_multiplicity"; //$NON-NLS-1$ -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java deleted file mode 100644 index 4437e9f5e9c..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/Activator.java +++ /dev/null @@ -1,319 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common; - -import java.util.ArrayList; - -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.ENamedElement; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; -import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.papyrus.infra.core.log.LogHelper; -import org.eclipse.papyrus.sysml.portandflows.FlowDirection; -import org.eclipse.papyrus.sysml.portandflows.FlowPort; -import org.eclipse.papyrus.uml.internationalization.edit.providers.InternationalizationUMLItemProviderAdapterFactory; -import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; -//import org.eclipse.papyrus.sysml.activities.provider.ActivitiesItemProviderAdapterFactory; -//import org.eclipse.papyrus.sysml.allocations.provider.AllocationsItemProviderAdapterFactory; -//import org.eclipse.papyrus.sysml.blocks.provider.BlocksItemProviderAdapterFactory; -//import org.eclipse.papyrus.sysml.constraints.provider.ConstraintsItemProviderAdapterFactory; -//import org.eclipse.papyrus.sysml.modelelements.provider.ModelelementsItemProviderAdapterFactory; -//import org.eclipse.papyrus.sysml.portandflows.provider.PortandflowsItemProviderAdapterFactory; -//import org.eclipse.papyrus.sysml.requirements.provider.RequirementsItemProviderAdapterFactory; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - /** The Constant ID. */ - public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml.diagram.common"; //$NON-NLS-1$ - - /** Shared instance of the plug-in (singleton pattern) */ - private static Activator plugin; - - /** Logging helper */ - public static LogHelper log; - - /** The composed adapter factory */ - private ComposedAdapterFactory adapterFactory; - - /** generic label provider based on EMF facet */ - private UMLLabelProvider labelProvider; - - /** Default constructor */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - - // register the login helper - log = new LogHelper(plugin); - - // prepare the composed adapter factory - adapterFactory = createAdapterFactory(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - adapterFactory.dispose(); - adapterFactory = null; - if (labelProvider != null) { - labelProvider.dispose(); - labelProvider = null; - } - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getInstance() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given plug-in relative path. - * - * @generated - * @param path - * the path - * @return the image descriptor - */ - public static ImageDescriptor getBundledImageDescriptor(String path) { - return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path); - } - - /** - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore() - * - * @return Shared Preference Store. - */ - @Override - public IPreferenceStore getPreferenceStore() { - IPreferenceStore store = org.eclipse.papyrus.infra.gmfdiag.preferences.Activator.getDefault().getPreferenceStore(); - return store; - } - - /** - * Get the item provider adapter factory. - * - * @return the adapter factory. - */ - public AdapterFactory getItemProvidersAdapterFactory() { - return adapterFactory; - } - - /** - * Get an image descriptor for current item. - * - * @param item - * the item for which an image descriptor searched. - * @return the image descriptor. - */ - public ImageDescriptor getItemImageDescriptor(Object item) { - IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class); - if (labelProvider != null) { - return ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item)); - } - return null; - } - - /** - * Get an image for a ENamedElement in plug-in image registry. - * - * @param element - * the element. - * @return the image. - */ - public Image getImage(ENamedElement element) { - - String imageKey = element.getName(); - - Image image = getImageRegistry().get(imageKey); - if (image == null) { - ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element); - if (imageDescriptor == null) { - imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); - } - getImageRegistry().put(imageKey, imageDescriptor); - image = getImageRegistry().get(imageKey); - } - return image; - } - - /** - * <pre> - * Provide a FlowPort image for border edit part that take the border item position - * into account. - * - * The image is not rotated, but predefined. - * - * The side of the image (relatively to the parent figure) can be: - * <ul> - * <li>{@linkplain PositionConstants#NORTH}</li> - * <li> {@linkplain PositionConstants#SOUTH}</li> - * <li> {@linkplain PositionConstants#EAST}</li> - * <li> {@linkplain PositionConstants#WEST}</li> - * <li> {@linkplain PositionConstants#NORTH_EAST}</li> - * <li> {@linkplain PositionConstants#NORTH_WEST}</li> - * <li> {@linkplain PositionConstants#SOUTH_EAST}</li> - * <li> {@linkplain PositionConstants#SOUTH_WEST}</li> - * </ul> - * - * </pre> - */ - public Image getFlowPortImage(FlowPort flowport, int side) { - - // Prepare the image key - String imageKey = "FlowPort_"; - if (flowport.isAtomic()) { - if (flowport.getDirection() == FlowDirection.IN) { - imageKey = imageKey + "IN_"; - } else if (flowport.getDirection() == FlowDirection.OUT) { - imageKey = imageKey + "OUT_"; - } else if (flowport.getDirection() == FlowDirection.INOUT) { - imageKey = imageKey + "INOUT_"; - } - - imageKey = imageKey + "A_"; - } else { - imageKey = imageKey + "NA_"; - } - - if (side == PositionConstants.WEST) { - imageKey = imageKey + "WEST"; - } else if (side == PositionConstants.NORTH) { - imageKey = imageKey + "NORTH"; - } else if (side == PositionConstants.SOUTH) { - imageKey = imageKey + "SOUTH"; - } else if (side == PositionConstants.EAST) { - imageKey = imageKey + "EAST"; - } else if (side == PositionConstants.NORTH_WEST) { - imageKey = imageKey + "NORTH_WEST"; - } else if (side == PositionConstants.NORTH_EAST) { - imageKey = imageKey + "NORTH_EAST"; - } else if (side == PositionConstants.SOUTH_EAST) { - imageKey = imageKey + "SOUTH_EAST"; - } else if (side == PositionConstants.SOUTH_WEST) { - imageKey = imageKey + "SOUTH_WEST"; - } - - // Retrieve image from registry or add it in the registry - Image image = getImageRegistry().get(imageKey); - if (image == null) { - - ImageDescriptor imageDescriptor = imageDescriptorFromPlugin(PLUGIN_ID, "/icons/flowports/" + imageKey + ".gif"); - - if (imageDescriptor == null) { - imageDescriptor = ImageDescriptor.getMissingImageDescriptor(); - } - getImageRegistry().put(imageKey, imageDescriptor); - image = getImageRegistry().get(imageKey); - } - - return image; - } - - /** - * Returns a label provider supported by EMF Facet - * - * @return a label provider supported by EMF Facet - */ - public ILabelProvider getLabelProvider() { - if (labelProvider == null) { - // add a generic label provider for sysml elements - labelProvider = new UMLLabelProvider(); - } - return labelProvider; - } - - /** - * Create a new Composed adapter factory for this plug-in. - */ - protected ComposedAdapterFactory createAdapterFactory() { - ArrayList<AdapterFactory> factories = new ArrayList<AdapterFactory>(); - - // Add SysML adapters - // factories.add(new ActivitiesItemProviderAdapterFactory()); - // factories.add(new AllocationsItemProviderAdapterFactory()); - // factories.add(new BlocksItemProviderAdapterFactory()); - // factories.add(new ConstraintsItemProviderAdapterFactory()); - // factories.add(new ModelelementsItemProviderAdapterFactory()); - // factories.add(new PortandflowsItemProviderAdapterFactory()); - // factories.add(new RequirementsItemProviderAdapterFactory()); - // Add UML adapter - factories.add(new InternationalizationUMLItemProviderAdapterFactory()); - - // Other adapters - factories.add(new EcoreItemProviderAdapterFactory()); - factories.add(new ResourceItemProviderAdapterFactory()); - factories.add(new ReflectiveItemProviderAdapterFactory()); - return new ComposedAdapterFactory(factories); - } - - private ImageDescriptor getProvidedImageDescriptor(ENamedElement element) { - if (element instanceof EStructuralFeature) { - EStructuralFeature feature = ((EStructuralFeature) element); - EClass eContainingClass = feature.getEContainingClass(); - EClassifier eType = feature.getEType(); - if (eContainingClass != null && !eContainingClass.isAbstract()) { - element = eContainingClass; - } else if (eType instanceof EClass && !((EClass) eType).isAbstract()) { - element = eType; - } - } - if (element instanceof EClass) { - EClass eClass = (EClass) element; - if (!eClass.isAbstract()) { - return getItemImageDescriptor(eClass.getEPackage().getEFactoryInstance().create(eClass)); - } - } - // TODO : support structural features - return null; - } - - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java deleted file mode 100644 index 600ca083aad..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/commands/CreateSysMLModelCommand.java +++ /dev/null @@ -1,67 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.commands; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.sysml.util.SysmlResource; -import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase; -import org.eclipse.papyrus.uml.tools.utils.PackageUtil; -import org.eclipse.uml2.uml.Profile; -import org.eclipse.uml2.uml.UMLFactory; - - -/** - * The Class CreateSysMLModelCommand. - */ -public class CreateSysMLModelCommand extends ModelCreationCommandBase { - - /** - * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement() - * - * @return - */ - - @Override - protected EObject createRootElement() { - return UMLFactory.eINSTANCE.createModel(); - } - - /** - * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#initializeModel(org.eclipse.emf.ecore.EObject) - * - * @param owner - */ - - @Override - protected void initializeModel(EObject owner) { - super.initializeModel(owner); - ((org.eclipse.uml2.uml.Package) owner).setName(getModelName()); - - // Retrieve SysML profile and apply with Sub-profile - Profile sysml = (Profile) PackageUtil.loadPackage(URI.createURI(SysmlResource.SYSML_PROFILE_URI), owner.eResource().getResourceSet()); - if (sysml != null) { - PackageUtil.applyProfile(((org.eclipse.uml2.uml.Package) owner), sysml, true); - } - } - - /** - * Gets the model name. - * - * @return the model name - */ - protected String getModelName() { - return "SysMLmodel"; - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java deleted file mode 100644 index ec0a181ec6b..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/strategy/paste/PartPasteStrategy.java +++ /dev/null @@ -1,364 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2014, 2016 CEA LIST, Esterel Technologies SAS 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: - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation - * Sebastien Bordes (Esterel Technologies SAS) - Bug 497816 - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.strategy.paste; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.emf.common.command.CompoundCommand; -import org.eclipse.emf.common.util.BasicEList; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.commands.wrappers.EMFtoGEFCommandWrapper; -import org.eclipse.papyrus.infra.core.clipboard.IClipboardAdditionalData; -import org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard; -import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.DefaultPasteStrategy; -import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; -import org.eclipse.papyrus.sysml.blocks.Block; -import org.eclipse.papyrus.uml.diagram.common.Activator; -import org.eclipse.swt.graphics.Image; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.Classifier; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.util.UMLUtil; - -/** - * Offer a strategy for copying stereotypes. - */ -public class PartPasteStrategy implements IPasteStrategy { - - /** The instance. */ - private static IPasteStrategy instance = new PartPasteStrategy(); - - /** - * Gets the single instance of StereotypePasteStrategy. - * - * @return single instance of StereotypePasteStrategy - */ - public static IPasteStrategy getInstance() { - return instance; - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getLabel() - */ - @Override - public String getLabel() { - return "partPasteStrategy"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getID() - */ - @Override - public String getID() { - return Activator.ID + ".partPasteStrategy"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getDescription() - */ - @Override - public String getDescription() { - return "Paste part elements with association"; //$NON-NLS-1$ - } - - /** - * Gets the category id. - * - * @return the category id - */ - public String getCategoryID() { - return "org.eclipse.papyrus.strategy.paste"; //$NON-NLS-1$ - } - - /** - * Gets the category label. - * - * @return the category label - */ - public String getCategoryLabel() { - return "Paste all copied elements"; //$NON-NLS-1$ - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getImage() - */ - @Override - @Deprecated - public Image getImage() { - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getPriority() - */ - @Override - @Deprecated - public int getPriority() { - return 1; - } - - /** - * Sets the options. - * - * @param options - * the options - */ - public void setOptions(Map<String, Object> options) { - // Nothing - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getSemanticCommand(org.eclipse.emf.edit.domain.EditingDomain, - * org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard) - */ - @Override - public org.eclipse.emf.common.command.Command getSemanticCommand(EditingDomain domain, EObject targetOwner, PapyrusClipboard<Object> papyrusClipboard) { - if (targetOwner instanceof Classifier || targetOwner instanceof Package) { // test if block or package - // get affiliate AdditionnalData - Map<Object, ?> additionalDataMap = papyrusClipboard.getAdditionalDataForStrategy(getID()); - if (additionalDataMap != null) { - CompoundCommand compoundCommand = new CompoundCommand("Copy associations for parts"); //$NON-NLS-1$ - for (Iterator<Object> iterator = papyrusClipboard.iterator(); iterator.hasNext();) { - Object object = iterator.next(); - EObject target = papyrusClipboard.getTragetCopyFromInternalClipboardCopy(object); - Object additionnalData = additionalDataMap.get(object); - EList<Association> listDuplicatedAssociation = new BasicEList<Association>(); - EObject associationContainer = null; - if (target != null && target instanceof Property && targetOwner instanceof Classifier && additionnalData instanceof PartAdditionalData) { // test if it is a part - Classifier block = (Classifier) targetOwner; - Property property = (Property) target; - PartAdditionalData partAdditionalData = (PartAdditionalData) additionnalData; - Association newAssociation = partAdditionalData.getDuplicatedAssociation(); - restoreAssociationPartContext(block, property, newAssociation); - listDuplicatedAssociation.add(newAssociation); - associationContainer = block.eContainer(); - } else if (target != null && target instanceof Classifier && targetOwner instanceof Package && additionnalData instanceof PartBlockAdditionalData) { // test if it is a block - Classifier classifier = (Classifier) target; - EList<Property> allAttributes = classifier.getAllAttributes(); - PartBlockAdditionalData partBlockAdditionalData = (PartBlockAdditionalData) additionnalData; - for (Property property : allAttributes) { - Association duplicatedAssociation = partBlockAdditionalData.getDuplicatedAssociationByPropertyName(property.getName()); - if (duplicatedAssociation != null) { - restoreAssociationPartContext(classifier, property, duplicatedAssociation); - listDuplicatedAssociation.add(duplicatedAssociation); - } - } - associationContainer = targetOwner; - } - if (associationContainer != null && !listDuplicatedAssociation.isEmpty()) { - // add associations to the nearest container - MoveRequest moveRequest = new MoveRequest(associationContainer, listDuplicatedAssociation); - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetOwner); - if (provider != null) { - ICommand editCommand = provider.getEditCommand(moveRequest); - if (editCommand != null) { - GMFtoEMFCommandWrapper gmFtoEMFCommandWrapper = new GMFtoEMFCommandWrapper(editCommand); - compoundCommand.append(gmFtoEMFCommandWrapper); - } - } - } - } - // An empty command can't be executed - if (compoundCommand.getCommandList().isEmpty()) { - return null; - } - return compoundCommand; - } - } - return null; - } - - - - - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#getGraphicalCommand(org.eclipse.emf.edit.domain.EditingDomain, - * org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart, org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard) - */ - @Override - public Command getGraphicalCommand(EditingDomain domain, org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart targetEditPart, PapyrusClipboard<Object> papyrusClipboard) { - View targetView = (View) targetEditPart.getModel(); - EObject targetOwner = targetView.getElement(); - org.eclipse.emf.common.command.Command semanticCommand = getSemanticCommand(domain, targetOwner, papyrusClipboard); - if (semanticCommand != null) { - org.eclipse.gef.commands.CompoundCommand compoundCommand = new org.eclipse.gef.commands.CompoundCommand("Association Part Semantic And Graphical paste"); //$NON-NLS-1$ - EMFtoGEFCommandWrapper emFtoGEFCommandWrapper = new EMFtoGEFCommandWrapper(semanticCommand); - compoundCommand.add(emFtoGEFCommandWrapper); - return compoundCommand; - } - return null; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#dependsOn() - */ - @Override - public IPasteStrategy dependsOn() { - return DefaultPasteStrategy.getInstance(); - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.IPasteStrategy#prepare(org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard) - */ - @Override - public void prepare(PapyrusClipboard<Object> papyrusClipboard, Collection<EObject> selection) { - Map<Object, IClipboardAdditionalData> mapCopyPartData = new HashMap<Object, IClipboardAdditionalData>(); - for (Iterator<EObject> iterator = papyrusClipboard.iterateOnSource(); iterator.hasNext();) { - EObject eObjectSource = iterator.next(); - if (eObjectSource instanceof Element) { - Element elementSource = (Element) eObjectSource; - IClipboardAdditionalData clipboardAdditionalData = null; - if (elementSource instanceof Property && UMLUtil.getStereotypeApplication(elementSource.getOwner(), Block.class) != null) { // is part - Property propertySource = (Property) elementSource; - Association association = propertySource.getAssociation(); - if (association != null) { - clipboardAdditionalData = new PartAdditionalData(association); - } - } else if (elementSource instanceof Classifier && UMLUtil.getStereotypeApplication(elementSource, Block.class) != null) {// is Block - Classifier block = (Classifier) elementSource; - clipboardAdditionalData = new PartBlockAdditionalData(block); - } - if (clipboardAdditionalData != null) { - Object copy = papyrusClipboard.getCopyFromSource(eObjectSource); - mapCopyPartData.put(copy, clipboardAdditionalData); - } - } - - } - papyrusClipboard.pushAdditionalData(getID(), mapCopyPartData); - } - - - /** - * Duplicate the association - * - * @param association - * @return - */ - protected Association duplicateAssociation(Association association) { - EcoreUtil.Copier copier = new EcoreUtil.Copier(); - copier.copy(association); - EObject eObject = copier.get(association); - return (Association) eObject; - } - - /** - * Init the association in the new context - * - * @param classifier - * @param property - * @param association - */ - protected void restoreAssociationPartContext(Classifier classifier, Property property, Association association) { - EList<Property> memberEnds = association.getMemberEnds(); // should have only one element - if (memberEnds != null && !memberEnds.isEmpty()) { - Property blockProperty = memberEnds.get(0); - blockProperty.setType(classifier); - } - memberEnds.add(property); - } - - - /** - * The Class PartAdditionalData. - */ - protected class PartAdditionalData implements IClipboardAdditionalData { - - /** The association. */ - protected Association asssociation; - - /** - * @param association - */ - public PartAdditionalData(Association asssociation) { - this.asssociation = duplicateAssociation(asssociation); - } - - /** - * @return a copy of the association - */ - public Association getDuplicatedAssociation() { - return duplicateAssociation(asssociation); - } - - } - - /** - * The Class PartBlockAdditionalData. - */ - protected class PartBlockAdditionalData implements IClipboardAdditionalData { - - /** The associations by property name. */ - protected Map<String, Association> mapPropertyNameToAssociation; - - /** - * @param block - */ - public PartBlockAdditionalData(Classifier block) { - this.mapPropertyNameToAssociation = new HashMap<String, Association>(); - EList<Property> allAttributes = block.getAllAttributes(); - for (Property property : allAttributes) { - Association association = property.getAssociation(); - Association newAssociation = duplicateAssociation(association); - mapPropertyNameToAssociation.put(property.getName(), newAssociation); - } - - } - - /** - * @param propertyName - * @return a copy of the association - */ - public Association getDuplicatedAssociationByPropertyName(String propertyName) { - Association association = mapPropertyNameToAssociation.get(propertyName); - return duplicateAssociation(association); - } - } -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/ConstraintBlockHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/ConstraintBlockHelper.java deleted file mode 100644 index bb21d0c7240..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/ConstraintBlockHelper.java +++ /dev/null @@ -1,62 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.utils; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.sysml.constraints.ConstraintBlock; -import org.eclipse.papyrus.sysml.constraints.ConstraintProperty; -import org.eclipse.papyrus.uml.diagram.common.helper.ElementHelper; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.util.UMLUtil; - -public class ConstraintBlockHelper extends ElementHelper { - - public static boolean couldBeConstraintParameter(EObject possibleContraintParameter, EObject ownerConstraintBlock) { - if (!(ownerConstraintBlock instanceof org.eclipse.uml2.uml.Class && UMLUtil.getStereotypeApplication((Element) ownerConstraintBlock, ConstraintBlock.class) != null)) { - return false; - } - return UMLUtil.getStereotypeApplication((Element) possibleContraintParameter, ConstraintProperty.class) == null; - } - - public static boolean isConstraintParameter(Element element, View view) { - if (element instanceof Property) { - Property constraintProperty = (Property) element; - Element ownerConstraintBlock = constraintProperty.getOwner(); - if (ownerConstraintBlock instanceof org.eclipse.uml2.uml.Class && UMLUtil.getStereotypeApplication(ownerConstraintBlock, ConstraintBlock.class) != null) { - // check for graphics : owned by a constraintProperty - if (view != null) { - View containerView = ViewUtil.getContainerView(view); - Element containerElement = (Element) containerView.getElement(); - // Owned by a ConstraintProperty - if (containerElement instanceof Property - && UMLUtil.getStereotypeApplication(containerElement, ConstraintProperty.class) != null - && ((Property) containerElement).getType() == ownerConstraintBlock) { - return true; - } - // Owned by a ConstraintBlock - if (containerElement instanceof org.eclipse.uml2.uml.Class - && UMLUtil.getStereotypeApplication(containerElement, ConstraintBlock.class) != null - && containerElement == ownerConstraintBlock) { - return true; - } - } - } - } - return false; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java deleted file mode 100644 index b8a2e6cc40f..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLCreateOrShowExistingElementHelper.java +++ /dev/null @@ -1,299 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * CEA LIST - Initial API and implementation - * Fanch Bonnabesse (ALL4TEC) fanch.bonnabesse@alltec.net - Bug 478288, 419357 - * - *****************************************************************************/ - -package org.eclipse.papyrus.sysml.diagram.common.utils; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.gmf.runtime.emf.type.core.IElementType; -import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants; -import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes; -import org.eclipse.papyrus.sysml.service.types.utils.ConnectorUtils; -import org.eclipse.papyrus.uml.diagram.common.helper.CreateOrShowExistingElementHelper; -import org.eclipse.papyrus.uml.diagram.common.helper.ILinkMappingHelper; -import org.eclipse.papyrus.uml.diagram.common.util.AssociationUtil; -import org.eclipse.papyrus.uml.diagram.common.util.LinkEndsMapper; -import org.eclipse.uml2.uml.AggregationKind; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.Connector; -import org.eclipse.uml2.uml.Element; -import org.eclipse.uml2.uml.Property; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * Show Existing Link Helper for SysML. This class provides specific management for SysML Association. - * - * @author VL222926 - * - */ -public class SysMLCreateOrShowExistingElementHelper extends CreateOrShowExistingElementHelper { - - /** - * - * Constructor. - * - */ - public SysMLCreateOrShowExistingElementHelper() { - super(); - } - - /** - * - * Constructor. - * - * @param linkHelper - */ - public SysMLCreateOrShowExistingElementHelper(final ILinkMappingHelper linkHelper) { - super(linkHelper); - } - - /** - * - * @see org.eclipse.papyrus.uml.diagram.common.helper.CreateOrShowExistingElementHelper#getIElementTypeNameToDisplay(org.eclipse.gmf.runtime.emf.type.core.IElementType) - * - * @param elementType - * @return - */ - @Override - protected String getIElementTypeNameToDisplay(final IElementType elementType) { - if (SysMLElementTypes.ASSOCIATION_NONE.equals(elementType) || SysMLElementTypes.ASSOCIATION_NONE_DIRECTED.equals(elementType)) { - return "Association/DirectAssociation"; //$NON-NLS-1$ - } else if (SysMLElementTypes.ASSOCIATION_COMPOSITE.equals(elementType) || SysMLElementTypes.ASSOCIATION_COMPOSITE_DIRECTED.equals(elementType)) { - return "Composition/DirectComposition"; //$NON-NLS-1$ - } else if (SysMLElementTypes.ASSOCIATION_SHARED.equals(elementType) || SysMLElementTypes.ASSOCIATION_SHARED_DIRECTED.equals(elementType)) { - return "Aggregation/DirectAggregation"; //$NON-NLS-1$ - } - return super.getIElementTypeNameToDisplay(elementType); - } - - /** - * - * @see org.eclipse.papyrus.uml.diagram.common.helper.CreateOrShowExistingElementHelper#hasWantedType(org.eclipse.emf.ecore.EObject, org.eclipse.gmf.runtime.emf.type.core.IElementType) - * - * @param eobject - * an eobject - * @param wantedType - * the wanted element type - * @return - * true if the eobject is an instance of the wanted element type. - * - * Add test for SysML Association - */ - @Override - protected boolean hasWantedType(final EObject eobject, final IElementType wantedType) { - boolean result = super.hasWantedType(eobject, wantedType); - if (result) { - if (eobject instanceof Association) { - Association association = (Association) eobject; - // Skip incomplete associations: it can't be a duplicate of the current link (Which has a source and a target) - if (association.getMemberEnds().size() < 2) { - return false; - } - - final AggregationKind current = getAssociationAggregationKind((Association) eobject); - if (current == AggregationKind.NONE_LITERAL) { - if (SysMLElementTypes.ASSOCIATION_NONE.equals(current) || SysMLElementTypes.ASSOCIATION_NONE_DIRECTED.equals(wantedType)) { - result = true; - } - } else if (current == AggregationKind.COMPOSITE_LITERAL) { - if (SysMLElementTypes.ASSOCIATION_COMPOSITE.equals(current) || SysMLElementTypes.ASSOCIATION_COMPOSITE_DIRECTED.equals(wantedType)) { - result = true; - } - } else if (current == AggregationKind.SHARED_LITERAL) { - if (SysMLElementTypes.ASSOCIATION_SHARED.equals(current) || SysMLElementTypes.ASSOCIATION_SHARED_DIRECTED.equals(wantedType)) { - result = true; - } - } else { - result = false; - } - } - } - return result; - } - - /** - * - * @param association - * an association - * @return - * the association kind for the association - */ - private static final AggregationKind getAssociationAggregationKind(final Association association) { - // Incomplete associations - if (association.getMemberEnds().size() < 2) { - return AggregationKind.NONE_LITERAL; - } - - final Property source = association.getMemberEnds().get(0); - final Property target = association.getMemberEnds().get(1); - - if (source.getAggregation() == AggregationKind.NONE_LITERAL && target.getAggregation() == AggregationKind.NONE_LITERAL) { - return AggregationKind.NONE_LITERAL; - } else if ((source.getAggregation() == AggregationKind.COMPOSITE_LITERAL) || (target.getAggregation() == AggregationKind.COMPOSITE_LITERAL)) { - return AggregationKind.COMPOSITE_LITERAL; - } else { - return AggregationKind.SHARED_LITERAL; - } - - } - - /** - * @param request - * the request for the creation - * @param wantedEClass - * @return - * a list of {@link EdgeEndsMapper} referencing the existing links between the source and the target - */ - @Override - protected List<LinkEndsMapper> getExistingLinksBetweenSourceAndTarget(final CreateRelationshipRequest request, final IElementType wantedElementType) { - List<LinkEndsMapper> existingElement = null; - - final EClass wantedEClass = wantedElementType.getEClass(); - - if (UMLPackage.eINSTANCE.getConnector().equals(wantedEClass)) { - EList<Element> ownedElements = ((Element) request.getContainer()).getOwnedElements(); - - existingElement = new ArrayList<LinkEndsMapper>(); - - for (final Element current : ownedElements) { - if (hasWantedType(current, wantedElementType)) { - final Collection<?> sources = this.linkMappingHelper.getSource(current); - final Collection<?> targets = this.linkMappingHelper.getTarget(current); - - if (sources.contains(request.getSource()) && targets.contains(request.getTarget())) { - // we verify the nestedPath before to propose to restore a connector - View sourceView = (View) request.getParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_SOURCE_VIEW); - View targetView = (View) request.getParameter(RequestParameterConstants.EDGE_CREATE_REQUEST_TARGET_VIEW); - boolean canBeDisplayed = ConnectorUtils.canDisplayExistingConnectorBetweenViewsAccordingToNestedPaths((Connector) current, sourceView, targetView); - if (canBeDisplayed) { - existingElement.add(new LinkEndsMapper(current, sources, null, null)); - } - } - } - } - - } else if (UMLPackage.eINSTANCE.getAssociation().equals(wantedEClass)) { - final EList<Element> ownedElements = ((Element) request.getContainer()).getOwnedElements(); - - existingElement = new ArrayList<LinkEndsMapper>(); - - for (final Element current : ownedElements) { - if (hasWantedType(current, wantedElementType)) { - final Collection<?> sources = this.linkMappingHelper.getSource(current); - final Collection<?> targets = this.linkMappingHelper.getTarget(current); - - if (sources.contains(request.getSource()) && targets.contains(request.getTarget()) && (current instanceof Association)) { - boolean identicalAssociation = compareMembers(current, request, wantedElementType); - - if (identicalAssociation) { - existingElement.add(new LinkEndsMapper(current, sources, null, null)); - } - } - } - } - } else { - existingElement = super.getExistingLinksBetweenSourceAndTarget(request, wantedElementType); - } - - return existingElement; - } - - /** - * Manages all the members of the current relationship to compare with a new relationship. - * - * @param current - * The element to compare with the created element. - * @param request - * The creation relationship request. - * @param wantedElementType - * The type of the created relationship. - * @return The result of the comparison. - */ - private boolean compareMembers(final Element current, final CreateRelationshipRequest request, final IElementType wantedElementType) { - boolean identicalAssociation = true; - - final Iterator<Property> iterator = ((Association) current).getMemberEnds().iterator(); - - while (iterator.hasNext() && identicalAssociation) { - final Property property = iterator.next(); - - final boolean source = request.getSource().equals(property.getType()); - - boolean expectedNavigable = true; - AggregationKind expectedAggregation = AggregationKind.NONE_LITERAL; - - // Handle of all types of Association in SysML - if (SysMLElementTypes.ASSOCIATION_NONE_DIRECTED.equals(wantedElementType)) { - if (source) { - expectedNavigable = false; - } - - if (!AssociationUtil.isIdenticalProperties(expectedNavigable, expectedAggregation, property)) { - identicalAssociation = false; - } - } else if (SysMLElementTypes.ASSOCIATION_NONE.equals(wantedElementType)) { - if (!AssociationUtil.isIdenticalProperties(expectedNavigable, expectedAggregation, property)) { - identicalAssociation = false; - } - } else if (SysMLElementTypes.ASSOCIATION_COMPOSITE_DIRECTED.equals(wantedElementType)) { - if (source) { - expectedNavigable = false; - } else { - expectedAggregation = AggregationKind.COMPOSITE_LITERAL; - } - - if (!AssociationUtil.isIdenticalProperties(expectedNavigable, expectedAggregation, property)) { - identicalAssociation = false; - } - } else if (SysMLElementTypes.ASSOCIATION_COMPOSITE.equals(wantedElementType)) { - if (!source) { - expectedAggregation = AggregationKind.COMPOSITE_LITERAL; - } - - if (!AssociationUtil.isIdenticalProperties(expectedNavigable, expectedAggregation, property)) { - identicalAssociation = false; - } - } else if (SysMLElementTypes.ASSOCIATION_SHARED_DIRECTED.equals(wantedElementType)) { - if (source) { - expectedNavigable = false; - } else { - expectedAggregation = AggregationKind.SHARED_LITERAL; - } - - if (!AssociationUtil.isIdenticalProperties(expectedNavigable, expectedAggregation, property)) { - identicalAssociation = false; - } - } else if (SysMLElementTypes.ASSOCIATION_SHARED.equals(wantedElementType)) { - if (!source) { - expectedAggregation = AggregationKind.SHARED_LITERAL; - } - - if (!AssociationUtil.isIdenticalProperties(expectedNavigable, expectedAggregation, property)) { - identicalAssociation = false; - } - } - } - - return identicalAssociation; - } - -} diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLMultiplicityElementUtil.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLMultiplicityElementUtil.java deleted file mode 100644 index 0a3c43d485a..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLMultiplicityElementUtil.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.papyrus.sysml.diagram.common.utils;
-
-import java.util.Collection;
-
-import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
-import org.eclipse.uml2.uml.MultiplicityElement;
-
-
-public class SysMLMultiplicityElementUtil extends org.eclipse.papyrus.uml.tools.utils.MultiplicityElementUtil {
-
- /**
- * If multiplicity is [1] (SysML default), only show when explicitly asked.
- */
- public static String formatMultiplicity(MultiplicityElement element, Collection<String> maskValues) {
- return formatMultiplicity(element, !maskValues.contains(ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY));
- }
-
- public static String formatMultiplicity(MultiplicityElement element, boolean blockDefault) {
- String result = formatMultiplicity(element);
- return manageDefaultMultiplicity(result, blockDefault);
- }
-}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java deleted file mode 100644 index fc6b90e4aff..00000000000 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLSelectionTester.java +++ /dev/null @@ -1,149 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2011 CEA LIST. - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * - * CEA LIST - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.sysml.diagram.common.utils; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.papyrus.infra.core.resource.NotFoundException; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForSelection; -import org.eclipse.papyrus.sysml.diagram.common.Activator; -import org.eclipse.papyrus.uml.tools.model.UmlModel; -import org.eclipse.uml2.uml.Package; - -/** - * This class is a Property tester used to check is current model (meaning the model currently opened in Papyrus) is a SysML Model. - * This class is used in order to create test for deciding whether a diagram creation command should be visible or not. - * This property tester assumes that currently active editor is Papyrus, it should be used with care (simultaneously with a test to ensure Papyrus is - * currently opened and active). - * - */ -public class SysMLSelectionTester extends PropertyTester { - - /** Tester ID for SysML Model nature. This is currently a test on: is this a blocks profiles package... */ - public final static String IS_SYSML_MODEL = "isSysMLModel"; - - /** Tester ID for SysML Requirements Model nature */ - public final static String IS_SYSML_REQUIREMENTS_MODEL = "isSysMLRequirementsModel"; - - /** Tester ID for SysML Blocks Model nature */ - public final static String IS_SYSML_BLOCKS_MODEL = "isSysMLBlocksModel"; - - /** Default constructor */ - public SysMLSelectionTester() { - } - - /** Test the receiver against the selected property */ - @Override - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - - // Ensure Papyrus is the active editor - Object currentValue = null; - if (IS_SYSML_MODEL.equals(property)) { - currentValue = testSysMLModelNature(receiver); - return (currentValue == expectedValue); - } else if (IS_SYSML_BLOCKS_MODEL.equals(property)) { - currentValue = testSysMLBlocksModelNature(receiver); - return (currentValue == expectedValue); - } else if (IS_SYSML_REQUIREMENTS_MODEL.equals(property)) { - currentValue = testSysMLRequirementsModelNature(receiver); - return (currentValue == expectedValue); - } - - return false; - } - - /** True is root object is a UML Model with SysML Profile (and sub profiles) applied */ - protected boolean testSysMLModelNature(Object receiver) { - boolean isSysMLModel = false; - - EObject root = getRoot(receiver); - if (root instanceof Package) { - - return (((Package) root).getAppliedProfile("SysML") != null); - - // FIX: UMLUtil.getProfile() loads the profile into the resource set. This is not desired. - // - // Profile sysml = UMLUtil.getProfile(SysmlPackage.eINSTANCE, root); - // if(((Package)root).isProfileApplied(sysml)) { - // isSysMLModel = true; - // } - } - - return isSysMLModel; - } - - /** True is root object is a UML Model with SysML Requirements Profile applied */ - protected boolean testSysMLRequirementsModelNature(Object receiver) { - boolean isSysMLModel = false; - - EObject root = getRoot(receiver); - if (root instanceof Package) { - return (((Package) root).getAppliedProfile("SysML::Requirements") != null); - - // FIX: UMLUtil.getProfile() loads the profile into the resource set. This is not desired. - // Profile sysml = UMLUtil.getProfile(RequirementsPackage.eINSTANCE, root); - // if(((Package)root).isProfileApplied(sysml)) { - // isSysMLModel = true; - // } - } - - return isSysMLModel; - } - - /** True is root object is a UML Model with SysML Blocks Profile applied */ - protected boolean testSysMLBlocksModelNature(Object receiver) { - boolean isSysMLModel = false; - - EObject root = getRoot(receiver); - if (root instanceof Package) { - return (((Package) root).getAppliedProfile("SysML::Blocks") != null); - // FIX: UMLUtil.getProfile() loads the profile into the resource set. This is not desired. - // Profile sysml = UMLUtil.getProfile(BlocksPackage.eINSTANCE, root); - // if(((Package)root).isProfileApplied(sysml)) { - // isSysMLModel = true; - // } - } - - return isSysMLModel; - } - - /** Returns the root EObject of currently opened model */ - private EObject getRoot(Object receiver) { - EObject root = null; - - if (receiver instanceof ISelection) { - ISelection selection = (ISelection) receiver; - if (selection.isEmpty()) { - return null; - } - - try { - ServiceUtilsForSelection serviceUtils = ServiceUtilsForSelection.getInstance(); - UmlModel openedModel = (UmlModel) serviceUtils.getModelSet(selection).getModel(UmlModel.MODEL_ID); - if (openedModel != null) { - root = openedModel.lookupRoot(); - } - } catch (ServiceException e) { - // Ignored: The selection cannot be used to retrieve the ServicesRegistry - } catch (NotFoundException e) { - Activator.log.error(e); - } - } - - return root; - } - -} |