diff options
Diffstat (limited to 'plugins/infra/constraints')
131 files changed, 18236 insertions, 0 deletions
diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.classpath b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.classpath new file mode 100644 index 00000000000..c1f31893de4 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src-gen"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.project b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.project new file mode 100644 index 00000000000..bd6c5dc5bdd --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.infra.constraints.edit</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + </natures> +</projectDescription> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..94d61f00da6 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +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/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/META-INF/MANIFEST.MF b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..0f95843ca91 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.papyrus.infra.constraints;bundle-version="1.2.0";visibility:=reexport, + org.eclipse.emf.edit;visibility:=reexport +Export-Package: org.eclipse.papyrus.infra.constraints.environment.provider, + org.eclipse.papyrus.infra.constraints.provider +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Version: 1.2.0.qualifier +Bundle-Localization: plugin +Bundle-Name: %pluginName +Bundle-Activator: org.eclipse.papyrus.infra.constraints.provider.ConstraintsEditPlugin$Implementation +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.infra.constraints.edit;singleton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/about.html b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/about.html new file mode 100644 index 00000000000..dd3c089a94c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>November 14, 2008</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/build.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/build.properties new file mode 100644 index 00000000000..f1e77099679 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/build.properties @@ -0,0 +1,16 @@ + +# <copyright> +# </copyright> +# +# $Id$ + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src-gen/ +output.. = bin/ +src.includes = about.html diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateCompositeConstraint_constraints_SimpleConstraint.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateCompositeConstraint_constraints_SimpleConstraint.gif Binary files differnew file mode 100644 index 00000000000..7943912208c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateCompositeConstraint_constraints_SimpleConstraint.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateConstraintEnvironment_constraintTypes_ConstraintType.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateConstraintEnvironment_constraintTypes_ConstraintType.gif Binary files differnew file mode 100644 index 00000000000..85a51d1b4a8 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateConstraintEnvironment_constraintTypes_ConstraintType.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateDisplayUnit_constraints_CompositeConstraint.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateDisplayUnit_constraints_CompositeConstraint.gif Binary files differnew file mode 100644 index 00000000000..6243419e928 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateDisplayUnit_constraints_CompositeConstraint.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateDisplayUnit_constraints_SimpleConstraint.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateDisplayUnit_constraints_SimpleConstraint.gif Binary files differnew file mode 100644 index 00000000000..7943912208c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateDisplayUnit_constraints_SimpleConstraint.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateSimpleConstraint_properties_ReferenceProperty.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateSimpleConstraint_properties_ReferenceProperty.gif Binary files differnew file mode 100644 index 00000000000..efff0c9aa7b --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateSimpleConstraint_properties_ReferenceProperty.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateSimpleConstraint_properties_ValueProperty.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateSimpleConstraint_properties_ValueProperty.gif Binary files differnew file mode 100644 index 00000000000..c78943ee9d6 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/ctool16/CreateSimpleConstraint_properties_ValueProperty.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/CompositeConstraint.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/CompositeConstraint.gif Binary files differnew file mode 100644 index 00000000000..05dc74ad5da --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/CompositeConstraint.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ConstraintEnvironment.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ConstraintEnvironment.gif Binary files differnew file mode 100644 index 00000000000..a26660ec28f --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ConstraintEnvironment.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ConstraintType.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ConstraintType.gif Binary files differnew file mode 100644 index 00000000000..c8d381f0b32 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ConstraintType.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ReferenceProperty.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ReferenceProperty.gif Binary files differnew file mode 100644 index 00000000000..98b351f1c44 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ReferenceProperty.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/SimpleConstraint.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/SimpleConstraint.gif Binary files differnew file mode 100644 index 00000000000..d92f34c8aea --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/SimpleConstraint.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ValueProperty.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ValueProperty.gif Binary files differnew file mode 100644 index 00000000000..420eee17752 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/icons/full/obj16/ValueProperty.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/plugin.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/plugin.properties new file mode 100644 index 00000000000..78356fccd3d --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/plugin.properties @@ -0,0 +1,48 @@ + +# <copyright> +# </copyright> +# +# $Id$ + +pluginName = Constraints Edit Support +providerName = Eclipse Modeling Project + +_UI_CreateChild_text = {0} +_UI_CreateChild_text2 = {1} {0} +_UI_CreateChild_text3 = {1} +_UI_CreateChild_tooltip = Create New {0} Under {1} Feature +_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}. +_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent. + +_UI_PropertyDescriptor_description = The {0} of the {1} + +_UI_DisplayUnit_type = Display Unit +_UI_ConstraintDescriptor_type = Constraint Descriptor +_UI_SimpleConstraint_type = Simple Constraint +_UI_CompositeConstraint_type = Composite Constraint +_UI_ConfigProperty_type = Config Property +_UI_ValueProperty_type = Value Property +_UI_ReferenceProperty_type = Reference Property +_UI_ConstraintEnvironment_type = Constraint Environment +_UI_ConstraintType_type = Constraint Type +_UI_Unknown_type = Object + +_UI_Unknown_datatype= Value + +_UI_DisplayUnit_constraints_feature = Constraints +_UI_DisplayUnit_elementMultiplicity_feature = Element Multiplicity +_UI_ConstraintDescriptor_name_feature = Name +_UI_ConstraintDescriptor_display_feature = Display +_UI_ConstraintDescriptor_overrideable_feature = Overrideable +_UI_ConstraintDescriptor_overriddenConstraints_feature = Overridden Constraints +_UI_SimpleConstraint_constraintType_feature = Constraint Type +_UI_SimpleConstraint_properties_feature = Properties +_UI_CompositeConstraint_constraints_feature = Constraints +_UI_ConfigProperty_name_feature = Name +_UI_ValueProperty_value_feature = Value +_UI_ReferenceProperty_value_feature = Value +_UI_ConstraintEnvironment_constraintTypes_feature = Constraint Types +_UI_ConstraintType_label_feature = Label +_UI_ConstraintType_constraintClass_feature = Constraint Class +_UI_Unknown_feature = Unspecified + diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/plugin.xml b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/plugin.xml new file mode 100644 index 00000000000..f886971c330 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/plugin.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<!-- + <copyright> + </copyright> + + $Id$ +--> + +<plugin> + + <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories"> + <factory + uri="http://www.eclipse.org/papyrus/constraints/0.9" + class="org.eclipse.papyrus.infra.constraints.provider.ConstraintsItemProviderAdapterFactory" + supportedTypes= + "org.eclipse.emf.edit.provider.IEditingDomainItemProvider + org.eclipse.emf.edit.provider.IStructuredItemContentProvider + org.eclipse.emf.edit.provider.ITreeItemContentProvider + org.eclipse.emf.edit.provider.IItemLabelProvider + org.eclipse.emf.edit.provider.IItemPropertySource"/> + </extension> + + <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories"> + <factory + uri="http://www.eclipse.org/papyrus/constraints/environment/0.9" + class="org.eclipse.papyrus.infra.constraints.environment.provider.EnvironmentItemProviderAdapterFactory" + supportedTypes= + "org.eclipse.emf.edit.provider.IEditingDomainItemProvider + org.eclipse.emf.edit.provider.IStructuredItemContentProvider + org.eclipse.emf.edit.provider.ITreeItemContentProvider + org.eclipse.emf.edit.provider.IItemLabelProvider + org.eclipse.emf.edit.provider.IItemPropertySource"/> + </extension> + +</plugin> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/pom.xml b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/pom.xml new file mode 100644 index 00000000000..f18670ccaec --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.infra-constraints</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.infra.constraints.edit</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/ConstraintEnvironmentItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/ConstraintEnvironmentItemProvider.java new file mode 100644 index 00000000000..83d9af786e4 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/ConstraintEnvironmentItemProvider.java @@ -0,0 +1,177 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentFactory; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; +import org.eclipse.papyrus.infra.constraints.provider.ConstraintsEditPlugin; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintEnvironmentItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintEnvironmentItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(EnvironmentPackage.Literals.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES); + } + return childrenFeatures; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns ConstraintEnvironment.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ConstraintEnvironment")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + return getString("_UI_ConstraintEnvironment_type"); + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ConstraintEnvironment.class)) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (EnvironmentPackage.Literals.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES, + EnvironmentFactory.eINSTANCE.createConstraintType())); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ConstraintsEditPlugin.INSTANCE; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/ConstraintTypeItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/ConstraintTypeItemProvider.java new file mode 100644 index 00000000000..e7a3d88666d --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/ConstraintTypeItemProvider.java @@ -0,0 +1,193 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; +import org.eclipse.papyrus.infra.constraints.provider.ConstraintsEditPlugin; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintTypeItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintTypeItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addLabelPropertyDescriptor(object); + addConstraintClassPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Label feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addLabelPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ConstraintType_label_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ConstraintType_label_feature", "_UI_ConstraintType_type"), + EnvironmentPackage.Literals.CONSTRAINT_TYPE__LABEL, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Constraint Class feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addConstraintClassPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ConstraintType_constraintClass_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ConstraintType_constraintClass_feature", "_UI_ConstraintType_type"), + EnvironmentPackage.Literals.CONSTRAINT_TYPE__CONSTRAINT_CLASS, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns ConstraintType.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ConstraintType")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ConstraintType) object).getLabel(); + return label == null || label.length() == 0 ? + getString("_UI_ConstraintType_type") : + getString("_UI_ConstraintType_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ConstraintType.class)) { + case EnvironmentPackage.CONSTRAINT_TYPE__LABEL: + case EnvironmentPackage.CONSTRAINT_TYPE__CONSTRAINT_CLASS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ConstraintsEditPlugin.INSTANCE; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/EnvironmentItemProviderAdapterFactory.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/EnvironmentItemProviderAdapterFactory.java new file mode 100644 index 00000000000..dd3f0be5f3d --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/environment/provider/EnvironmentItemProviderAdapterFactory.java @@ -0,0 +1,253 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.provider; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.edit.provider.ChangeNotifier; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IChangeNotifier; +import org.eclipse.emf.edit.provider.IDisposable; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.INotifyChangedListener; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.papyrus.infra.constraints.environment.util.EnvironmentAdapterFactory; + +/** + * This is the factory that is used to provide the interfaces needed to support Viewers. + * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. + * The adapters also support Eclipse property sheets. + * Note that most of the adapters are shared among multiple instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class EnvironmentItemProviderAdapterFactory extends EnvironmentAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Object> supportedTypes = new ArrayList<Object>(); + + /** + * This constructs an instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentItemProviderAdapterFactory() { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintEnvironmentItemProvider constraintEnvironmentItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter createConstraintEnvironmentAdapter() { + if (constraintEnvironmentItemProvider == null) { + constraintEnvironmentItemProvider = new ConstraintEnvironmentItemProvider(this); + } + + return constraintEnvironmentItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintTypeItemProvider constraintTypeItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter createConstraintTypeAdapter() { + if (constraintTypeItemProvider == null) { + constraintTypeItemProvider = new ConstraintTypeItemProvider(this); + } + + return constraintTypeItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ComposeableAdapterFactory getRootAdapterFactory() { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean isFactoryForType(Object type) { + return supportedTypes.contains(type) || super.isFactoryForType(type); + } + + /** + * This implementation substitutes the factory itself as the key for the adapter. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) { + return super.adapt(notifier, this); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object adapt(Object object, Object type) { + if (isFactoryForType(type)) { + Object adapter = super.adapt(object, type); + if (!(type instanceof Class<?>) || (((Class<?>) type).isInstance(adapter))) { + return adapter; + } + } + + return null; + } + + /** + * This adds a listener. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void addListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void removeListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void fireNotifyChanged(Notification notification) { + changeNotifier.fireNotifyChanged(notification); + + if (parentAdapterFactory != null) { + parentAdapterFactory.fireNotifyChanged(notification); + } + } + + /** + * This disposes all of the item providers created by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void dispose() { + if (constraintEnvironmentItemProvider != null) { + constraintEnvironmentItemProvider.dispose(); + } + if (constraintTypeItemProvider != null) { + constraintTypeItemProvider.dispose(); + } + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/CompositeConstraintItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/CompositeConstraintItemProvider.java new file mode 100644 index 00000000000..970a7564151 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/CompositeConstraintItemProvider.java @@ -0,0 +1,165 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.CompositeConstraint; +import org.eclipse.papyrus.infra.constraints.ConstraintsFactory; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.CompositeConstraint} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class CompositeConstraintItemProvider + extends ConstraintDescriptorItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public CompositeConstraintItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return itemPropertyDescriptors; + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(ConstraintsPackage.Literals.COMPOSITE_CONSTRAINT__CONSTRAINTS); + } + return childrenFeatures; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns CompositeConstraint.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/CompositeConstraint")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((CompositeConstraint) object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_CompositeConstraint_type") : + getString("_UI_CompositeConstraint_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(CompositeConstraint.class)) { + case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (ConstraintsPackage.Literals.COMPOSITE_CONSTRAINT__CONSTRAINTS, + ConstraintsFactory.eINSTANCE.createSimpleConstraint())); + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConfigPropertyItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConfigPropertyItemProvider.java new file mode 100644 index 00000000000..5621df796d8 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConfigPropertyItemProvider.java @@ -0,0 +1,155 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.ConfigProperty; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.ConfigProperty} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConfigPropertyItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConfigPropertyItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ConfigProperty_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ConfigProperty_name_feature", "_UI_ConfigProperty_type"), + ConstraintsPackage.Literals.CONFIG_PROPERTY__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ConfigProperty) object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_ConfigProperty_type") : + getString("_UI_ConfigProperty_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ConfigProperty.class)) { + case ConstraintsPackage.CONFIG_PROPERTY__NAME: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ConstraintsEditPlugin.INSTANCE; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintDescriptorItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintDescriptorItemProvider.java new file mode 100644 index 00000000000..20f45f17966 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintDescriptorItemProvider.java @@ -0,0 +1,204 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintDescriptorItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintDescriptorItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addNamePropertyDescriptor(object); + addOverrideablePropertyDescriptor(object); + addOverriddenConstraintsPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Name feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ConstraintDescriptor_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ConstraintDescriptor_name_feature", "_UI_ConstraintDescriptor_type"), + ConstraintsPackage.Literals.CONSTRAINT_DESCRIPTOR__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Overrideable feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addOverrideablePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ConstraintDescriptor_overrideable_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ConstraintDescriptor_overrideable_feature", "_UI_ConstraintDescriptor_type"), + ConstraintsPackage.Literals.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE, + true, + false, + false, + ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Overridden Constraints feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addOverriddenConstraintsPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ConstraintDescriptor_overriddenConstraints_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ConstraintDescriptor_overriddenConstraints_feature", "_UI_ConstraintDescriptor_type"), + ConstraintsPackage.Literals.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ConstraintDescriptor) object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_ConstraintDescriptor_type") : + getString("_UI_ConstraintDescriptor_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ConstraintDescriptor.class)) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__NAME: + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ConstraintsEditPlugin.INSTANCE; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintsEditPlugin.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintsEditPlugin.java new file mode 100644 index 00000000000..11e4a08727f --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintsEditPlugin.java @@ -0,0 +1,99 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + +import org.eclipse.emf.common.EMFPlugin; +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Constraints edit plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public final class ConstraintsEditPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static final ConstraintsEditPlugin INSTANCE = new ConstraintsEditPlugin(); + + /** + * Keep track of the singleton. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsEditPlugin() { + super(new ResourceLocator[] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse <b>Plugin</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static class Implementation extends EclipsePlugin { + /** + * Creates an instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintsItemProviderAdapterFactory.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintsItemProviderAdapterFactory.java new file mode 100644 index 00000000000..180e09c540e --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ConstraintsItemProviderAdapterFactory.java @@ -0,0 +1,309 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.edit.provider.ChangeNotifier; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.IChangeNotifier; +import org.eclipse.emf.edit.provider.IDisposable; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.INotifyChangedListener; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.papyrus.infra.constraints.util.ConstraintsAdapterFactory; + +/** + * This is the factory that is used to provide the interfaces needed to support Viewers. + * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. + * The adapters also support Eclipse property sheets. + * Note that most of the adapters are shared among multiple instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintsItemProviderAdapterFactory extends ConstraintsAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Object> supportedTypes = new ArrayList<Object>(); + + /** + * This constructs an instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsItemProviderAdapterFactory() { + supportedTypes.add(IEditingDomainItemProvider.class); + supportedTypes.add(IStructuredItemContentProvider.class); + supportedTypes.add(ITreeItemContentProvider.class); + supportedTypes.add(IItemLabelProvider.class); + supportedTypes.add(IItemPropertySource.class); + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.constraints.SimpleConstraint} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected SimpleConstraintItemProvider simpleConstraintItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.infra.constraints.SimpleConstraint}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter createSimpleConstraintAdapter() { + if (simpleConstraintItemProvider == null) { + simpleConstraintItemProvider = new SimpleConstraintItemProvider(this); + } + + return simpleConstraintItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.constraints.CompositeConstraint} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected CompositeConstraintItemProvider compositeConstraintItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.infra.constraints.CompositeConstraint}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter createCompositeConstraintAdapter() { + if (compositeConstraintItemProvider == null) { + compositeConstraintItemProvider = new CompositeConstraintItemProvider(this); + } + + return compositeConstraintItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.constraints.ValueProperty} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ValuePropertyItemProvider valuePropertyItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.infra.constraints.ValueProperty}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter createValuePropertyAdapter() { + if (valuePropertyItemProvider == null) { + valuePropertyItemProvider = new ValuePropertyItemProvider(this); + } + + return valuePropertyItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.constraints.ReferenceProperty} instances. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ReferencePropertyItemProvider referencePropertyItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.papyrus.infra.constraints.ReferenceProperty}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter createReferencePropertyAdapter() { + if (referencePropertyItemProvider == null) { + referencePropertyItemProvider = new ReferencePropertyItemProvider(this); + } + + return referencePropertyItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ComposeableAdapterFactory getRootAdapterFactory() { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean isFactoryForType(Object type) { + return supportedTypes.contains(type) || super.isFactoryForType(type); + } + + /** + * This implementation substitutes the factory itself as the key for the adapter. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) { + return super.adapt(notifier, this); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object adapt(Object object, Object type) { + if (isFactoryForType(type)) { + Object adapter = super.adapt(object, type); + if (!(type instanceof Class<?>) || (((Class<?>) type).isInstance(adapter))) { + return adapter; + } + } + + return null; + } + + /** + * This adds a listener. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void addListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void removeListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void fireNotifyChanged(Notification notification) { + changeNotifier.fireNotifyChanged(notification); + + if (parentAdapterFactory != null) { + parentAdapterFactory.fireNotifyChanged(notification); + } + } + + /** + * This disposes all of the item providers created by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void dispose() { + if (simpleConstraintItemProvider != null) { + simpleConstraintItemProvider.dispose(); + } + if (compositeConstraintItemProvider != null) { + compositeConstraintItemProvider.dispose(); + } + if (valuePropertyItemProvider != null) { + valuePropertyItemProvider.dispose(); + } + if (referencePropertyItemProvider != null) { + referencePropertyItemProvider.dispose(); + } + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/DisplayUnitItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/DisplayUnitItemProvider.java new file mode 100644 index 00000000000..048f9033989 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/DisplayUnitItemProvider.java @@ -0,0 +1,199 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ItemProviderAdapter; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.ConstraintsFactory; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.DisplayUnit} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class DisplayUnitItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public DisplayUnitItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addElementMultiplicityPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Element Multiplicity feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addElementMultiplicityPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_DisplayUnit_elementMultiplicity_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_DisplayUnit_elementMultiplicity_feature", "_UI_DisplayUnit_type"), + ConstraintsPackage.Literals.DISPLAY_UNIT__ELEMENT_MULTIPLICITY, + true, + false, + false, + ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE, + null, + null)); + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(ConstraintsPackage.Literals.DISPLAY_UNIT__CONSTRAINTS); + } + return childrenFeatures; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + DisplayUnit displayUnit = (DisplayUnit) object; + return getString("_UI_DisplayUnit_type") + " " + displayUnit.getElementMultiplicity(); + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(DisplayUnit.class)) { + case ConstraintsPackage.DISPLAY_UNIT__ELEMENT_MULTIPLICITY: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + case ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (ConstraintsPackage.Literals.DISPLAY_UNIT__CONSTRAINTS, + ConstraintsFactory.eINSTANCE.createSimpleConstraint())); + + newChildDescriptors.add + (createChildParameter + (ConstraintsPackage.Literals.DISPLAY_UNIT__CONSTRAINTS, + ConstraintsFactory.eINSTANCE.createCompositeConstraint())); + } + + /** + * Return the resource locator for this item provider's resources. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ConstraintsEditPlugin.INSTANCE; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ReferencePropertyItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ReferencePropertyItemProvider.java new file mode 100644 index 00000000000..9cc200a8c5e --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ReferencePropertyItemProvider.java @@ -0,0 +1,145 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.ReferenceProperty; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.ReferenceProperty} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ReferencePropertyItemProvider + extends ConfigPropertyItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ReferencePropertyItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addValuePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Value feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addValuePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ReferenceProperty_value_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ReferenceProperty_value_feature", "_UI_ReferenceProperty_type"), + ConstraintsPackage.Literals.REFERENCE_PROPERTY__VALUE, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns ReferenceProperty.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ReferenceProperty")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ReferenceProperty) object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_ReferenceProperty_type") : + getString("_UI_ReferenceProperty_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/SimpleConstraintItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/SimpleConstraintItemProvider.java new file mode 100644 index 00000000000..2fbb98f9def --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/SimpleConstraintItemProvider.java @@ -0,0 +1,195 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.ConstraintsFactory; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.SimpleConstraint} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class SimpleConstraintItemProvider + extends ConstraintDescriptorItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public SimpleConstraintItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addConstraintTypePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Constraint Type feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addConstraintTypePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_SimpleConstraint_constraintType_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_SimpleConstraint_constraintType_feature", "_UI_SimpleConstraint_type"), + ConstraintsPackage.Literals.SIMPLE_CONSTRAINT__CONSTRAINT_TYPE, + true, + false, + true, + null, + null, + null)); + } + + /** + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(ConstraintsPackage.Literals.SIMPLE_CONSTRAINT__PROPERTIES); + } + return childrenFeatures; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); + } + + /** + * This returns SimpleConstraint.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/SimpleConstraint")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((SimpleConstraint) object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_SimpleConstraint_type") : + getString("_UI_SimpleConstraint_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(SimpleConstraint.class)) { + case ConstraintsPackage.SIMPLE_CONSTRAINT__PROPERTIES: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (ConstraintsPackage.Literals.SIMPLE_CONSTRAINT__PROPERTIES, + ConstraintsFactory.eINSTANCE.createValueProperty())); + + newChildDescriptors.add + (createChildParameter + (ConstraintsPackage.Literals.SIMPLE_CONSTRAINT__PROPERTIES, + ConstraintsFactory.eINSTANCE.createReferenceProperty())); + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ValuePropertyItemProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ValuePropertyItemProvider.java new file mode 100644 index 00000000000..44e02e523db --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.edit/src-gen/org/eclipse/papyrus/infra/constraints/provider/ValuePropertyItemProvider.java @@ -0,0 +1,153 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.provider; + + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; +import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; +import org.eclipse.emf.edit.provider.IItemLabelProvider; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.IItemPropertySource; +import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; +import org.eclipse.emf.edit.provider.ITreeItemContentProvider; +import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.ValueProperty; + +/** + * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.constraints.ValueProperty} object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ValuePropertyItemProvider + extends ConfigPropertyItemProvider + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ValuePropertyItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addValuePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Value feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void addValuePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ValueProperty_value_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ValueProperty_value_feature", "_UI_ValueProperty_type"), + ConstraintsPackage.Literals.VALUE_PROPERTY__VALUE, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns ValueProperty.gif. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ValueProperty")); + } + + /** + * This returns the label text for the adapted class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ValueProperty) object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_ValueProperty_type") : + getString("_UI_ValueProperty_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached + * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ValueProperty.class)) { + case ConstraintsPackage.VALUE_PROPERTY__VALUE: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); + return; + } + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children + * that can be created under this object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.classpath b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.classpath new file mode 100644 index 00000000000..c1f31893de4 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src-gen"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.project b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.project new file mode 100644 index 00000000000..7662e546de1 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.infra.constraints.editor</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + </natures> +</projectDescription> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..94d61f00da6 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +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/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/META-INF/MANIFEST.MF b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..a2229df65f3 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.papyrus.infra.constraints.edit;bundle-version="1.2.0";visibility:=reexport, + org.eclipse.emf.ecore.xmi;visibility:=reexport, + org.eclipse.emf.edit.ui;visibility:=reexport, + org.eclipse.ui.ide +Export-Package: org.eclipse.papyrus.infra.constraints.environment.presentation, + org.eclipse.papyrus.infra.constraints.presentation +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Version: 1.2.0.qualifier +Bundle-Localization: plugin +Bundle-Name: %pluginName +Bundle-Activator: org.eclipse.papyrus.infra.constraints.presentation.ConstraintsEditorPlugin$Implementation +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.infra.constraints.editor;singleton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/about.html b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/about.html new file mode 100644 index 00000000000..dd3c089a94c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>November 14, 2008</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/build.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/build.properties new file mode 100644 index 00000000000..d2ecb5d5794 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/build.properties @@ -0,0 +1,16 @@ + +# <copyright> +# </copyright> +# +# $Id$ + +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src-gen/ +output.. = bin +src.includes = about.html diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/obj16/ConstraintsModelFile.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/obj16/ConstraintsModelFile.gif Binary files differnew file mode 100644 index 00000000000..4ef24bd30dc --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/obj16/ConstraintsModelFile.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/obj16/EnvironmentModelFile.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/obj16/EnvironmentModelFile.gif Binary files differnew file mode 100644 index 00000000000..7cd31fe01e0 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/obj16/EnvironmentModelFile.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/wizban/NewConstraints.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/wizban/NewConstraints.gif Binary files differnew file mode 100644 index 00000000000..440f3695c73 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/wizban/NewConstraints.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/wizban/NewEnvironment.gif b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/wizban/NewEnvironment.gif Binary files differnew file mode 100644 index 00000000000..1c827789db0 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/icons/full/wizban/NewEnvironment.gif diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/plugin.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/plugin.properties new file mode 100644 index 00000000000..b443b6befd6 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/plugin.properties @@ -0,0 +1,66 @@ + +# <copyright> +# </copyright> +# +# $Id$ + +pluginName = Constraints Editor +providerName = Eclipse Modeling Project + +_UI_ConstraintsEditor_menu = &Constraints Editor +_UI_EnvironmentEditor_menu = &Environment Editor + +_UI_CreateChild_menu_item = &New Child +_UI_CreateSibling_menu_item = N&ew Sibling + +_UI_ShowPropertiesView_menu_item = Show &Properties View +_UI_RefreshViewer_menu_item = &Refresh + +_UI_SelectionPage_label = Selection +_UI_ParentPage_label = Parent +_UI_ListPage_label = List +_UI_TreePage_label = Tree +_UI_TablePage_label = Table +_UI_TreeWithColumnsPage_label = Tree with Columns +_UI_ObjectColumn_label = Object +_UI_SelfColumn_label = Self + +_UI_NoObjectSelected = Selected Nothing +_UI_SingleObjectSelected = Selected Object: {0} +_UI_MultiObjectSelected = Selected {0} Objects + +_UI_OpenEditorError_label = Open Editor + +_UI_Wizard_category = Example EMF Model Creation Wizards + +_UI_CreateModelError_message = Problems encountered in file "{0}" + +_UI_ConstraintsModelWizard_label = Constraints Model +_UI_ConstraintsModelWizard_description = Create a new Constraints model + +_UI_ConstraintsEditor_label = Constraints Model Editor + +_UI_ConstraintsEditorFilenameDefaultBase = My +_UI_ConstraintsEditorFilenameExtensions = constraints + +_UI_EnvironmentModelWizard_label = Environment Model +_UI_EnvironmentModelWizard_description = Create a new Environment model + +_UI_EnvironmentEditor_label = Environment Model Editor + +_UI_EnvironmentEditorFilenameDefaultBase = My +_UI_EnvironmentEditorFilenameExtensions = environment + +_UI_Wizard_label = New + +_WARN_FilenameExtension = The file name must end in ''.{0}'' +_WARN_FilenameExtensions = The file name must have one of the following extensions: {0} + +_UI_ModelObject = &Model Object +_UI_XMLEncoding = &XML Encoding +_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1 +_UI_Wizard_initial_object_description = Select a model object to create + +_UI_FileConflict_label = File Conflict +_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes? + diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/plugin.xml b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/plugin.xml new file mode 100644 index 00000000000..167adc4e8d8 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/plugin.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.0"?> + +<!-- + <copyright> + </copyright> + + $Id$ +--> + +<plugin> + + <extension point="org.eclipse.ui.newWizards"> + <category + id="org.eclipse.emf.ecore.Wizard.category.ID" + name="%_UI_Wizard_category"/> + <wizard + id="org.eclipse.papyrus.infra.constraints.presentation.ConstraintsModelWizardID" + name="%_UI_ConstraintsModelWizard_label" + class="org.eclipse.papyrus.infra.constraints.presentation.ConstraintsModelWizard" + category="org.eclipse.emf.ecore.Wizard.category.ID" + icon="icons/full/obj16/ConstraintsModelFile.gif"> + <description>%_UI_ConstraintsModelWizard_description</description> + <selection class="org.eclipse.core.resources.IResource"/> + </wizard> + </extension> + + <extension point="org.eclipse.ui.editors"> + <editor + id="org.eclipse.papyrus.infra.constraints.presentation.ConstraintsEditorID" + name="%_UI_ConstraintsEditor_label" + icon="icons/full/obj16/ConstraintsModelFile.gif" + extensions="constraints" + class="org.eclipse.papyrus.infra.constraints.presentation.ConstraintsEditor" + contributorClass="org.eclipse.papyrus.infra.constraints.presentation.ConstraintsActionBarContributor"> + </editor> + </extension> + + <extension point="org.eclipse.ui.newWizards"> + <category + id="org.eclipse.emf.ecore.Wizard.category.ID" + name="%_UI_Wizard_category"/> + <wizard + id="org.eclipse.papyrus.infra.constraints.environment.presentation.EnvironmentModelWizardID" + name="%_UI_EnvironmentModelWizard_label" + class="org.eclipse.papyrus.infra.constraints.environment.presentation.EnvironmentModelWizard" + category="org.eclipse.emf.ecore.Wizard.category.ID" + icon="icons/full/obj16/EnvironmentModelFile.gif"> + <description>%_UI_EnvironmentModelWizard_description</description> + <selection class="org.eclipse.core.resources.IResource"/> + </wizard> + </extension> + + <extension point="org.eclipse.ui.editors"> + <editor + id="org.eclipse.papyrus.infra.constraints.environment.presentation.EnvironmentEditorID" + name="%_UI_EnvironmentEditor_label" + icon="icons/full/obj16/EnvironmentModelFile.gif" + extensions="environment" + class="org.eclipse.papyrus.infra.constraints.environment.presentation.EnvironmentEditor" + contributorClass="org.eclipse.papyrus.infra.constraints.environment.presentation.EnvironmentActionBarContributor"> + </editor> + </extension> + +</plugin> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/pom.xml b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/pom.xml new file mode 100644 index 00000000000..a582793ef1f --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.infra-constraints</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.infra.constraints.editor</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentActionBarContributor.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentActionBarContributor.java new file mode 100644 index 00000000000..247d5e4591a --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentActionBarContributor.java @@ -0,0 +1,446 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.presentation; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.emf.edit.ui.action.ControlAction; +import org.eclipse.emf.edit.ui.action.CreateChildAction; +import org.eclipse.emf.edit.ui.action.CreateSiblingAction; +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; +import org.eclipse.emf.edit.ui.action.LoadResourceAction; +import org.eclipse.emf.edit.ui.action.ValidateAction; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.action.SubContributionItem; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.infra.constraints.presentation.ConstraintsEditorPlugin; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PartInitException; + +/** + * This is the action bar contributor for the Environment model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class EnvironmentActionBarContributor + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { + /** + * This keeps track of the active editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IEditorPart activeEditorPart; + + /** + * This keeps track of the current selection provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ISelectionProvider selectionProvider; + + /** + * This action opens the Properties view. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IAction showPropertiesViewAction = + new Action(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { + @Override + public void run() { + try { + getPage().showView("org.eclipse.ui.views.PropertySheet"); + } + catch (PartInitException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * This action refreshes the viewer of the current editor if the editor + * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IAction refreshViewerAction = + new Action(ConstraintsEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { + @Override + public boolean isEnabled() { + return activeEditorPart instanceof IViewerProvider; + } + + @Override + public void run() { + if (activeEditorPart instanceof IViewerProvider) { + Viewer viewer = ((IViewerProvider) activeEditorPart).getViewer(); + if (viewer != null) { + viewer.refresh(); + } + } + } + }; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> createChildActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateChild actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IMenuManager createChildMenuManager; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> createSiblingActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateSibling actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IMenuManager createSiblingMenuManager; + + /** + * This creates an instance of the contributor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentActionBarContributor() { + super(ADDITIONS_LAST_STYLE); + loadResourceAction = new LoadResourceAction(); + validateAction = new ValidateAction(); + controlAction = new ControlAction(); + } + + /** + * This adds Separators for editor additions to the tool bar. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void contributeToToolBar(IToolBarManager toolBarManager) { + toolBarManager.add(new Separator("environment-settings")); + toolBarManager.add(new Separator("environment-additions")); + } + + /** + * This adds to the menu bar a menu and some separators for editor additions, + * as well as the sub-menus for object creation items. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void contributeToMenu(IMenuManager menuManager) { + super.contributeToMenu(menuManager); + + IMenuManager submenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentEditor_menu"), "org.eclipse.papyrus.infra.constraints.environmentMenuID"); + menuManager.insertAfter("additions", submenuManager); + submenuManager.add(new Separator("settings")); + submenuManager.add(new Separator("actions")); + submenuManager.add(new Separator("additions")); + submenuManager.add(new Separator("additions-end")); + + // Prepare for CreateChild item addition or removal. + // + createChildMenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + submenuManager.insertBefore("additions", createChildMenuManager); + + // Prepare for CreateSibling item addition or removal. + // + createSiblingMenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + submenuManager.insertBefore("additions", createSiblingMenuManager); + + // Force an update because Eclipse hides empty menus now. + // + submenuManager.addMenuListener + (new IMenuListener() { + @Override + public void menuAboutToShow(IMenuManager menuManager) { + menuManager.updateAll(true); + } + }); + + addGlobalActions(submenuManager); + } + + /** + * When the active editor changes, this remembers the change and registers with it as a selection provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + activeEditorPart = part; + + // Switch to the new selection provider. + // + if (selectionProvider != null) { + selectionProvider.removeSelectionChangedListener(this); + } + if (part == null) { + selectionProvider = null; + } + else { + selectionProvider = part.getSite().getSelectionProvider(); + selectionProvider.addSelectionChangedListener(this); + + // Fake a selection changed event to update the menus. + // + if (selectionProvider.getSelection() != null) { + selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); + } + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, + * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings + * that can be added to the selected object and updating the menus accordingly. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void selectionChanged(SelectionChangedEvent event) { + // Remove any menu items for old selection. + // + if (createChildMenuManager != null) { + depopulateManager(createChildMenuManager, createChildActions); + } + if (createSiblingMenuManager != null) { + depopulateManager(createSiblingMenuManager, createSiblingActions); + } + + // Query the new selection for appropriate new child/sibling descriptors + // + Collection<?> newChildDescriptors = null; + Collection<?> newSiblingDescriptors = null; + + ISelection selection = event.getSelection(); + if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { + Object object = ((IStructuredSelection) selection).getFirstElement(); + + EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain(); + + newChildDescriptors = domain.getNewChildDescriptors(object, null); + newSiblingDescriptors = domain.getNewChildDescriptors(null, object); + } + + // Generate actions for selection; populate and redraw the menus. + // + createChildActions = generateCreateChildActions(newChildDescriptors, selection); + createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); + + if (createChildMenuManager != null) { + populateManager(createChildMenuManager, createChildActions, null); + createChildMenuManager.update(true); + } + if (createSiblingMenuManager != null) { + populateManager(createSiblingMenuManager, createSiblingActions, null); + createSiblingMenuManager.update(true); + } + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, + * and returns the collection of these actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { + Collection<IAction> actions = new ArrayList<IAction>(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, + * and returns the collection of these actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { + Collection<IAction> actions = new ArrayList<IAction>(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, + * by inserting them before the specified contribution item <code>contributionID</code>. + * If <code>contributionID</code> is <code>null</code>, they are simply added. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { + if (actions != null) { + for (IAction action : actions) { + if (contributionID != null) { + manager.insertBefore(contributionID, action); + } + else { + manager.add(action); + } + } + } + } + + /** + * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { + if (actions != null) { + IContributionItem[] items = manager.getItems(); + for (int i = 0; i < items.length; i++) { + // Look into SubContributionItems + // + IContributionItem contributionItem = items[i]; + while (contributionItem instanceof SubContributionItem) { + contributionItem = ((SubContributionItem) contributionItem).getInnerItem(); + } + + // Delete the ActionContributionItems with matching action. + // + if (contributionItem instanceof ActionContributionItem) { + IAction action = ((ActionContributionItem) contributionItem).getAction(); + if (actions.contains(action)) { + manager.remove(contributionItem); + } + } + } + } + } + + /** + * This populates the pop-up menu before it appears. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + super.menuAboutToShow(menuManager); + MenuManager submenuManager = null; + + submenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + populateManager(submenuManager, createChildActions, null); + menuManager.insertBefore("edit", submenuManager); + + submenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + populateManager(submenuManager, createSiblingActions, null); + menuManager.insertBefore("edit", submenuManager); + } + + /** + * This inserts global actions before the "additions-end" separator. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void addGlobalActions(IMenuManager menuManager) { + menuManager.insertAfter("additions-end", new Separator("ui-actions")); + menuManager.insertAfter("ui-actions", showPropertiesViewAction); + + refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); + menuManager.insertAfter("ui-actions", refreshViewerAction); + + super.addGlobalActions(menuManager); + } + + /** + * This ensures that a delete action will clean up all references to deleted objects. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected boolean removeAllReferencesOnDelete() { + return true; + } + +}
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentEditor.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentEditor.java new file mode 100644 index 00000000000..c3e911899c2 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentEditor.java @@ -0,0 +1,1884 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.presentation; + + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +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.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.command.CommandStackListener; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.ui.MarkerHelper; +import org.eclipse.emf.common.ui.ViewerPane; +import org.eclipse.emf.common.ui.editor.ProblemEditorPart; +import org.eclipse.emf.common.ui.viewer.IViewerProvider; +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EValidator; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EContentAdapter; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; +import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; +import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; +import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; +import org.eclipse.emf.edit.ui.util.EditUIUtil; +import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.infra.constraints.environment.provider.EnvironmentItemProviderAdapterFactory; +import org.eclipse.papyrus.infra.constraints.presentation.ConstraintsEditorPlugin; +import org.eclipse.papyrus.infra.constraints.provider.ConstraintsItemProviderAdapterFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.dialogs.SaveAsDialog; +import org.eclipse.ui.ide.IGotoMarker; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + + +/** + * This is an example of a Environment model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class EnvironmentEditor + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + /** + * This keeps track of the editing domain that is used to track all changes to the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected AdapterFactoryEditingDomain editingDomain; + + /** + * This is the one adapter factory used for providing views of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ComposedAdapterFactory adapterFactory; + + /** + * This is the content outline page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IContentOutlinePage contentOutlinePage; + + /** + * This is a kludge... + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IStatusLineManager contentOutlineStatusLineManager; + + /** + * This is the content outline page's viewer. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer contentOutlineViewer; + + /** + * This is the property sheet page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected PropertySheetPage propertySheetPage; + + /** + * This is the viewer that shadows the selection in the content outline. + * The parent relation must be correctly defined for this to work. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer selectionViewer; + + /** + * This inverts the roll of parent and child in the content provider and show parents as a tree. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer parentViewer; + + /** + * This shows how a tree view works. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer treeViewer; + + /** + * This shows how a list view works. + * A list viewer doesn't support icons. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ListViewer listViewer; + + /** + * This shows how a table view works. + * A table can be used as a list with icons. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TableViewer tableViewer; + + /** + * This shows how a tree view with columns works. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer treeViewerWithColumns; + + /** + * This keeps track of the active viewer pane, in the book. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ViewerPane currentViewerPane; + + /** + * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Viewer currentViewer; + + /** + * This listens to which ever viewer is active. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ISelectionChangedListener selectionChangedListener; + + /** + * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); + + /** + * This keeps track of the selection of the editor as a whole. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ISelection editorSelection = StructuredSelection.EMPTY; + + /** + * The MarkerHelper is responsible for creating workspace resource markers presented + * in Eclipse's Problems View. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected MarkerHelper markerHelper = new EditUIMarkerHelper(); + + /** + * This listens for when the outline becomes active + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IPartListener partListener = + new IPartListener() { + @Override + public void partActivated(IWorkbenchPart p) { + if (p instanceof ContentOutline) { + if (((ContentOutline) p).getCurrentPage() == contentOutlinePage) { + getActionBarContributor().setActiveEditor(EnvironmentEditor.this); + + setCurrentViewer(contentOutlineViewer); + } + } + else if (p instanceof PropertySheet) { + if (((PropertySheet) p).getCurrentPage() == propertySheetPage) { + getActionBarContributor().setActiveEditor(EnvironmentEditor.this); + handleActivate(); + } + } + else if (p == EnvironmentEditor.this) { + handleActivate(); + } + } + + @Override + public void partBroughtToTop(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partClosed(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partDeactivated(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partOpened(IWorkbenchPart p) { + // Ignore. + } + }; + + /** + * Resources that have been removed since last activation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Resource> removedResources = new ArrayList<Resource>(); + + /** + * Resources that have been changed since last activation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Resource> changedResources = new ArrayList<Resource>(); + + /** + * Resources that have been saved. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Resource> savedResources = new ArrayList<Resource>(); + + /** + * Map to store the diagnostic associated with a resource. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); + + /** + * Controls whether the problem indication should be updated. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean updateProblemIndication = true; + + /** + * Adapter used to update the problem indication when resources are demanded loaded. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EContentAdapter problemIndicationAdapter = + new EContentAdapter() { + @Override + public void notifyChanged(Notification notification) { + if (notification.getNotifier() instanceof Resource) { + switch (notification.getFeatureID(Resource.class)) { + case Resource.RESOURCE__IS_LOADED: + case Resource.RESOURCE__ERRORS: + case Resource.RESOURCE__WARNINGS: { + Resource resource = (Resource) notification.getNotifier(); + Diagnostic diagnostic = analyzeResourceProblems(resource, null); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, diagnostic); + } + else { + resourceToDiagnosticMap.remove(resource); + } + + if (updateProblemIndication) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + updateProblemIndication(); + } + }); + } + break; + } + } + } + else { + super.notifyChanged(notification); + } + } + + @Override + protected void setTarget(Resource target) { + basicSetTarget(target); + } + + @Override + protected void unsetTarget(Resource target) { + basicUnsetTarget(target); + } + }; + + /** + * This listens for workspace changes. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IResourceChangeListener resourceChangeListener = + new IResourceChangeListener() { + @Override + public void resourceChanged(IResourceChangeEvent event) { + IResourceDelta delta = event.getDelta(); + try { + class ResourceDeltaVisitor implements IResourceDeltaVisitor { + protected ResourceSet resourceSet = editingDomain.getResourceSet(); + protected Collection<Resource> changedResources = new ArrayList<Resource>(); + protected Collection<Resource> removedResources = new ArrayList<Resource>(); + + @Override + public boolean visit(IResourceDelta delta) { + if (delta.getResource().getType() == IResource.FILE) { + if (delta.getKind() == IResourceDelta.REMOVED || + delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { + Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); + if (resource != null) { + if (delta.getKind() == IResourceDelta.REMOVED) { + removedResources.add(resource); + } + else if (!savedResources.remove(resource)) { + changedResources.add(resource); + } + } + } + } + + return true; + } + + public Collection<Resource> getChangedResources() { + return changedResources; + } + + public Collection<Resource> getRemovedResources() { + return removedResources; + } + } + + final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); + delta.accept(visitor); + + if (!visitor.getRemovedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + removedResources.addAll(visitor.getRemovedResources()); + if (!isDirty()) { + getSite().getPage().closeEditor(EnvironmentEditor.this, false); + } + } + }); + } + + if (!visitor.getChangedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + changedResources.addAll(visitor.getChangedResources()); + if (getSite().getPage().getActiveEditor() == EnvironmentEditor.this) { + handleActivate(); + } + } + }); + } + } + catch (CoreException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * Handles activation of the editor or it's associated views. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void handleActivate() { + // Recompute the read only state. + // + if (editingDomain.getResourceToReadOnlyMap() != null) { + editingDomain.getResourceToReadOnlyMap().clear(); + + // Refresh any actions that may become enabled or disabled. + // + setSelection(getSelection()); + } + + if (!removedResources.isEmpty()) { + if (handleDirtyConflict()) { + getSite().getPage().closeEditor(EnvironmentEditor.this, false); + } + else { + removedResources.clear(); + changedResources.clear(); + savedResources.clear(); + } + } + else if (!changedResources.isEmpty()) { + changedResources.removeAll(savedResources); + handleChangedResources(); + changedResources.clear(); + savedResources.clear(); + } + } + + /** + * Handles what to do with changed resources on activation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void handleChangedResources() { + if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { + if (isDirty()) { + changedResources.addAll(editingDomain.getResourceSet().getResources()); + } + editingDomain.getCommandStack().flush(); + + updateProblemIndication = false; + for (Resource resource : changedResources) { + if (resource.isLoaded()) { + resource.unload(); + try { + resource.load(Collections.EMPTY_MAP); + } catch (IOException exception) { + if (!resourceToDiagnosticMap.containsKey(resource)) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + } + } + } + + if (AdapterFactoryEditingDomain.isStale(editorSelection)) { + setSelection(StructuredSelection.EMPTY); + } + + updateProblemIndication = true; + updateProblemIndication(); + } + } + + /** + * Updates the problems indication with the information described in the specified diagnostic. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void updateProblemIndication() { + if (updateProblemIndication) { + BasicDiagnostic diagnostic = + new BasicDiagnostic + (Diagnostic.OK, + "org.eclipse.papyrus.infra.constraints.editor", + 0, + null, + new Object[] { editingDomain.getResourceSet() }); + for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { + if (childDiagnostic.getSeverity() != Diagnostic.OK) { + diagnostic.add(childDiagnostic); + } + } + + int lastEditorPage = getPageCount() - 1; + if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { + ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic); + if (diagnostic.getSeverity() != Diagnostic.OK) { + setActivePage(lastEditorPage); + } + } + else if (diagnostic.getSeverity() != Diagnostic.OK) { + ProblemEditorPart problemEditorPart = new ProblemEditorPart(); + problemEditorPart.setDiagnostic(diagnostic); + problemEditorPart.setMarkerHelper(markerHelper); + try { + addPage(++lastEditorPage, problemEditorPart, getEditorInput()); + setPageText(lastEditorPage, problemEditorPart.getPartName()); + setActivePage(lastEditorPage); + showTabs(); + } catch (PartInitException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + + if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { + markerHelper.deleteMarkers(editingDomain.getResourceSet()); + if (diagnostic.getSeverity() != Diagnostic.OK) { + try { + markerHelper.createMarkers(diagnostic); + } catch (CoreException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + } + } + } + + /** + * Shows a dialog that asks if conflicting changes should be discarded. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean handleDirtyConflict() { + return MessageDialog.openQuestion + (getSite().getShell(), + getString("_UI_FileConflict_label"), + getString("_WARN_FileConflict")); + } + + /** + * This creates a model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentEditor() { + super(); + initializeEditingDomain(); + } + + /** + * This sets up the editing domain for the model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void initializeEditingDomain() { + // Create an adapter factory that yields item providers. + // + adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + + adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new ConstraintsItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new EnvironmentItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); + + // Create the command stack that will notify this editor as commands are executed. + // + BasicCommandStack commandStack = new BasicCommandStack(); + + // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. + // + commandStack.addCommandStackListener + (new CommandStackListener() { + @Override + public void commandStackChanged(final EventObject event) { + getContainer().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + firePropertyChange(IEditorPart.PROP_DIRTY); + + // Try to select the affected objects. + // + Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand(); + if (mostRecentCommand != null) { + setSelectionToViewer(mostRecentCommand.getAffectedObjects()); + } + if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { + propertySheetPage.refresh(); + } + } + }); + } + }); + + // Create the editing domain with a special command stack. + // + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); + } + + /** + * This is here for the listener to be able to call it. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void firePropertyChange(int action) { + super.firePropertyChange(action); + } + + /** + * This sets the selection into whichever viewer is active. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setSelectionToViewer(Collection<?> collection) { + final Collection<?> theSelection = collection; + // Make sure it's okay. + // + if (theSelection != null && !theSelection.isEmpty()) { + Runnable runnable = + new Runnable() { + @Override + public void run() { + // Try to select the items in the current content viewer of the editor. + // + if (currentViewer != null) { + currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); + } + } + }; + getSite().getShell().getDisplay().asyncExec(runnable); + } + } + + /** + * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. + * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public EditingDomain getEditingDomain() { + return editingDomain; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object[] getElements(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object[] getChildren(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean hasChildren(Object object) { + Object parent = super.getParent(object); + return parent != null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getParent(Object object) { + return null; + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setCurrentViewerPane(ViewerPane viewerPane) { + if (currentViewerPane != viewerPane) { + if (currentViewerPane != null) { + currentViewerPane.showFocus(false); + } + currentViewerPane = viewerPane; + } + setCurrentViewer(currentViewerPane.getViewer()); + } + + /** + * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, + * is the current one. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setCurrentViewer(Viewer viewer) { + // If it is changing... + // + if (currentViewer != viewer) { + if (selectionChangedListener == null) { + // Create the listener on demand. + // + selectionChangedListener = + new ISelectionChangedListener() { + // This just notifies those things that are affected by the section. + // + @Override + public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { + setSelection(selectionChangedEvent.getSelection()); + } + }; + } + + // Stop listening to the old one. + // + if (currentViewer != null) { + currentViewer.removeSelectionChangedListener(selectionChangedListener); + } + + // Start listening to the new one. + // + if (viewer != null) { + viewer.addSelectionChangedListener(selectionChangedListener); + } + + // Remember it. + // + currentViewer = viewer; + + // Set the editors selection based on the current viewer's selection. + // + setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); + } + } + + /** + * This returns the viewer as required by the {@link IViewerProvider} interface. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Viewer getViewer() { + return currentViewer; + } + + /** + * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void createContextMenuFor(StructuredViewer viewer) { + MenuManager contextMenu = new MenuManager("#PopUp"); + contextMenu.add(new Separator("additions")); + contextMenu.setRemoveAllWhenShown(true); + contextMenu.addMenuListener(this); + Menu menu = contextMenu.createContextMenu(viewer.getControl()); + viewer.getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); + + int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; + viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); + viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); + } + + /** + * This is the method called to load a resource into the editing domain's resource set based on the editor's input. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void createModel() { + URI resourceURI = EditUIUtil.getURI(getEditorInput()); + Exception exception = null; + Resource resource = null; + try { + // Load the resource through the editing domain. + // + resource = editingDomain.getResourceSet().getResource(resourceURI, true); + } catch (Exception e) { + exception = e; + resource = editingDomain.getResourceSet().getResource(resourceURI, false); + } + + Diagnostic diagnostic = analyzeResourceProblems(resource, exception); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); + } + + /** + * Returns a diagnostic describing the errors and warnings listed in the resource + * and the specified exception (if any). + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { + if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { + BasicDiagnostic basicDiagnostic = + new BasicDiagnostic + (Diagnostic.ERROR, + "org.eclipse.papyrus.infra.constraints.editor", + 0, + getString("_UI_CreateModelError_message", resource.getURI()), + new Object[] { exception == null ? (Object) resource : exception }); + basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); + return basicDiagnostic; + } + else if (exception != null) { + return new BasicDiagnostic(Diagnostic.ERROR, + "org.eclipse.papyrus.infra.constraints.editor", + 0, + getString("_UI_CreateModelError_message", resource.getURI()), + new Object[] { exception }); + } + else { + return Diagnostic.OK_INSTANCE; + } + } + + /** + * This is the method used by the framework to install your own controls. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void createPages() { + // Creates the model from the editor input + // + createModel(); + + // Only creates the other pages if there is something that can be edited + // + if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { + // Create a page for the selection tree view. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), EnvironmentEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + selectionViewer = (TreeViewer) viewerPane.getViewer(); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + viewerPane.setTitle(editingDomain.getResourceSet()); + + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); + + createContextMenuFor(selectionViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); + } + + // Create a page for the parent tree view. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), EnvironmentEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + parentViewer = (TreeViewer) viewerPane.getViewer(); + parentViewer.setAutoExpandLevel(30); + parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); + parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(parentViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ParentPage_label")); + } + + // This is the page for the list viewer + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), EnvironmentEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new ListViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + listViewer = (ListViewer) viewerPane.getViewer(); + listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(listViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ListPage_label")); + } + + // This is the page for the tree viewer + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), EnvironmentEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + treeViewer = (TreeViewer) viewerPane.getViewer(); + treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + + createContextMenuFor(treeViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreePage_label")); + } + + // This is the page for the table viewer. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), EnvironmentEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TableViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + tableViewer = (TableViewer) viewerPane.getViewer(); + + Table table = tableViewer.getTable(); + TableLayout layout = new TableLayout(); + table.setLayout(layout); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + TableColumn objectColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(3, 100, true)); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + + TableColumn selfColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(2, 100, true)); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + + tableViewer.setColumnProperties(new String[] { "a", "b" }); + tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(tableViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TablePage_label")); + } + + // This is the page for the table tree viewer. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), EnvironmentEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + treeViewerWithColumns = (TreeViewer) viewerPane.getViewer(); + + Tree tree = treeViewerWithColumns.getTree(); + tree.setLayoutData(new FillLayout()); + tree.setHeaderVisible(true); + tree.setLinesVisible(true); + + TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + objectColumn.setWidth(250); + + TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + selfColumn.setWidth(200); + + treeViewerWithColumns.setColumnProperties(new String[] { "a", "b" }); + treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(treeViewerWithColumns); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); + } + + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + setActivePage(0); + } + }); + } + + // Ensures that this editor will only display the page's tab + // area if there are more than one page + // + getContainer().addControlListener + (new ControlAdapter() { + boolean guard = false; + + @Override + public void controlResized(ControlEvent event) { + if (!guard) { + guard = true; + hideTabs(); + guard = false; + } + } + }); + + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + updateProblemIndication(); + } + }); + } + + /** + * If there is just one page in the multi-page editor part, + * this hides the single tab at the bottom. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void hideTabs() { + if (getPageCount() <= 1) { + setPageText(0, ""); + if (getContainer() instanceof CTabFolder) { + ((CTabFolder) getContainer()).setTabHeight(1); + Point point = getContainer().getSize(); + getContainer().setSize(point.x, point.y + 6); + } + } + } + + /** + * If there is more than one page in the multi-page editor part, + * this shows the tabs at the bottom. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void showTabs() { + if (getPageCount() > 1) { + setPageText(0, getString("_UI_SelectionPage_label")); + if (getContainer() instanceof CTabFolder) { + ((CTabFolder) getContainer()).setTabHeight(SWT.DEFAULT); + Point point = getContainer().getSize(); + getContainer().setSize(point.x, point.y - 6); + } + } + } + + /** + * This is used to track the active viewer. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void pageChange(int pageIndex) { + super.pageChange(pageIndex); + + if (contentOutlinePage != null) { + handleContentOutlineSelection(contentOutlinePage.getSelection()); + } + } + + /** + * This is how the framework determines which interfaces we implement. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("rawtypes") + @Override + public Object getAdapter(Class key) { + if (key.equals(IContentOutlinePage.class)) { + return showOutlineView() ? getContentOutlinePage() : null; + } + else if (key.equals(IPropertySheetPage.class)) { + return getPropertySheetPage(); + } + else if (key.equals(IGotoMarker.class)) { + return this; + } + else { + return super.getAdapter(key); + } + } + + /** + * This accesses a cached version of the content outliner. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IContentOutlinePage getContentOutlinePage() { + if (contentOutlinePage == null) { + // The content outline is just a tree. + // + class MyContentOutlinePage extends ContentOutlinePage { + @Override + public void createControl(Composite parent) { + super.createControl(parent); + contentOutlineViewer = getTreeViewer(); + contentOutlineViewer.addSelectionChangedListener(this); + + // Set up the tree viewer. + // + contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + contentOutlineViewer.setInput(editingDomain.getResourceSet()); + + // Make sure our popups work. + // + createContextMenuFor(contentOutlineViewer); + + if (!editingDomain.getResourceSet().getResources().isEmpty()) { + // Select the root object in the view. + // + contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + } + } + + @Override + public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { + super.makeContributions(menuManager, toolBarManager, statusLineManager); + contentOutlineStatusLineManager = statusLineManager; + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + } + + contentOutlinePage = new MyContentOutlinePage(); + + // Listen to selection so that we can handle it is a special way. + // + contentOutlinePage.addSelectionChangedListener + (new ISelectionChangedListener() { + // This ensures that we handle selections correctly. + // + @Override + public void selectionChanged(SelectionChangedEvent event) { + handleContentOutlineSelection(event.getSelection()); + } + }); + } + + return contentOutlinePage; + } + + /** + * This accesses a cached version of the property sheet. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IPropertySheetPage getPropertySheetPage() { + if (propertySheetPage == null) { + propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List<?> selection) { + EnvironmentEditor.this.setSelectionToViewer(selection); + EnvironmentEditor.this.setFocus(); + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + } + + return propertySheetPage; + } + + /** + * This deals with how we want selection in the outliner to affect the other views. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void handleContentOutlineSelection(ISelection selection) { + if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + Iterator<?> selectedElements = ((IStructuredSelection) selection).iterator(); + if (selectedElements.hasNext()) { + // Get the first selected element. + // + Object selectedElement = selectedElements.next(); + + // If it's the selection viewer, then we want it to select the same selection as this selection. + // + if (currentViewerPane.getViewer() == selectionViewer) { + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); + } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); + } + else { + // Set the input to the widget. + // + if (currentViewerPane.getViewer().getInput() != selectedElement) { + currentViewerPane.getViewer().setInput(selectedElement); + currentViewerPane.setTitle(selectedElement); + } + } + } + } + } + + /** + * This is for implementing {@link IEditorPart} and simply tests the command stack. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean isDirty() { + return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded(); + } + + /** + * This is for implementing {@link IEditorPart} and simply saves the model file. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void doSave(IProgressMonitor progressMonitor) { + // Save only resources that have actually changed. + // + final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); + saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); + + // Do the work within an operation because this is a long running activity that modifies the workbench. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + // This is the method that gets invoked when the operation runs. + // + @Override + public void execute(IProgressMonitor monitor) { + // Save the resources to the file system. + // + boolean first = true; + for (Resource resource : editingDomain.getResourceSet().getResources()) { + if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { + try { + long timeStamp = resource.getTimeStamp(); + resource.save(saveOptions); + if (resource.getTimeStamp() != timeStamp) { + savedResources.add(resource); + } + } + catch (Exception exception) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + first = false; + } + } + } + }; + + updateProblemIndication = false; + try { + // This runs the options, and shows progress. + // + new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); + + // Refresh the necessary state. + // + ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone(); + firePropertyChange(IEditorPart.PROP_DIRTY); + } catch (Exception exception) { + // Something went wrong that shouldn't. + // + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + updateProblemIndication = true; + updateProblemIndication(); + } + + /** + * This returns whether something has been persisted to the URI of the specified resource. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean isPersisted(Resource resource) { + boolean result = false; + try { + InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); + if (stream != null) { + result = true; + stream.close(); + } + } catch (IOException e) { + // Ignore + } + return result; + } + + /** + * This always returns true because it is not currently supported. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * This also changes the editor's input. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void doSaveAs() { + SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); + saveAsDialog.open(); + IPath path = saveAsDialog.getResult(); + if (path != null) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + if (file != null) { + doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); + } + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void doSaveAs(URI uri, IEditorInput editorInput) { + (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + IProgressMonitor progressMonitor = + getActionBars().getStatusLineManager() != null ? + getActionBars().getStatusLineManager().getProgressMonitor() : + new NullProgressMonitor(); + doSave(progressMonitor); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void gotoMarker(IMarker marker) { + try { + if (marker.getType().equals(EValidator.MARKER)) { + String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); + if (uriAttribute != null) { + URI uri = URI.createURI(uriAttribute); + EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); + if (eObject != null) { + setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); + } + } + } + } catch (CoreException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + + /** + * This is called during startup. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void init(IEditorSite site, IEditorInput editorInput) { + setSite(site); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + site.setSelectionProvider(this); + site.getPage().addPartListener(partListener); + ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setFocus() { + if (currentViewerPane != null) { + currentViewerPane.setFocus(); + } + else { + getControl(getActivePage()).setFocus(); + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.add(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.remove(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ISelection getSelection() { + return editorSelection; + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. + * Calling this result will notify the listeners. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setSelection(ISelection selection) { + editorSelection = selection; + + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + setStatusLineManager(selection); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setStatusLineManager(ISelection selection) { + IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? + contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); + + if (statusLineManager != null) { + if (selection instanceof IStructuredSelection) { + Collection<?> collection = ((IStructuredSelection) selection).toList(); + switch (collection.size()) { + case 0: { + statusLineManager.setMessage(getString("_UI_NoObjectSelected")); + break; + } + case 1: { + String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); + statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); + break; + } + default: { + statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); + break; + } + } + } + else { + statusLineManager.setMessage(""); + } + } + } + + /** + * This looks up a string in the plugin's plugin.properties file. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static String getString(String key) { + return ConstraintsEditorPlugin.INSTANCE.getString(key); + } + + /** + * This looks up a string in plugin.properties, making a substitution. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static String getString(String key, Object s1) { + return ConstraintsEditorPlugin.INSTANCE.getString(key, new Object[] { s1 }); + } + + /** + * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + ((IMenuListener) getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EditingDomainActionBarContributor getActionBarContributor() { + return (EditingDomainActionBarContributor) getEditorSite().getActionBarContributor(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IActionBars getActionBars() { + return getActionBarContributor().getActionBars(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public AdapterFactory getAdapterFactory() { + return adapterFactory; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void dispose() { + updateProblemIndication = false; + + ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); + + getSite().getPage().removePartListener(partListener); + + adapterFactory.dispose(); + + if (getActionBarContributor().getActiveEditor() == this) { + getActionBarContributor().setActiveEditor(null); + } + + if (propertySheetPage != null) { + propertySheetPage.dispose(); + } + + if (contentOutlinePage != null) { + contentOutlinePage.dispose(); + } + + super.dispose(); + } + + /** + * Returns whether the outline view should be presented to the user. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean showOutlineView() { + return true; + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentModelWizard.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentModelWizard.java new file mode 100644 index 00000000000..3dde25261ed --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/environment/presentation/EnvironmentModelWizard.java @@ -0,0 +1,641 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.presentation; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.StringTokenizer; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentFactory; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; +import org.eclipse.papyrus.infra.constraints.presentation.ConstraintsEditorPlugin; +import org.eclipse.papyrus.infra.constraints.provider.ConstraintsEditPlugin; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +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.Label; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.dialogs.WizardNewFileCreationPage; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; + + +/** + * This is a simple wizard for creating a new model file. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class EnvironmentModelWizard extends Wizard implements INewWizard { + /** + * The supported extensions for created files. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static final List<String> FILE_EXTENSIONS = + Collections.unmodifiableList(Arrays.asList(ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentEditorFilenameExtensions").split("\\s*,\\s*"))); + + /** + * A formatted list of supported file extensions, suitable for display. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static final String FORMATTED_FILE_EXTENSIONS = + ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); + + /** + * This caches an instance of the model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EnvironmentPackage environmentPackage = EnvironmentPackage.eINSTANCE; + + /** + * This caches an instance of the model factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EnvironmentFactory environmentFactory = environmentPackage.getEnvironmentFactory(); + + /** + * This is the file creation page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EnvironmentModelWizardNewFileCreationPage newFileCreationPage; + + /** + * This is the initial object creation page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EnvironmentModelWizardInitialObjectCreationPage initialObjectCreationPage; + + /** + * Remember the selection during initialization for populating the default container. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IStructuredSelection selection; + + /** + * Remember the workbench during initialization. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IWorkbench workbench; + + /** + * Caches the names of the types that can be created as the root object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected List<String> initialObjectNames; + + /** + * This just records the information. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + setWindowTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); + setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ConstraintsEditorPlugin.INSTANCE.getImage("full/wizban/NewEnvironment"))); + } + + /** + * Returns the names of the types that can be created as the root object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<String> getInitialObjectNames() { + if (initialObjectNames == null) { + initialObjectNames = new ArrayList<String>(); + for (EClassifier eClassifier : environmentPackage.getEClassifiers()) { + if (eClassifier instanceof EClass) { + EClass eClass = (EClass) eClassifier; + if (!eClass.isAbstract()) { + initialObjectNames.add(eClass.getName()); + } + } + } + Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); + } + return initialObjectNames; + } + + /** + * Create a new model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EObject createInitialModel() { + EClass eClass = (EClass) environmentPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); + EObject rootObject = environmentFactory.create(eClass); + return rootObject; + } + + /** + * Do the work after everything is specified. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean performFinish() { + try { + // Remember the file. + // + final IFile modelFile = getModelFile(); + + // Do the work within an operation. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor progressMonitor) { + try { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI); + + // Add the initial model object to the contents. + // + EObject rootObject = createInitialModel(); + if (rootObject != null) { + resource.getContents().add(rootObject); + } + + // Save the contents of the resource to the file system. + // + Map<Object, Object> options = new HashMap<Object, Object>(); + options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); + resource.save(options); + } + catch (Exception exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + finally { + progressMonitor.done(); + } + } + }; + + getContainer().run(false, false, operation); + + // Select the new file resource in the current view. + // + IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + final IWorkbenchPart activePart = page.getActivePart(); + if (activePart instanceof ISetSelectionTarget) { + final ISelection targetSelection = new StructuredSelection(modelFile); + getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + ((ISetSelectionTarget) activePart).selectReveal(targetSelection); + } + }); + } + + // Open an editor on the new file. + // + try { + page.openEditor + (new FileEditorInput(modelFile), + workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); + } catch (PartInitException exception) { + MessageDialog.openError(workbenchWindow.getShell(), ConstraintsEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); + return false; + } + + return true; + } catch (Exception exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + return false; + } + } + + /** + * This is the one page of the wizard. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public class EnvironmentModelWizardNewFileCreationPage extends WizardNewFileCreationPage { + /** + * Pass in the selection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { + super(pageId, selection); + } + + /** + * The framework calls this to see if the file is correct. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected boolean validatePage() { + if (super.validatePage()) { + String extension = new Path(getFileName()).getFileExtension(); + if (extension == null || !FILE_EXTENSIONS.contains(extension)) { + String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; + setErrorMessage(ConstraintsEditorPlugin.INSTANCE.getString(key, new Object[] { FORMATTED_FILE_EXTENSIONS })); + return false; + } + return true; + } + return false; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IFile getModelFile() { + return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); + } + } + + /** + * This is the page where the type of object to create is selected. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public class EnvironmentModelWizardInitialObjectCreationPage extends WizardPage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Combo initialObjectField; + + /** + * @generated + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + */ + protected List<String> encodings; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Combo encodingField; + + /** + * Pass in the selection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentModelWizardInitialObjectCreationPage(String pageId) { + super(pageId); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + { + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.verticalSpacing = 12; + composite.setLayout(layout); + + GridData data = new GridData(); + data.verticalAlignment = GridData.FILL; + data.grabExcessVerticalSpace = true; + data.horizontalAlignment = GridData.FILL; + composite.setLayoutData(data); + } + + Label containerLabel = new Label(composite, SWT.LEFT); + { + containerLabel.setText(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ModelObject")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + containerLabel.setLayoutData(data); + } + + initialObjectField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + initialObjectField.setLayoutData(data); + } + + for (String objectName : getInitialObjectNames()) { + initialObjectField.add(getLabel(objectName)); + } + + if (initialObjectField.getItemCount() == 1) { + initialObjectField.select(0); + } + initialObjectField.addModifyListener(validator); + + Label encodingLabel = new Label(composite, SWT.LEFT); + { + encodingLabel.setText(ConstraintsEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + encodingLabel.setLayoutData(data); + } + encodingField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + encodingField.setLayoutData(data); + } + + for (String encoding : getEncodings()) { + encodingField.add(encoding); + } + + encodingField.select(0); + encodingField.addModifyListener(validator); + + setPageComplete(validatePage()); + setControl(composite); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ModifyListener validator = + new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + setPageComplete(validatePage()); + } + }; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean validatePage() { + return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + if (initialObjectField.getItemCount() == 1) { + initialObjectField.clearSelection(); + encodingField.setFocus(); + } + else { + encodingField.clearSelection(); + initialObjectField.setFocus(); + } + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getInitialObjectName() { + String label = initialObjectField.getText(); + + for (String name : getInitialObjectNames()) { + if (getLabel(name).equals(label)) { + return name; + } + } + return null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getEncoding() { + return encodingField.getText(); + } + + /** + * Returns the label for the specified type name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected String getLabel(String typeName) { + try { + return ConstraintsEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); + } catch (MissingResourceException mre) { + ConstraintsEditorPlugin.INSTANCE.log(mre); + } + return typeName; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<String> getEncodings() { + if (encodings == null) { + encodings = new ArrayList<String>(); + for (StringTokenizer stringTokenizer = new StringTokenizer(ConstraintsEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();) { + encodings.add(stringTokenizer.nextToken()); + } + } + return encodings; + } + } + + /** + * The framework calls this to create the contents of the wizard. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void addPages() { + // Create a page, set the title, and the initial model file name. + // + newFileCreationPage = new EnvironmentModelWizardNewFileCreationPage("Whatever", selection); + newFileCreationPage.setTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentModelWizard_label")); + newFileCreationPage.setDescription(ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentModelWizard_description")); + newFileCreationPage.setFileName(ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); + addPage(newFileCreationPage); + + // Try and get the resource selection to determine a current directory for the file dialog. + // + if (selection != null && !selection.isEmpty()) { + // Get the resource... + // + Object selectedElement = selection.iterator().next(); + if (selectedElement instanceof IResource) { + // Get the resource parent, if its a file. + // + IResource selectedResource = (IResource) selectedElement; + if (selectedResource.getType() == IResource.FILE) { + selectedResource = selectedResource.getParent(); + } + + // This gives us a directory... + // + if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { + // Set this for the container. + // + newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); + + // Make up a unique new name here. + // + String defaultModelBaseFilename = ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentEditorFilenameDefaultBase"); + String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); + String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; + for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) { + modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; + } + newFileCreationPage.setFileName(modelFilename); + } + } + } + initialObjectCreationPage = new EnvironmentModelWizardInitialObjectCreationPage("Whatever2"); + initialObjectCreationPage.setTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_EnvironmentModelWizard_label")); + initialObjectCreationPage.setDescription(ConstraintsEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); + addPage(initialObjectCreationPage); + } + + /** + * Get the file from the page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IFile getModelFile() { + return newFileCreationPage.getModelFile(); + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsActionBarContributor.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsActionBarContributor.java new file mode 100644 index 00000000000..0a696e93003 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsActionBarContributor.java @@ -0,0 +1,445 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.presentation; + +import java.util.ArrayList; +import java.util.Collection; + +import org.eclipse.emf.common.ui.viewer.IViewerProvider; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.emf.edit.ui.action.ControlAction; +import org.eclipse.emf.edit.ui.action.CreateChildAction; +import org.eclipse.emf.edit.ui.action.CreateSiblingAction; +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; +import org.eclipse.emf.edit.ui.action.LoadResourceAction; +import org.eclipse.emf.edit.ui.action.ValidateAction; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.action.SubContributionItem; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PartInitException; + +/** + * This is the action bar contributor for the Constraints model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintsActionBarContributor + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { + /** + * This keeps track of the active editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IEditorPart activeEditorPart; + + /** + * This keeps track of the current selection provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ISelectionProvider selectionProvider; + + /** + * This action opens the Properties view. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IAction showPropertiesViewAction = + new Action(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { + @Override + public void run() { + try { + getPage().showView("org.eclipse.ui.views.PropertySheet"); + } + catch (PartInitException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * This action refreshes the viewer of the current editor if the editor + * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IAction refreshViewerAction = + new Action(ConstraintsEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) { + @Override + public boolean isEnabled() { + return activeEditorPart instanceof IViewerProvider; + } + + @Override + public void run() { + if (activeEditorPart instanceof IViewerProvider) { + Viewer viewer = ((IViewerProvider) activeEditorPart).getViewer(); + if (viewer != null) { + viewer.refresh(); + } + } + } + }; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> createChildActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateChild actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IMenuManager createChildMenuManager; + + /** + * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor + * generated for the current selection by the item provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> createSiblingActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateSibling actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IMenuManager createSiblingMenuManager; + + /** + * This creates an instance of the contributor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsActionBarContributor() { + super(ADDITIONS_LAST_STYLE); + loadResourceAction = new LoadResourceAction(); + validateAction = new ValidateAction(); + controlAction = new ControlAction(); + } + + /** + * This adds Separators for editor additions to the tool bar. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void contributeToToolBar(IToolBarManager toolBarManager) { + toolBarManager.add(new Separator("constraints-settings")); + toolBarManager.add(new Separator("constraints-additions")); + } + + /** + * This adds to the menu bar a menu and some separators for editor additions, + * as well as the sub-menus for object creation items. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void contributeToMenu(IMenuManager menuManager) { + super.contributeToMenu(menuManager); + + IMenuManager submenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsEditor_menu"), "org.eclipse.papyrus.infra.constraintsMenuID"); + menuManager.insertAfter("additions", submenuManager); + submenuManager.add(new Separator("settings")); + submenuManager.add(new Separator("actions")); + submenuManager.add(new Separator("additions")); + submenuManager.add(new Separator("additions-end")); + + // Prepare for CreateChild item addition or removal. + // + createChildMenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + submenuManager.insertBefore("additions", createChildMenuManager); + + // Prepare for CreateSibling item addition or removal. + // + createSiblingMenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + submenuManager.insertBefore("additions", createSiblingMenuManager); + + // Force an update because Eclipse hides empty menus now. + // + submenuManager.addMenuListener + (new IMenuListener() { + @Override + public void menuAboutToShow(IMenuManager menuManager) { + menuManager.updateAll(true); + } + }); + + addGlobalActions(submenuManager); + } + + /** + * When the active editor changes, this remembers the change and registers with it as a selection provider. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setActiveEditor(IEditorPart part) { + super.setActiveEditor(part); + activeEditorPart = part; + + // Switch to the new selection provider. + // + if (selectionProvider != null) { + selectionProvider.removeSelectionChangedListener(this); + } + if (part == null) { + selectionProvider = null; + } + else { + selectionProvider = part.getSite().getSelectionProvider(); + selectionProvider.addSelectionChangedListener(this); + + // Fake a selection changed event to update the menus. + // + if (selectionProvider.getSelection() != null) { + selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); + } + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, + * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings + * that can be added to the selected object and updating the menus accordingly. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void selectionChanged(SelectionChangedEvent event) { + // Remove any menu items for old selection. + // + if (createChildMenuManager != null) { + depopulateManager(createChildMenuManager, createChildActions); + } + if (createSiblingMenuManager != null) { + depopulateManager(createSiblingMenuManager, createSiblingActions); + } + + // Query the new selection for appropriate new child/sibling descriptors + // + Collection<?> newChildDescriptors = null; + Collection<?> newSiblingDescriptors = null; + + ISelection selection = event.getSelection(); + if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) { + Object object = ((IStructuredSelection) selection).getFirstElement(); + + EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain(); + + newChildDescriptors = domain.getNewChildDescriptors(object, null); + newSiblingDescriptors = domain.getNewChildDescriptors(null, object); + } + + // Generate actions for selection; populate and redraw the menus. + // + createChildActions = generateCreateChildActions(newChildDescriptors, selection); + createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection); + + if (createChildMenuManager != null) { + populateManager(createChildMenuManager, createChildActions, null); + createChildMenuManager.update(true); + } + if (createSiblingMenuManager != null) { + populateManager(createSiblingMenuManager, createSiblingActions, null); + createSiblingMenuManager.update(true); + } + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>, + * and returns the collection of these actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) { + Collection<IAction> actions = new ArrayList<IAction>(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>, + * and returns the collection of these actions. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) { + Collection<IAction> actions = new ArrayList<IAction>(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, + * by inserting them before the specified contribution item <code>contributionID</code>. + * If <code>contributionID</code> is <code>null</code>, they are simply added. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) { + if (actions != null) { + for (IAction action : actions) { + if (contributionID != null) { + manager.insertBefore(contributionID, action); + } + else { + manager.add(action); + } + } + } + } + + /** + * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) { + if (actions != null) { + IContributionItem[] items = manager.getItems(); + for (int i = 0; i < items.length; i++) { + // Look into SubContributionItems + // + IContributionItem contributionItem = items[i]; + while (contributionItem instanceof SubContributionItem) { + contributionItem = ((SubContributionItem) contributionItem).getInnerItem(); + } + + // Delete the ActionContributionItems with matching action. + // + if (contributionItem instanceof ActionContributionItem) { + IAction action = ((ActionContributionItem) contributionItem).getAction(); + if (actions.contains(action)) { + manager.remove(contributionItem); + } + } + } + } + } + + /** + * This populates the pop-up menu before it appears. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + super.menuAboutToShow(menuManager); + MenuManager submenuManager = null; + + submenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + populateManager(submenuManager, createChildActions, null); + menuManager.insertBefore("edit", submenuManager); + + submenuManager = new MenuManager(ConstraintsEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + populateManager(submenuManager, createSiblingActions, null); + menuManager.insertBefore("edit", submenuManager); + } + + /** + * This inserts global actions before the "additions-end" separator. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void addGlobalActions(IMenuManager menuManager) { + menuManager.insertAfter("additions-end", new Separator("ui-actions")); + menuManager.insertAfter("ui-actions", showPropertiesViewAction); + + refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); + menuManager.insertAfter("ui-actions", refreshViewerAction); + + super.addGlobalActions(menuManager); + } + + /** + * This ensures that a delete action will clean up all references to deleted objects. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected boolean removeAllReferencesOnDelete() { + return true; + } + +}
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsEditor.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsEditor.java new file mode 100644 index 00000000000..166227af2ba --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsEditor.java @@ -0,0 +1,1883 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.presentation; + + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.EventObject; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +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.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.command.BasicCommandStack; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.command.CommandStackListener; +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.ui.MarkerHelper; +import org.eclipse.emf.common.ui.ViewerPane; +import org.eclipse.emf.common.ui.editor.ProblemEditorPart; +import org.eclipse.emf.common.ui.viewer.IViewerProvider; +import org.eclipse.emf.common.util.BasicDiagnostic; +import org.eclipse.emf.common.util.Diagnostic; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EValidator; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.util.EContentAdapter; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.edit.domain.IEditingDomainProvider; +import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator; +import org.eclipse.emf.edit.provider.ComposedAdapterFactory; +import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory; +import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory; +import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor; +import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor; +import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; +import org.eclipse.emf.edit.ui.dnd.LocalTransfer; +import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; +import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; +import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper; +import org.eclipse.emf.edit.ui.util.EditUIUtil; +import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.infra.constraints.environment.provider.EnvironmentItemProviderAdapterFactory; +import org.eclipse.papyrus.infra.constraints.provider.ConstraintsItemProviderAdapterFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CTabFolder; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.dialogs.SaveAsDialog; +import org.eclipse.ui.ide.IGotoMarker; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.MultiPageEditorPart; +import org.eclipse.ui.views.contentoutline.ContentOutline; +import org.eclipse.ui.views.contentoutline.ContentOutlinePage; +import org.eclipse.ui.views.contentoutline.IContentOutlinePage; +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.PropertySheet; +import org.eclipse.ui.views.properties.PropertySheetPage; + + +/** + * This is an example of a Constraints model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintsEditor + extends MultiPageEditorPart + implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker { + /** + * This keeps track of the editing domain that is used to track all changes to the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected AdapterFactoryEditingDomain editingDomain; + + /** + * This is the one adapter factory used for providing views of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ComposedAdapterFactory adapterFactory; + + /** + * This is the content outline page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IContentOutlinePage contentOutlinePage; + + /** + * This is a kludge... + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IStatusLineManager contentOutlineStatusLineManager; + + /** + * This is the content outline page's viewer. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer contentOutlineViewer; + + /** + * This is the property sheet page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected PropertySheetPage propertySheetPage; + + /** + * This is the viewer that shadows the selection in the content outline. + * The parent relation must be correctly defined for this to work. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer selectionViewer; + + /** + * This inverts the roll of parent and child in the content provider and show parents as a tree. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer parentViewer; + + /** + * This shows how a tree view works. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer treeViewer; + + /** + * This shows how a list view works. + * A list viewer doesn't support icons. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ListViewer listViewer; + + /** + * This shows how a table view works. + * A table can be used as a list with icons. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TableViewer tableViewer; + + /** + * This shows how a tree view with columns works. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected TreeViewer treeViewerWithColumns; + + /** + * This keeps track of the active viewer pane, in the book. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ViewerPane currentViewerPane; + + /** + * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Viewer currentViewer; + + /** + * This listens to which ever viewer is active. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ISelectionChangedListener selectionChangedListener; + + /** + * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>(); + + /** + * This keeps track of the selection of the editor as a whole. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ISelection editorSelection = StructuredSelection.EMPTY; + + /** + * The MarkerHelper is responsible for creating workspace resource markers presented + * in Eclipse's Problems View. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected MarkerHelper markerHelper = new EditUIMarkerHelper(); + + /** + * This listens for when the outline becomes active + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IPartListener partListener = + new IPartListener() { + @Override + public void partActivated(IWorkbenchPart p) { + if (p instanceof ContentOutline) { + if (((ContentOutline) p).getCurrentPage() == contentOutlinePage) { + getActionBarContributor().setActiveEditor(ConstraintsEditor.this); + + setCurrentViewer(contentOutlineViewer); + } + } + else if (p instanceof PropertySheet) { + if (((PropertySheet) p).getCurrentPage() == propertySheetPage) { + getActionBarContributor().setActiveEditor(ConstraintsEditor.this); + handleActivate(); + } + } + else if (p == ConstraintsEditor.this) { + handleActivate(); + } + } + + @Override + public void partBroughtToTop(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partClosed(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partDeactivated(IWorkbenchPart p) { + // Ignore. + } + + @Override + public void partOpened(IWorkbenchPart p) { + // Ignore. + } + }; + + /** + * Resources that have been removed since last activation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Resource> removedResources = new ArrayList<Resource>(); + + /** + * Resources that have been changed since last activation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Resource> changedResources = new ArrayList<Resource>(); + + /** + * Resources that have been saved. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<Resource> savedResources = new ArrayList<Resource>(); + + /** + * Map to store the diagnostic associated with a resource. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>(); + + /** + * Controls whether the problem indication should be updated. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean updateProblemIndication = true; + + /** + * Adapter used to update the problem indication when resources are demanded loaded. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EContentAdapter problemIndicationAdapter = + new EContentAdapter() { + @Override + public void notifyChanged(Notification notification) { + if (notification.getNotifier() instanceof Resource) { + switch (notification.getFeatureID(Resource.class)) { + case Resource.RESOURCE__IS_LOADED: + case Resource.RESOURCE__ERRORS: + case Resource.RESOURCE__WARNINGS: { + Resource resource = (Resource) notification.getNotifier(); + Diagnostic diagnostic = analyzeResourceProblems(resource, null); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, diagnostic); + } + else { + resourceToDiagnosticMap.remove(resource); + } + + if (updateProblemIndication) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + updateProblemIndication(); + } + }); + } + break; + } + } + } + else { + super.notifyChanged(notification); + } + } + + @Override + protected void setTarget(Resource target) { + basicSetTarget(target); + } + + @Override + protected void unsetTarget(Resource target) { + basicUnsetTarget(target); + } + }; + + /** + * This listens for workspace changes. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IResourceChangeListener resourceChangeListener = + new IResourceChangeListener() { + @Override + public void resourceChanged(IResourceChangeEvent event) { + IResourceDelta delta = event.getDelta(); + try { + class ResourceDeltaVisitor implements IResourceDeltaVisitor { + protected ResourceSet resourceSet = editingDomain.getResourceSet(); + protected Collection<Resource> changedResources = new ArrayList<Resource>(); + protected Collection<Resource> removedResources = new ArrayList<Resource>(); + + @Override + public boolean visit(IResourceDelta delta) { + if (delta.getResource().getType() == IResource.FILE) { + if (delta.getKind() == IResourceDelta.REMOVED || + delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) { + Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false); + if (resource != null) { + if (delta.getKind() == IResourceDelta.REMOVED) { + removedResources.add(resource); + } + else if (!savedResources.remove(resource)) { + changedResources.add(resource); + } + } + } + } + + return true; + } + + public Collection<Resource> getChangedResources() { + return changedResources; + } + + public Collection<Resource> getRemovedResources() { + return removedResources; + } + } + + final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); + delta.accept(visitor); + + if (!visitor.getRemovedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + removedResources.addAll(visitor.getRemovedResources()); + if (!isDirty()) { + getSite().getPage().closeEditor(ConstraintsEditor.this, false); + } + } + }); + } + + if (!visitor.getChangedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + changedResources.addAll(visitor.getChangedResources()); + if (getSite().getPage().getActiveEditor() == ConstraintsEditor.this) { + handleActivate(); + } + } + }); + } + } + catch (CoreException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * Handles activation of the editor or it's associated views. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void handleActivate() { + // Recompute the read only state. + // + if (editingDomain.getResourceToReadOnlyMap() != null) { + editingDomain.getResourceToReadOnlyMap().clear(); + + // Refresh any actions that may become enabled or disabled. + // + setSelection(getSelection()); + } + + if (!removedResources.isEmpty()) { + if (handleDirtyConflict()) { + getSite().getPage().closeEditor(ConstraintsEditor.this, false); + } + else { + removedResources.clear(); + changedResources.clear(); + savedResources.clear(); + } + } + else if (!changedResources.isEmpty()) { + changedResources.removeAll(savedResources); + handleChangedResources(); + changedResources.clear(); + savedResources.clear(); + } + } + + /** + * Handles what to do with changed resources on activation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void handleChangedResources() { + if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) { + if (isDirty()) { + changedResources.addAll(editingDomain.getResourceSet().getResources()); + } + editingDomain.getCommandStack().flush(); + + updateProblemIndication = false; + for (Resource resource : changedResources) { + if (resource.isLoaded()) { + resource.unload(); + try { + resource.load(Collections.EMPTY_MAP); + } catch (IOException exception) { + if (!resourceToDiagnosticMap.containsKey(resource)) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + } + } + } + + if (AdapterFactoryEditingDomain.isStale(editorSelection)) { + setSelection(StructuredSelection.EMPTY); + } + + updateProblemIndication = true; + updateProblemIndication(); + } + } + + /** + * Updates the problems indication with the information described in the specified diagnostic. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void updateProblemIndication() { + if (updateProblemIndication) { + BasicDiagnostic diagnostic = + new BasicDiagnostic + (Diagnostic.OK, + "org.eclipse.papyrus.infra.constraints.editor", + 0, + null, + new Object[] { editingDomain.getResourceSet() }); + for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) { + if (childDiagnostic.getSeverity() != Diagnostic.OK) { + diagnostic.add(childDiagnostic); + } + } + + int lastEditorPage = getPageCount() - 1; + if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) { + ((ProblemEditorPart) getEditor(lastEditorPage)).setDiagnostic(diagnostic); + if (diagnostic.getSeverity() != Diagnostic.OK) { + setActivePage(lastEditorPage); + } + } + else if (diagnostic.getSeverity() != Diagnostic.OK) { + ProblemEditorPart problemEditorPart = new ProblemEditorPart(); + problemEditorPart.setDiagnostic(diagnostic); + problemEditorPart.setMarkerHelper(markerHelper); + try { + addPage(++lastEditorPage, problemEditorPart, getEditorInput()); + setPageText(lastEditorPage, problemEditorPart.getPartName()); + setActivePage(lastEditorPage); + showTabs(); + } catch (PartInitException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + + if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { + markerHelper.deleteMarkers(editingDomain.getResourceSet()); + if (diagnostic.getSeverity() != Diagnostic.OK) { + try { + markerHelper.createMarkers(diagnostic); + } catch (CoreException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + } + } + } + + /** + * Shows a dialog that asks if conflicting changes should be discarded. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean handleDirtyConflict() { + return MessageDialog.openQuestion + (getSite().getShell(), + getString("_UI_FileConflict_label"), + getString("_WARN_FileConflict")); + } + + /** + * This creates a model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsEditor() { + super(); + initializeEditingDomain(); + } + + /** + * This sets up the editing domain for the model editor. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void initializeEditingDomain() { + // Create an adapter factory that yields item providers. + // + adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); + + adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new ConstraintsItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new EnvironmentItemProviderAdapterFactory()); + adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory()); + + // Create the command stack that will notify this editor as commands are executed. + // + BasicCommandStack commandStack = new BasicCommandStack(); + + // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus. + // + commandStack.addCommandStackListener + (new CommandStackListener() { + @Override + public void commandStackChanged(final EventObject event) { + getContainer().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + firePropertyChange(IEditorPart.PROP_DIRTY); + + // Try to select the affected objects. + // + Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand(); + if (mostRecentCommand != null) { + setSelectionToViewer(mostRecentCommand.getAffectedObjects()); + } + if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { + propertySheetPage.refresh(); + } + } + }); + } + }); + + // Create the editing domain with a special command stack. + // + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>()); + } + + /** + * This is here for the listener to be able to call it. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void firePropertyChange(int action) { + super.firePropertyChange(action); + } + + /** + * This sets the selection into whichever viewer is active. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setSelectionToViewer(Collection<?> collection) { + final Collection<?> theSelection = collection; + // Make sure it's okay. + // + if (theSelection != null && !theSelection.isEmpty()) { + Runnable runnable = + new Runnable() { + @Override + public void run() { + // Try to select the items in the current content viewer of the editor. + // + if (currentViewer != null) { + currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true); + } + } + }; + getSite().getShell().getDisplay().asyncExec(runnable); + } + } + + /** + * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. + * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain} and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public EditingDomain getEditingDomain() { + return editingDomain; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object[] getElements(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object[] getChildren(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean hasChildren(Object object) { + Object parent = super.getParent(object); + return parent != null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object getParent(Object object) { + return null; + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setCurrentViewerPane(ViewerPane viewerPane) { + if (currentViewerPane != viewerPane) { + if (currentViewerPane != null) { + currentViewerPane.showFocus(false); + } + currentViewerPane = viewerPane; + } + setCurrentViewer(currentViewerPane.getViewer()); + } + + /** + * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, + * is the current one. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setCurrentViewer(Viewer viewer) { + // If it is changing... + // + if (currentViewer != viewer) { + if (selectionChangedListener == null) { + // Create the listener on demand. + // + selectionChangedListener = + new ISelectionChangedListener() { + // This just notifies those things that are affected by the section. + // + @Override + public void selectionChanged(SelectionChangedEvent selectionChangedEvent) { + setSelection(selectionChangedEvent.getSelection()); + } + }; + } + + // Stop listening to the old one. + // + if (currentViewer != null) { + currentViewer.removeSelectionChangedListener(selectionChangedListener); + } + + // Start listening to the new one. + // + if (viewer != null) { + viewer.addSelectionChangedListener(selectionChangedListener); + } + + // Remember it. + // + currentViewer = viewer; + + // Set the editors selection based on the current viewer's selection. + // + setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection()); + } + } + + /** + * This returns the viewer as required by the {@link IViewerProvider} interface. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Viewer getViewer() { + return currentViewer; + } + + /** + * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void createContextMenuFor(StructuredViewer viewer) { + MenuManager contextMenu = new MenuManager("#PopUp"); + contextMenu.add(new Separator("additions")); + contextMenu.setRemoveAllWhenShown(true); + contextMenu.addMenuListener(this); + Menu menu = contextMenu.createContextMenu(viewer.getControl()); + viewer.getControl().setMenu(menu); + getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); + + int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; + viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); + viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); + } + + /** + * This is the method called to load a resource into the editing domain's resource set based on the editor's input. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void createModel() { + URI resourceURI = EditUIUtil.getURI(getEditorInput()); + Exception exception = null; + Resource resource = null; + try { + // Load the resource through the editing domain. + // + resource = editingDomain.getResourceSet().getResource(resourceURI, true); + } catch (Exception e) { + exception = e; + resource = editingDomain.getResourceSet().getResource(resourceURI, false); + } + + Diagnostic diagnostic = analyzeResourceProblems(resource, exception); + if (diagnostic.getSeverity() != Diagnostic.OK) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); + } + + /** + * Returns a diagnostic describing the errors and warnings listed in the resource + * and the specified exception (if any). + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { + if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) { + BasicDiagnostic basicDiagnostic = + new BasicDiagnostic + (Diagnostic.ERROR, + "org.eclipse.papyrus.infra.constraints.editor", + 0, + getString("_UI_CreateModelError_message", resource.getURI()), + new Object[] { exception == null ? (Object) resource : exception }); + basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); + return basicDiagnostic; + } + else if (exception != null) { + return new BasicDiagnostic(Diagnostic.ERROR, + "org.eclipse.papyrus.infra.constraints.editor", + 0, + getString("_UI_CreateModelError_message", resource.getURI()), + new Object[] { exception }); + } + else { + return Diagnostic.OK_INSTANCE; + } + } + + /** + * This is the method used by the framework to install your own controls. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void createPages() { + // Creates the model from the editor input + // + createModel(); + + // Only creates the other pages if there is something that can be edited + // + if (!getEditingDomain().getResourceSet().getResources().isEmpty()) { + // Create a page for the selection tree view. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), ConstraintsEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + selectionViewer = (TreeViewer) viewerPane.getViewer(); + selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + + selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + selectionViewer.setInput(editingDomain.getResourceSet()); + selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + viewerPane.setTitle(editingDomain.getResourceSet()); + + new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory); + + createContextMenuFor(selectionViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_SelectionPage_label")); + } + + // Create a page for the parent tree view. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), ConstraintsEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + Tree tree = new Tree(composite, SWT.MULTI); + TreeViewer newTreeViewer = new TreeViewer(tree); + return newTreeViewer; + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + parentViewer = (TreeViewer) viewerPane.getViewer(); + parentViewer.setAutoExpandLevel(30); + parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory)); + parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(parentViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ParentPage_label")); + } + + // This is the page for the list viewer + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), ConstraintsEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new ListViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + listViewer = (ListViewer) viewerPane.getViewer(); + listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(listViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_ListPage_label")); + } + + // This is the page for the tree viewer + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), ConstraintsEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + treeViewer = (TreeViewer) viewerPane.getViewer(); + treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory); + + createContextMenuFor(treeViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreePage_label")); + } + + // This is the page for the table viewer. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), ConstraintsEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TableViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + tableViewer = (TableViewer) viewerPane.getViewer(); + + Table table = tableViewer.getTable(); + TableLayout layout = new TableLayout(); + table.setLayout(layout); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + TableColumn objectColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(3, 100, true)); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + + TableColumn selfColumn = new TableColumn(table, SWT.NONE); + layout.addColumnData(new ColumnWeightData(2, 100, true)); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + + tableViewer.setColumnProperties(new String[] { "a", "b" }); + tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(tableViewer); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TablePage_label")); + } + + // This is the page for the table tree viewer. + // + { + ViewerPane viewerPane = + new ViewerPane(getSite().getPage(), ConstraintsEditor.this) { + @Override + public Viewer createViewer(Composite composite) { + return new TreeViewer(composite); + } + + @Override + public void requestActivation() { + super.requestActivation(); + setCurrentViewerPane(this); + } + }; + viewerPane.createControl(getContainer()); + + treeViewerWithColumns = (TreeViewer) viewerPane.getViewer(); + + Tree tree = treeViewerWithColumns.getTree(); + tree.setLayoutData(new FillLayout()); + tree.setHeaderVisible(true); + tree.setLinesVisible(true); + + TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE); + objectColumn.setText(getString("_UI_ObjectColumn_label")); + objectColumn.setResizable(true); + objectColumn.setWidth(250); + + TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE); + selfColumn.setText(getString("_UI_SelfColumn_label")); + selfColumn.setResizable(true); + selfColumn.setWidth(200); + + treeViewerWithColumns.setColumnProperties(new String[] { "a", "b" }); + treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + + createContextMenuFor(treeViewerWithColumns); + int pageIndex = addPage(viewerPane.getControl()); + setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label")); + } + + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + setActivePage(0); + } + }); + } + + // Ensures that this editor will only display the page's tab + // area if there are more than one page + // + getContainer().addControlListener + (new ControlAdapter() { + boolean guard = false; + + @Override + public void controlResized(ControlEvent event) { + if (!guard) { + guard = true; + hideTabs(); + guard = false; + } + } + }); + + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + updateProblemIndication(); + } + }); + } + + /** + * If there is just one page in the multi-page editor part, + * this hides the single tab at the bottom. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void hideTabs() { + if (getPageCount() <= 1) { + setPageText(0, ""); + if (getContainer() instanceof CTabFolder) { + ((CTabFolder) getContainer()).setTabHeight(1); + Point point = getContainer().getSize(); + getContainer().setSize(point.x, point.y + 6); + } + } + } + + /** + * If there is more than one page in the multi-page editor part, + * this shows the tabs at the bottom. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void showTabs() { + if (getPageCount() > 1) { + setPageText(0, getString("_UI_SelectionPage_label")); + if (getContainer() instanceof CTabFolder) { + ((CTabFolder) getContainer()).setTabHeight(SWT.DEFAULT); + Point point = getContainer().getSize(); + getContainer().setSize(point.x, point.y - 6); + } + } + } + + /** + * This is used to track the active viewer. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected void pageChange(int pageIndex) { + super.pageChange(pageIndex); + + if (contentOutlinePage != null) { + handleContentOutlineSelection(contentOutlinePage.getSelection()); + } + } + + /** + * This is how the framework determines which interfaces we implement. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("rawtypes") + @Override + public Object getAdapter(Class key) { + if (key.equals(IContentOutlinePage.class)) { + return showOutlineView() ? getContentOutlinePage() : null; + } + else if (key.equals(IPropertySheetPage.class)) { + return getPropertySheetPage(); + } + else if (key.equals(IGotoMarker.class)) { + return this; + } + else { + return super.getAdapter(key); + } + } + + /** + * This accesses a cached version of the content outliner. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IContentOutlinePage getContentOutlinePage() { + if (contentOutlinePage == null) { + // The content outline is just a tree. + // + class MyContentOutlinePage extends ContentOutlinePage { + @Override + public void createControl(Composite parent) { + super.createControl(parent); + contentOutlineViewer = getTreeViewer(); + contentOutlineViewer.addSelectionChangedListener(this); + + // Set up the tree viewer. + // + contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory)); + contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory)); + contentOutlineViewer.setInput(editingDomain.getResourceSet()); + + // Make sure our popups work. + // + createContextMenuFor(contentOutlineViewer); + + if (!editingDomain.getResourceSet().getResources().isEmpty()) { + // Select the root object in the view. + // + contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true); + } + } + + @Override + public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { + super.makeContributions(menuManager, toolBarManager, statusLineManager); + contentOutlineStatusLineManager = statusLineManager; + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + } + + contentOutlinePage = new MyContentOutlinePage(); + + // Listen to selection so that we can handle it is a special way. + // + contentOutlinePage.addSelectionChangedListener + (new ISelectionChangedListener() { + // This ensures that we handle selections correctly. + // + @Override + public void selectionChanged(SelectionChangedEvent event) { + handleContentOutlineSelection(event.getSelection()); + } + }); + } + + return contentOutlinePage; + } + + /** + * This accesses a cached version of the property sheet. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IPropertySheetPage getPropertySheetPage() { + if (propertySheetPage == null) { + propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List<?> selection) { + ConstraintsEditor.this.setSelectionToViewer(selection); + ConstraintsEditor.this.setFocus(); + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + } + + return propertySheetPage; + } + + /** + * This deals with how we want selection in the outliner to affect the other views. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void handleContentOutlineSelection(ISelection selection) { + if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + Iterator<?> selectedElements = ((IStructuredSelection) selection).iterator(); + if (selectedElements.hasNext()) { + // Get the first selected element. + // + Object selectedElement = selectedElements.next(); + + // If it's the selection viewer, then we want it to select the same selection as this selection. + // + if (currentViewerPane.getViewer() == selectionViewer) { + ArrayList<Object> selectionList = new ArrayList<Object>(); + selectionList.add(selectedElement); + while (selectedElements.hasNext()) { + selectionList.add(selectedElements.next()); + } + + // Set the selection to the widget. + // + selectionViewer.setSelection(new StructuredSelection(selectionList)); + } + else { + // Set the input to the widget. + // + if (currentViewerPane.getViewer().getInput() != selectedElement) { + currentViewerPane.getViewer().setInput(selectedElement); + currentViewerPane.setTitle(selectedElement); + } + } + } + } + } + + /** + * This is for implementing {@link IEditorPart} and simply tests the command stack. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean isDirty() { + return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded(); + } + + /** + * This is for implementing {@link IEditorPart} and simply saves the model file. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void doSave(IProgressMonitor progressMonitor) { + // Save only resources that have actually changed. + // + final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); + saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); + + // Do the work within an operation because this is a long running activity that modifies the workbench. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + // This is the method that gets invoked when the operation runs. + // + @Override + public void execute(IProgressMonitor monitor) { + // Save the resources to the file system. + // + boolean first = true; + for (Resource resource : editingDomain.getResourceSet().getResources()) { + if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) { + try { + long timeStamp = resource.getTimeStamp(); + resource.save(saveOptions); + if (resource.getTimeStamp() != timeStamp) { + savedResources.add(resource); + } + } + catch (Exception exception) { + resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); + } + first = false; + } + } + } + }; + + updateProblemIndication = false; + try { + // This runs the options, and shows progress. + // + new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation); + + // Refresh the necessary state. + // + ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone(); + firePropertyChange(IEditorPart.PROP_DIRTY); + } catch (Exception exception) { + // Something went wrong that shouldn't. + // + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + updateProblemIndication = true; + updateProblemIndication(); + } + + /** + * This returns whether something has been persisted to the URI of the specified resource. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean isPersisted(Resource resource) { + boolean result = false; + try { + InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI()); + if (stream != null) { + result = true; + stream.close(); + } + } catch (IOException e) { + // Ignore + } + return result; + } + + /** + * This always returns true because it is not currently supported. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * This also changes the editor's input. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void doSaveAs() { + SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell()); + saveAsDialog.open(); + IPath path = saveAsDialog.getResult(); + if (path != null) { + IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + if (file != null) { + doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file)); + } + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected void doSaveAs(URI uri, IEditorInput editorInput) { + (editingDomain.getResourceSet().getResources().get(0)).setURI(uri); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + IProgressMonitor progressMonitor = + getActionBars().getStatusLineManager() != null ? + getActionBars().getStatusLineManager().getProgressMonitor() : + new NullProgressMonitor(); + doSave(progressMonitor); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void gotoMarker(IMarker marker) { + try { + if (marker.getType().equals(EValidator.MARKER)) { + String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); + if (uriAttribute != null) { + URI uri = URI.createURI(uriAttribute); + EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); + if (eObject != null) { + setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); + } + } + } + } catch (CoreException exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + } + + /** + * This is called during startup. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void init(IEditorSite site, IEditorInput editorInput) { + setSite(site); + setInputWithNotify(editorInput); + setPartName(editorInput.getName()); + site.setSelectionProvider(this); + site.getPage().addPartListener(partListener); + ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setFocus() { + if (currentViewerPane != null) { + currentViewerPane.setFocus(); + } + else { + getControl(getActivePage()).setFocus(); + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void addSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.add(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.remove(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public ISelection getSelection() { + return editorSelection; + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection. + * Calling this result will notify the listeners. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setSelection(ISelection selection) { + editorSelection = selection; + + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + setStatusLineManager(selection); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setStatusLineManager(ISelection selection) { + IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? + contentOutlineStatusLineManager : getActionBars().getStatusLineManager(); + + if (statusLineManager != null) { + if (selection instanceof IStructuredSelection) { + Collection<?> collection = ((IStructuredSelection) selection).toList(); + switch (collection.size()) { + case 0: { + statusLineManager.setMessage(getString("_UI_NoObjectSelected")); + break; + } + case 1: { + String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next()); + statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); + break; + } + default: { + statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); + break; + } + } + } + else { + statusLineManager.setMessage(""); + } + } + } + + /** + * This looks up a string in the plugin's plugin.properties file. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static String getString(String key) { + return ConstraintsEditorPlugin.INSTANCE.getString(key); + } + + /** + * This looks up a string in plugin.properties, making a substitution. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static String getString(String key, Object s1) { + return ConstraintsEditorPlugin.INSTANCE.getString(key, new Object[] { s1 }); + } + + /** + * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + ((IMenuListener) getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EditingDomainActionBarContributor getActionBarContributor() { + return (EditingDomainActionBarContributor) getEditorSite().getActionBarContributor(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IActionBars getActionBars() { + return getActionBarContributor().getActionBars(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public AdapterFactory getAdapterFactory() { + return adapterFactory; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void dispose() { + updateProblemIndication = false; + + ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); + + getSite().getPage().removePartListener(partListener); + + adapterFactory.dispose(); + + if (getActionBarContributor().getActiveEditor() == this) { + getActionBarContributor().setActiveEditor(null); + } + + if (propertySheetPage != null) { + propertySheetPage.dispose(); + } + + if (contentOutlinePage != null) { + contentOutlinePage.dispose(); + } + + super.dispose(); + } + + /** + * Returns whether the outline view should be presented to the user. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean showOutlineView() { + return true; + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsEditorPlugin.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsEditorPlugin.java new file mode 100644 index 00000000000..c48db1cc9cb --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsEditorPlugin.java @@ -0,0 +1,100 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.presentation; + +import org.eclipse.emf.common.EMFPlugin; +import org.eclipse.emf.common.ui.EclipseUIPlugin; +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Constraints editor plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public final class ConstraintsEditorPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static final ConstraintsEditorPlugin INSTANCE = new ConstraintsEditorPlugin(); + + /** + * Keep track of the singleton. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsEditorPlugin() { + super(new ResourceLocator[] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse <b>Plugin</b>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static class Implementation extends EclipseUIPlugin { + /** + * Creates an instance. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsModelWizard.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsModelWizard.java new file mode 100644 index 00000000000..30e53746847 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.editor/src-gen/org/eclipse/papyrus/infra/constraints/presentation/ConstraintsModelWizard.java @@ -0,0 +1,640 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.presentation; + + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.MissingResourceException; +import java.util.StringTokenizer; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.emf.common.CommonPlugin; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EClassifier; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.papyrus.infra.constraints.ConstraintsFactory; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.provider.ConstraintsEditPlugin; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +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.Label; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.dialogs.WizardNewFileCreationPage; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; + + +/** + * This is a simple wizard for creating a new model file. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintsModelWizard extends Wizard implements INewWizard { + /** + * The supported extensions for created files. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static final List<String> FILE_EXTENSIONS = + Collections.unmodifiableList(Arrays.asList(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsEditorFilenameExtensions").split("\\s*,\\s*"))); + + /** + * A formatted list of supported file extensions, suitable for display. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static final String FORMATTED_FILE_EXTENSIONS = + ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); + + /** + * This caches an instance of the model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintsPackage constraintsPackage = ConstraintsPackage.eINSTANCE; + + /** + * This caches an instance of the model factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintsFactory constraintsFactory = constraintsPackage.getConstraintsFactory(); + + /** + * This is the file creation page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintsModelWizardNewFileCreationPage newFileCreationPage; + + /** + * This is the initial object creation page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintsModelWizardInitialObjectCreationPage initialObjectCreationPage; + + /** + * Remember the selection during initialization for populating the default container. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IStructuredSelection selection; + + /** + * Remember the workbench during initialization. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected IWorkbench workbench; + + /** + * Caches the names of the types that can be created as the root object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected List<String> initialObjectNames; + + /** + * This just records the information. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + setWindowTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); + setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ConstraintsEditorPlugin.INSTANCE.getImage("full/wizban/NewConstraints"))); + } + + /** + * Returns the names of the types that can be created as the root object. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<String> getInitialObjectNames() { + if (initialObjectNames == null) { + initialObjectNames = new ArrayList<String>(); + for (EClassifier eClassifier : constraintsPackage.getEClassifiers()) { + if (eClassifier instanceof EClass) { + EClass eClass = (EClass) eClassifier; + if (!eClass.isAbstract()) { + initialObjectNames.add(eClass.getName()); + } + } + } + Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); + } + return initialObjectNames; + } + + /** + * Create a new model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EObject createInitialModel() { + EClass eClass = (EClass) constraintsPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); + EObject rootObject = constraintsFactory.create(eClass); + return rootObject; + } + + /** + * Do the work after everything is specified. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean performFinish() { + try { + // Remember the file. + // + final IFile modelFile = getModelFile(); + + // Do the work within an operation. + // + WorkspaceModifyOperation operation = + new WorkspaceModifyOperation() { + @Override + protected void execute(IProgressMonitor progressMonitor) { + try { + // Create a resource set + // + ResourceSet resourceSet = new ResourceSetImpl(); + + // Get the URI of the model file. + // + URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); + + // Create a resource for this file. + // + Resource resource = resourceSet.createResource(fileURI); + + // Add the initial model object to the contents. + // + EObject rootObject = createInitialModel(); + if (rootObject != null) { + resource.getContents().add(rootObject); + } + + // Save the contents of the resource to the file system. + // + Map<Object, Object> options = new HashMap<Object, Object>(); + options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); + resource.save(options); + } + catch (Exception exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + } + finally { + progressMonitor.done(); + } + } + }; + + getContainer().run(false, false, operation); + + // Select the new file resource in the current view. + // + IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = workbenchWindow.getActivePage(); + final IWorkbenchPart activePart = page.getActivePart(); + if (activePart instanceof ISetSelectionTarget) { + final ISelection targetSelection = new StructuredSelection(modelFile); + getShell().getDisplay().asyncExec + (new Runnable() { + @Override + public void run() { + ((ISetSelectionTarget) activePart).selectReveal(targetSelection); + } + }); + } + + // Open an editor on the new file. + // + try { + page.openEditor + (new FileEditorInput(modelFile), + workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); + } catch (PartInitException exception) { + MessageDialog.openError(workbenchWindow.getShell(), ConstraintsEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); + return false; + } + + return true; + } catch (Exception exception) { + ConstraintsEditorPlugin.INSTANCE.log(exception); + return false; + } + } + + /** + * This is the one page of the wizard. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public class ConstraintsModelWizardNewFileCreationPage extends WizardNewFileCreationPage { + /** + * Pass in the selection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { + super(pageId, selection); + } + + /** + * The framework calls this to see if the file is correct. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected boolean validatePage() { + if (super.validatePage()) { + String extension = new Path(getFileName()).getFileExtension(); + if (extension == null || !FILE_EXTENSIONS.contains(extension)) { + String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; + setErrorMessage(ConstraintsEditorPlugin.INSTANCE.getString(key, new Object[] { FORMATTED_FILE_EXTENSIONS })); + return false; + } + return true; + } + return false; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IFile getModelFile() { + return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); + } + } + + /** + * This is the page where the type of object to create is selected. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public class ConstraintsModelWizardInitialObjectCreationPage extends WizardPage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Combo initialObjectField; + + /** + * @generated + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + */ + protected List<String> encodings; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Combo encodingField; + + /** + * Pass in the selection. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsModelWizardInitialObjectCreationPage(String pageId) { + super(pageId); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + { + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + layout.verticalSpacing = 12; + composite.setLayout(layout); + + GridData data = new GridData(); + data.verticalAlignment = GridData.FILL; + data.grabExcessVerticalSpace = true; + data.horizontalAlignment = GridData.FILL; + composite.setLayoutData(data); + } + + Label containerLabel = new Label(composite, SWT.LEFT); + { + containerLabel.setText(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ModelObject")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + containerLabel.setLayoutData(data); + } + + initialObjectField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + initialObjectField.setLayoutData(data); + } + + for (String objectName : getInitialObjectNames()) { + initialObjectField.add(getLabel(objectName)); + } + + if (initialObjectField.getItemCount() == 1) { + initialObjectField.select(0); + } + initialObjectField.addModifyListener(validator); + + Label encodingLabel = new Label(composite, SWT.LEFT); + { + encodingLabel.setText(ConstraintsEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); + + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + encodingLabel.setLayoutData(data); + } + encodingField = new Combo(composite, SWT.BORDER); + { + GridData data = new GridData(); + data.horizontalAlignment = GridData.FILL; + data.grabExcessHorizontalSpace = true; + encodingField.setLayoutData(data); + } + + for (String encoding : getEncodings()) { + encodingField.add(encoding); + } + + encodingField.select(0); + encodingField.addModifyListener(validator); + + setPageComplete(validatePage()); + setControl(composite); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ModifyListener validator = + new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + setPageComplete(validatePage()); + } + }; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected boolean validatePage() { + return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + if (initialObjectField.getItemCount() == 1) { + initialObjectField.clearSelection(); + encodingField.setFocus(); + } + else { + encodingField.clearSelection(); + initialObjectField.setFocus(); + } + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getInitialObjectName() { + String label = initialObjectField.getText(); + + for (String name : getInitialObjectNames()) { + if (getLabel(name).equals(label)) { + return name; + } + } + return null; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getEncoding() { + return encodingField.getText(); + } + + /** + * Returns the label for the specified type name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected String getLabel(String typeName) { + try { + return ConstraintsEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); + } catch (MissingResourceException mre) { + ConstraintsEditorPlugin.INSTANCE.log(mre); + } + return typeName; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected Collection<String> getEncodings() { + if (encodings == null) { + encodings = new ArrayList<String>(); + for (StringTokenizer stringTokenizer = new StringTokenizer(ConstraintsEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();) { + encodings.add(stringTokenizer.nextToken()); + } + } + return encodings; + } + } + + /** + * The framework calls this to create the contents of the wizard. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void addPages() { + // Create a page, set the title, and the initial model file name. + // + newFileCreationPage = new ConstraintsModelWizardNewFileCreationPage("Whatever", selection); + newFileCreationPage.setTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsModelWizard_label")); + newFileCreationPage.setDescription(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsModelWizard_description")); + newFileCreationPage.setFileName(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); + addPage(newFileCreationPage); + + // Try and get the resource selection to determine a current directory for the file dialog. + // + if (selection != null && !selection.isEmpty()) { + // Get the resource... + // + Object selectedElement = selection.iterator().next(); + if (selectedElement instanceof IResource) { + // Get the resource parent, if its a file. + // + IResource selectedResource = (IResource) selectedElement; + if (selectedResource.getType() == IResource.FILE) { + selectedResource = selectedResource.getParent(); + } + + // This gives us a directory... + // + if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { + // Set this for the container. + // + newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); + + // Make up a unique new name here. + // + String defaultModelBaseFilename = ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsEditorFilenameDefaultBase"); + String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); + String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; + for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) { + modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; + } + newFileCreationPage.setFileName(modelFilename); + } + } + } + initialObjectCreationPage = new ConstraintsModelWizardInitialObjectCreationPage("Whatever2"); + initialObjectCreationPage.setTitle(ConstraintsEditorPlugin.INSTANCE.getString("_UI_ConstraintsModelWizard_label")); + initialObjectCreationPage.setDescription(ConstraintsEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); + addPage(initialObjectCreationPage); + } + + /** + * Get the file from the page. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public IFile getModelFile() { + return newFileCreationPage.getModelFile(); + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.classpath b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.project b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.project new file mode 100644 index 00000000000..504fa7b2052 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.project @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.infra.constraints.ui</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.papyrus.emf.facet.common.ProjectNature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..b3aa6d60f94 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/META-INF/MANIFEST.MF b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..9406211cf94 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.infra.constraints.internal.ui, + org.eclipse.papyrus.infra.constraints.ui.providers +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui;bundle-version="3.100.0", + org.eclipse.papyrus.infra.constraints;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0" +Bundle-Vendor: %providerName +Bundle-Version: 1.2.0.qualifier +Eclipse-BuddyPolicy: dependent +Bundle-Activator: org.eclipse.papyrus.infra.constraints.internal.ui.Activator +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.infra.constraints.ui;singleton:=true diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/about.html b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/about.html new file mode 100644 index 00000000000..d35d5aed64c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("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/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/build.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/build.properties new file mode 100644 index 00000000000..41aa4bbad6a --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/build.properties @@ -0,0 +1,21 @@ +# +# Copyright (c) 2016 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 +# + +bin.includes = .,\ + META-INF/,\ + plugin.properties,\ + about.html,\ + custom/ +output.. = bin/ +jars.compile.order = . +source.. = src/ +src.includes = about.html diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/custom/constraints.uiCustom b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/custom/constraints.uiCustom new file mode 100644 index 00000000000..60ae64f34ea --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/custom/constraints.uiCustom @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="ASCII"?> +<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/papyrus/constraints/0.9"> + <types metaclassName="constraints.CompositeConstraint"> + <references referenceName="constraints"> + <customizedFeatures> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/> + </customizedFeatures> + </references> + </types> + <types metaclassName="constraints.SimpleConstraint"> + <references referenceName="constraintType"> + <customizedFeatures> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/> + </customizedFeatures> + </references> + <references referenceName="properties"> + <customizedFeatures> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/> + </customizedFeatures> + </references> + </types> + <types metaclassName="constraints.ConstraintDescriptor"> + <references referenceName="display"> + <customizedFeatures> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/> + </customizedFeatures> + </references> + <references referenceName="overriddenConstraints"> + <customizedFeatures> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/> + </customizedFeatures> + </references> + </types> + <types metaclassName="constraints.DisplayUnit"> + <references referenceName="constraints"> + <customizedFeatures customizedFeature="collapseLink"> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/> + </customizedFeatures> + </references> + </types> + <types metaclassName="constraints.environment.ConstraintEnvironment"> + <references referenceName="constraintTypes"> + <customizedFeatures customizedFeature="collapseLink"> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/> + </customizedFeatures> + </references> + </types> + <types metaclassName="constraints.ReferenceProperty"> + <references referenceName="value"> + <customizedFeatures> + <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/> + </customizedFeatures> + </references> + </types> +</uicustom:MetamodelView> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/plugin.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/plugin.properties new file mode 100644 index 00000000000..182bbe58da4 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/plugin.properties @@ -0,0 +1,14 @@ +# +# Copyright (c) 2016 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 +# + +pluginName = Papyrus Constraints UI +providerName = Eclipse Modeling Project diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/pom.xml b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/pom.xml new file mode 100644 index 00000000000..389b28e37b7 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.infra-constraints</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.infra.constraints.ui</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/src/org/eclipse/papyrus/infra/constraints/internal/ui/Activator.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/src/org/eclipse/papyrus/infra/constraints/internal/ui/Activator.java new file mode 100644 index 00000000000..f9a4610bfff --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/src/org/eclipse/papyrus/infra/constraints/internal/ui/Activator.java @@ -0,0 +1,66 @@ +/***************************************************************************** + * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.internal.ui; + +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID + */ + public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.constraints.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The plug-in's logger + */ + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/src/org/eclipse/papyrus/infra/constraints/ui/providers/ConstraintTypeContentProvider.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/src/org/eclipse/papyrus/infra/constraints/ui/providers/ConstraintTypeContentProvider.java new file mode 100644 index 00000000000..518d2ce339e --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints.ui/src/org/eclipse/papyrus/infra/constraints/ui/providers/ConstraintTypeContentProvider.java @@ -0,0 +1,37 @@ +/***************************************************************************** + * Copyright (c) 2014, 2016 CEA LIST, Christian W. Damus, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) - Initial API and implementation + * Christian W. Damus - bug 485220 + * + /*****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.ui.providers; + +import org.eclipse.papyrus.infra.constraints.runtime.ConstraintsManager; +import org.eclipse.papyrus.infra.widgets.providers.AbstractFilteredContentProvider; +import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider; + +/** + * A ContentProvider which returns Constraint types + * + * + * @author Camille Letavernier + */ +public class ConstraintTypeContentProvider extends AbstractFilteredContentProvider implements IStaticContentProvider { + + @Override + public Object[] getElements() { + return ConstraintsManager.instance.getConstraintTypes().toArray(); + } + + @Override + public Object[] getElements(Object inputElement) { + return getElements(); + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.classpath b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.classpath new file mode 100644 index 00000000000..50aae142c50 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.classpath @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src-gen"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.project b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.project new file mode 100644 index 00000000000..b25074f0f42 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.project @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.infra.constraints</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.papyrus.emf.facet.common.ProjectNature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..b3aa6d60f94 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,291 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..954281dbc31 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,68 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.correct_indentation=false +cleanup.format_source_code=false +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false +cleanup_profile=_Papyrus +cleanup_settings_version=2 +eclipse.preferences.version=1 +formatter_profile=_Papyrus +formatter_settings_version=12 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.ondemandthreshold=99 +org.eclipse.jdt.ui.staticondemandthreshold=99 +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..570db921afc --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.infra.constraints, + org.eclipse.papyrus.infra.constraints.constraints, + org.eclipse.papyrus.infra.constraints.environment, + org.eclipse.papyrus.infra.constraints.environment.impl, + org.eclipse.papyrus.infra.constraints.environment.util, + org.eclipse.papyrus.infra.constraints.impl, + org.eclipse.papyrus.infra.constraints.runtime, + org.eclipse.papyrus.infra.constraints.util +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore, + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.2.0", + org.eclipse.papyrus.infra.tools;bundle-version="1.2.0";visibility:=reexport +Bundle-Vendor: %providerName +Bundle-Version: 1.2.0.qualifier +Eclipse-BuddyPolicy: dependent +Bundle-Activator: org.eclipse.papyrus.infra.constraints.Activator +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.infra.constraints;singleton:=true diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi new file mode 100644 index 00000000000..1993d832196 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="ASCII"?> +<environment:ConstraintEnvironment + xmi:version="2.0" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:environment="http://www.eclipse.org/papyrus/constraints/environment/0.9"> + <constraintTypes + label="EMF Instance Of" + constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint"/> + <constraintTypes + label="True constraint" + constraintClass="org.eclipse.papyrus.infra.constraints.constraints.TrueConstraint"/> + <constraintTypes + label="EMF Query" + constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint"/> + <constraintTypes + label="Java Instance Of" + constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaInstanceOf"/> + <constraintTypes + label="Java Query" + constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaQueryConstraint"/> + <constraintTypes + label="Has EAnnotation" + constraintClass="org.eclipse.papyrus.infra.constraints.constraints.HasEAnnotationConstraint"/> + <constraintTypes + label="Attached to Resource" + constraintClass="org.eclipse.papyrus.infra.constraints.constraints.AttachedToResourceConstraint"/> +</environment:ConstraintEnvironment> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/Constraints.ecore b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/Constraints.ecore new file mode 100644 index 00000000000..9324eea80a8 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/Constraints.ecore @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="constraints" nsURI="http://www.eclipse.org/papyrus/constraints/0.9" + nsPrefix="constraints"> + <eClassifiers xsi:type="ecore:EClass" name="DisplayUnit" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EReference" name="constraints" upperBound="-1" + eType="#//ConstraintDescriptor" containment="true" eOpposite="#//ConstraintDescriptor/display"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="elementMultiplicity" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt" + defaultValueLiteral="1"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConstraintDescriptor" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="display" eType="#//DisplayUnit" + eOpposite="#//DisplayUnit/constraints"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="overrideable" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" defaultValueLiteral="true"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="overriddenConstraints" + upperBound="-1" eType="#//SimpleConstraint"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="SimpleConstraint" eSuperTypes="#//ConstraintDescriptor"> + <eStructuralFeatures xsi:type="ecore:EReference" name="constraintType" lowerBound="1" + eType="#//environment/ConstraintType"/> + <eStructuralFeatures xsi:type="ecore:EReference" name="properties" upperBound="-1" + eType="#//ConfigProperty" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="CompositeConstraint" eSuperTypes="#//ConstraintDescriptor"> + <eStructuralFeatures xsi:type="ecore:EReference" name="constraints" upperBound="-1" + eType="#//SimpleConstraint" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConfigProperty" abstract="true"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ValueProperty" eSuperTypes="#//ConfigProperty"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ReferenceProperty" eSuperTypes="#//ConfigProperty"> + <eStructuralFeatures xsi:type="ecore:EReference" name="value" lowerBound="1" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/> + </eClassifiers> + <eSubpackages name="environment" nsURI="http://www.eclipse.org/papyrus/constraints/environment/0.9" + nsPrefix="environment"> + <eClassifiers xsi:type="ecore:EClass" name="ConstraintEnvironment"> + <eStructuralFeatures xsi:type="ecore:EReference" name="constraintTypes" upperBound="-1" + eType="#//environment/ConstraintType" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="ConstraintType"> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + <eStructuralFeatures xsi:type="ecore:EAttribute" name="constraintClass" lowerBound="1" + eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> + </eClassifiers> + </eSubpackages> +</ecore:EPackage> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/Constraints.genmodel b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/Constraints.genmodel new file mode 100644 index 00000000000..47a9fc9acc1 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/Model/Constraints.genmodel @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" + xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.papyrus.infra.constraints/src-gen" + editDirectory="/org.eclipse.papyrus.infra.constraints.edit/src-gen" editorDirectory="/org.eclipse.papyrus.infra.constraints.editor/src-gen" + modelPluginID="org.eclipse.papyrus.infra.constraints" modelName="Constraints" + testsDirectory="/org.eclipse.papyrus.infra.constraints.tests/src-gen" importerID="org.eclipse.emf.importer.ecore" + complianceLevel="5.0" copyrightFields="false"> + <foreignModel>Constraints.ecore</foreignModel> + <genPackages prefix="Constraints" basePackage="org.eclipse.papyrus.infra" disposableProviderFactory="true" + ecorePackage="Constraints.ecore#/"> + <genClasses image="false" ecoreClass="Constraints.ecore#//DisplayUnit"> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Constraints.ecore#//DisplayUnit/constraints"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Constraints.ecore#//DisplayUnit/elementMultiplicity"/> + </genClasses> + <genClasses image="false" ecoreClass="Constraints.ecore#//ConstraintDescriptor"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Constraints.ecore#//ConstraintDescriptor/name"/> + <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference Constraints.ecore#//ConstraintDescriptor/display"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Constraints.ecore#//ConstraintDescriptor/overrideable"/> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Constraints.ecore#//ConstraintDescriptor/overriddenConstraints"/> + </genClasses> + <genClasses ecoreClass="Constraints.ecore#//SimpleConstraint"> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Constraints.ecore#//SimpleConstraint/constraintType"/> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Constraints.ecore#//SimpleConstraint/properties"/> + </genClasses> + <genClasses ecoreClass="Constraints.ecore#//CompositeConstraint"> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Constraints.ecore#//CompositeConstraint/constraints"/> + </genClasses> + <genClasses image="false" ecoreClass="Constraints.ecore#//ConfigProperty"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Constraints.ecore#//ConfigProperty/name"/> + </genClasses> + <genClasses ecoreClass="Constraints.ecore#//ValueProperty"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Constraints.ecore#//ValueProperty/value"/> + </genClasses> + <genClasses ecoreClass="Constraints.ecore#//ReferenceProperty"> + <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Constraints.ecore#//ReferenceProperty/value"/> + </genClasses> + <nestedGenPackages prefix="Environment" basePackage="org.eclipse.papyrus.infra.constraints" + disposableProviderFactory="true" ecorePackage="Constraints.ecore#//environment"> + <genClasses ecoreClass="Constraints.ecore#//environment/ConstraintEnvironment"> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Constraints.ecore#//environment/ConstraintEnvironment/constraintTypes"/> + </genClasses> + <genClasses ecoreClass="Constraints.ecore#//environment/ConstraintType"> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Constraints.ecore#//environment/ConstraintType/label"/> + <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Constraints.ecore#//environment/ConstraintType/constraintClass"/> + </genClasses> + </nestedGenPackages> + </genPackages> +</genmodel:GenModel> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/about.html b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/about.html new file mode 100644 index 00000000000..d35d5aed64c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("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/infra/constraints/org.eclipse.papyrus.infra.constraints/build.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/build.properties new file mode 100644 index 00000000000..b59c2f4e3b0 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/build.properties @@ -0,0 +1,12 @@ +bin.includes = .,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html,\ + Model/,\ + schema/ +output.. = bin/ +jars.compile.order = . +source.. = src-gen/,\ + src/ +src.includes = about.html diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/plugin.properties b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/plugin.properties new file mode 100644 index 00000000000..657ef7033b7 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/plugin.properties @@ -0,0 +1,8 @@ + +# <copyright> +# </copyright> +# +# $Id$ + +pluginName = Constraints model +providerName = Eclipse Modeling Project diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/plugin.xml b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/plugin.xml new file mode 100644 index 00000000000..d3639045d3f --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/plugin.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<?eclipse version="3.0"?> +<!-- + Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + Christian W. Damus - bug 485220 +--> +<plugin> + <extension-point id="ConstraintEnvironment" name="ConstraintEnvironment" schema="schema/ConstraintEnvironment.exsd"/> + + <extension point="org.eclipse.emf.ecore.generated_package"> + <package class="org.eclipse.papyrus.infra.constraints.ConstraintsPackage" genModel="Model/Constraints.genmodel" uri="http://www.eclipse.org/papyrus/constraints/0.9"/> + <package + class="org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage" + genModel="Model/Constraints.genmodel" + uri="http://www.eclipse.org/papyrus/constraints/environment/0.9"> + </package> + </extension> + + <extension + point="org.eclipse.papyrus.infra.constraints.ConstraintEnvironment"> + <environment + environmentModel="Model/ConstraintEnvironment.xmi"> + </environment> + </extension> + +</plugin> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/pom.xml b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/pom.xml new file mode 100644 index 00000000000..d0cbe425a31 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus.infra-constraints</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.infra.constraints</artifactId> + <version>1.2.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/schema/ConstraintEnvironment.exsd b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/schema/ConstraintEnvironment.exsd new file mode 100644 index 00000000000..b8e2cb97fc9 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/schema/ConstraintEnvironment.exsd @@ -0,0 +1,102 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.papyrus.infra.constraints" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.papyrus.infra.constraints" id="ConstraintEnvironment" name="ConstraintEnvironment"/> + </appInfo> + <documentation> + [Enter description of this extension point.] + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appInfo> + <meta.element /> + </appInfo> + </annotation> + <complexType> + <sequence> + <element ref="environment" minOccurs="1" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="environment"> + <complexType> + <attribute name="environmentModel" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute kind="resource"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + [Enter the first release in which this extension point appears.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiinfo"/> + </appInfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + +</schema> diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/CompositeConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/CompositeConstraint.java new file mode 100644 index 00000000000..d513dc9d843 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/CompositeConstraint.java @@ -0,0 +1,44 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.common.util.EList; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Composite Constraint</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.CompositeConstraint#getConstraints <em>Constraints</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getCompositeConstraint() + * @model + * @generated + */ +public interface CompositeConstraint extends ConstraintDescriptor { + /** + * Returns the value of the '<em><b>Constraints</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.constraints.SimpleConstraint}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Constraints</em>' containment reference list isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Constraints</em>' containment reference list. + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getCompositeConstraint_Constraints() + * @model containment="true" + * @generated + */ + EList<SimpleConstraint> getConstraints(); + +} // CompositeConstraint diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConfigProperty.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConfigProperty.java new file mode 100644 index 00000000000..55401ad9ded --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConfigProperty.java @@ -0,0 +1,56 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Config Property</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.ConfigProperty#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getConfigProperty() + * @model abstract="true" + * @generated + */ +public interface ConfigProperty extends EObject { + /** + * Returns the value of the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Name</em>' attribute. + * @see #setName(String) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getConfigProperty_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.ConfigProperty#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Name</em>' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // ConfigProperty diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintDescriptor.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintDescriptor.java new file mode 100644 index 00000000000..0e9e07c66df --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintDescriptor.java @@ -0,0 +1,135 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Constraint Descriptor</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getDisplay <em>Display</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#isOverrideable <em>Overrideable</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getOverriddenConstraints <em>Overridden Constraints</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getConstraintDescriptor() + * @model abstract="true" + * @generated + */ +public interface ConstraintDescriptor extends EObject { + /** + * Returns the value of the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Name</em>' attribute isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Name</em>' attribute. + * @see #setName(String) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getConstraintDescriptor_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getName <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Name</em>' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the '<em><b>Display</b></em>' container reference. + * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.constraints.DisplayUnit#getConstraints <em>Constraints</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Display</em>' container reference isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Display</em>' container reference. + * @see #setDisplay(DisplayUnit) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getConstraintDescriptor_Display() + * @see org.eclipse.papyrus.infra.constraints.DisplayUnit#getConstraints + * @model opposite="constraints" transient="false" + * @generated + */ + DisplayUnit getDisplay(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getDisplay <em>Display</em>}' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Display</em>' container reference. + * @see #getDisplay() + * @generated + */ + void setDisplay(DisplayUnit value); + + /** + * Returns the value of the '<em><b>Overrideable</b></em>' attribute. + * The default value is <code>"true"</code>. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Overrideable</em>' attribute isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Overrideable</em>' attribute. + * @see #setOverrideable(boolean) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getConstraintDescriptor_Overrideable() + * @model default="true" required="true" + * @generated + */ + boolean isOverrideable(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#isOverrideable <em>Overrideable</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Overrideable</em>' attribute. + * @see #isOverrideable() + * @generated + */ + void setOverrideable(boolean value); + + /** + * Returns the value of the '<em><b>Overridden Constraints</b></em>' reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.constraints.SimpleConstraint}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Overridden Constraints</em>' reference list isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Overridden Constraints</em>' reference list. + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getConstraintDescriptor_OverriddenConstraints() + * @model + * @generated + */ + EList<SimpleConstraint> getOverriddenConstraints(); + +} // ConstraintDescriptor diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintsFactory.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintsFactory.java new file mode 100644 index 00000000000..199ca260537 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintsFactory.java @@ -0,0 +1,80 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage + * @generated + */ +public interface ConstraintsFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + ConstraintsFactory eINSTANCE = org.eclipse.papyrus.infra.constraints.impl.ConstraintsFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Simple Constraint</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return a new object of class '<em>Simple Constraint</em>'. + * @generated + */ + SimpleConstraint createSimpleConstraint(); + + /** + * Returns a new object of class '<em>Composite Constraint</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return a new object of class '<em>Composite Constraint</em>'. + * @generated + */ + CompositeConstraint createCompositeConstraint(); + + /** + * Returns a new object of class '<em>Value Property</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return a new object of class '<em>Value Property</em>'. + * @generated + */ + ValueProperty createValueProperty(); + + /** + * Returns a new object of class '<em>Reference Property</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return a new object of class '<em>Reference Property</em>'. + * @generated + */ + ReferenceProperty createReferenceProperty(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the package supported by this factory. + * @generated + */ + ConstraintsPackage getConstraintsPackage(); + +} // ConstraintsFactory diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintsPackage.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintsPackage.java new file mode 100644 index 00000000000..a458bce2f10 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ConstraintsPackage.java @@ -0,0 +1,869 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsFactory + * @model kind="package" + * @generated + */ +public interface ConstraintsPackage extends EPackage { + + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + String eNAME = "constraints"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/papyrus/constraints/0.9"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + String eNS_PREFIX = "constraints"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + ConstraintsPackage eINSTANCE = org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.impl.DisplayUnitImpl <em>Display Unit</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.DisplayUnitImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getDisplayUnit() + * @generated + */ + int DISPLAY_UNIT = 0; + + /** + * The feature id for the '<em><b>Constraints</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int DISPLAY_UNIT__CONSTRAINTS = 0; + + /** + * The feature id for the '<em><b>Element Multiplicity</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int DISPLAY_UNIT__ELEMENT_MULTIPLICITY = 1; + + /** + * The number of structural features of the '<em>Display Unit</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int DISPLAY_UNIT_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl <em>Constraint Descriptor</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getConstraintDescriptor() + * @generated + */ + int CONSTRAINT_DESCRIPTOR = 1; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_DESCRIPTOR__NAME = 0; + + /** + * The feature id for the '<em><b>Display</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_DESCRIPTOR__DISPLAY = 1; + + /** + * The feature id for the '<em><b>Overrideable</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_DESCRIPTOR__OVERRIDEABLE = 2; + + /** + * The feature id for the '<em><b>Overridden Constraints</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS = 3; + + /** + * The number of structural features of the '<em>Constraint Descriptor</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_DESCRIPTOR_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.impl.SimpleConstraintImpl <em>Simple Constraint</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.SimpleConstraintImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getSimpleConstraint() + * @generated + */ + int SIMPLE_CONSTRAINT = 2; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int SIMPLE_CONSTRAINT__NAME = CONSTRAINT_DESCRIPTOR__NAME; + + /** + * The feature id for the '<em><b>Display</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int SIMPLE_CONSTRAINT__DISPLAY = CONSTRAINT_DESCRIPTOR__DISPLAY; + + /** + * The feature id for the '<em><b>Overrideable</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int SIMPLE_CONSTRAINT__OVERRIDEABLE = CONSTRAINT_DESCRIPTOR__OVERRIDEABLE; + + /** + * The feature id for the '<em><b>Overridden Constraints</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int SIMPLE_CONSTRAINT__OVERRIDDEN_CONSTRAINTS = CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS; + + /** + * The feature id for the '<em><b>Constraint Type</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int SIMPLE_CONSTRAINT__CONSTRAINT_TYPE = CONSTRAINT_DESCRIPTOR_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Properties</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int SIMPLE_CONSTRAINT__PROPERTIES = CONSTRAINT_DESCRIPTOR_FEATURE_COUNT + 1; + + /** + * The number of structural features of the '<em>Simple Constraint</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int SIMPLE_CONSTRAINT_FEATURE_COUNT = CONSTRAINT_DESCRIPTOR_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.impl.CompositeConstraintImpl <em>Composite Constraint</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.CompositeConstraintImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getCompositeConstraint() + * @generated + */ + int COMPOSITE_CONSTRAINT = 3; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPOSITE_CONSTRAINT__NAME = CONSTRAINT_DESCRIPTOR__NAME; + + /** + * The feature id for the '<em><b>Display</b></em>' container reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPOSITE_CONSTRAINT__DISPLAY = CONSTRAINT_DESCRIPTOR__DISPLAY; + + /** + * The feature id for the '<em><b>Overrideable</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPOSITE_CONSTRAINT__OVERRIDEABLE = CONSTRAINT_DESCRIPTOR__OVERRIDEABLE; + + /** + * The feature id for the '<em><b>Overridden Constraints</b></em>' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPOSITE_CONSTRAINT__OVERRIDDEN_CONSTRAINTS = CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS; + + /** + * The feature id for the '<em><b>Constraints</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPOSITE_CONSTRAINT__CONSTRAINTS = CONSTRAINT_DESCRIPTOR_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Composite Constraint</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int COMPOSITE_CONSTRAINT_FEATURE_COUNT = CONSTRAINT_DESCRIPTOR_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.impl.ConfigPropertyImpl <em>Config Property</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ConfigPropertyImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getConfigProperty() + * @generated + */ + int CONFIG_PROPERTY = 4; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONFIG_PROPERTY__NAME = 0; + + /** + * The number of structural features of the '<em>Config Property</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONFIG_PROPERTY_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.impl.ValuePropertyImpl <em>Value Property</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ValuePropertyImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getValueProperty() + * @generated + */ + int VALUE_PROPERTY = 5; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int VALUE_PROPERTY__NAME = CONFIG_PROPERTY__NAME; + + /** + * The feature id for the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int VALUE_PROPERTY__VALUE = CONFIG_PROPERTY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Value Property</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int VALUE_PROPERTY_FEATURE_COUNT = CONFIG_PROPERTY_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.impl.ReferencePropertyImpl <em>Reference Property</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ReferencePropertyImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getReferenceProperty() + * @generated + */ + int REFERENCE_PROPERTY = 6; + + /** + * The feature id for the '<em><b>Name</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int REFERENCE_PROPERTY__NAME = CONFIG_PROPERTY__NAME; + + /** + * The feature id for the '<em><b>Value</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int REFERENCE_PROPERTY__VALUE = CONFIG_PROPERTY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Reference Property</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int REFERENCE_PROPERTY_FEATURE_COUNT = CONFIG_PROPERTY_FEATURE_COUNT + 1; + + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.DisplayUnit <em>Display Unit</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Display Unit</em>'. + * @see org.eclipse.papyrus.infra.constraints.DisplayUnit + * @generated + */ + EClass getDisplayUnit(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.constraints.DisplayUnit#getConstraints <em>Constraints</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the containment reference list '<em>Constraints</em>'. + * @see org.eclipse.papyrus.infra.constraints.DisplayUnit#getConstraints() + * @see #getDisplayUnit() + * @generated + */ + EReference getDisplayUnit_Constraints(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.constraints.DisplayUnit#getElementMultiplicity <em>Element Multiplicity</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Element Multiplicity</em>'. + * @see org.eclipse.papyrus.infra.constraints.DisplayUnit#getElementMultiplicity() + * @see #getDisplayUnit() + * @generated + */ + EAttribute getDisplayUnit_ElementMultiplicity(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor <em>Constraint Descriptor</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Constraint Descriptor</em>'. + * @see org.eclipse.papyrus.infra.constraints.ConstraintDescriptor + * @generated + */ + EClass getConstraintDescriptor(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getName <em>Name</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Name</em>'. + * @see org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getName() + * @see #getConstraintDescriptor() + * @generated + */ + EAttribute getConstraintDescriptor_Name(); + + /** + * Returns the meta object for the container reference '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getDisplay <em>Display</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the container reference '<em>Display</em>'. + * @see org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getDisplay() + * @see #getConstraintDescriptor() + * @generated + */ + EReference getConstraintDescriptor_Display(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#isOverrideable <em>Overrideable</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Overrideable</em>'. + * @see org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#isOverrideable() + * @see #getConstraintDescriptor() + * @generated + */ + EAttribute getConstraintDescriptor_Overrideable(); + + /** + * Returns the meta object for the reference list '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getOverriddenConstraints <em>Overridden Constraints</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the reference list '<em>Overridden Constraints</em>'. + * @see org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getOverriddenConstraints() + * @see #getConstraintDescriptor() + * @generated + */ + EReference getConstraintDescriptor_OverriddenConstraints(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.SimpleConstraint <em>Simple Constraint</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Simple Constraint</em>'. + * @see org.eclipse.papyrus.infra.constraints.SimpleConstraint + * @generated + */ + EClass getSimpleConstraint(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.constraints.SimpleConstraint#getConstraintType <em>Constraint Type</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the reference '<em>Constraint Type</em>'. + * @see org.eclipse.papyrus.infra.constraints.SimpleConstraint#getConstraintType() + * @see #getSimpleConstraint() + * @generated + */ + EReference getSimpleConstraint_ConstraintType(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.constraints.SimpleConstraint#getProperties <em>Properties</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the containment reference list '<em>Properties</em>'. + * @see org.eclipse.papyrus.infra.constraints.SimpleConstraint#getProperties() + * @see #getSimpleConstraint() + * @generated + */ + EReference getSimpleConstraint_Properties(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.CompositeConstraint <em>Composite Constraint</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Composite Constraint</em>'. + * @see org.eclipse.papyrus.infra.constraints.CompositeConstraint + * @generated + */ + EClass getCompositeConstraint(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.constraints.CompositeConstraint#getConstraints <em>Constraints</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the containment reference list '<em>Constraints</em>'. + * @see org.eclipse.papyrus.infra.constraints.CompositeConstraint#getConstraints() + * @see #getCompositeConstraint() + * @generated + */ + EReference getCompositeConstraint_Constraints(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.ConfigProperty <em>Config Property</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Config Property</em>'. + * @see org.eclipse.papyrus.infra.constraints.ConfigProperty + * @generated + */ + EClass getConfigProperty(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.constraints.ConfigProperty#getName <em>Name</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Name</em>'. + * @see org.eclipse.papyrus.infra.constraints.ConfigProperty#getName() + * @see #getConfigProperty() + * @generated + */ + EAttribute getConfigProperty_Name(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.ValueProperty <em>Value Property</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Value Property</em>'. + * @see org.eclipse.papyrus.infra.constraints.ValueProperty + * @generated + */ + EClass getValueProperty(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.constraints.ValueProperty#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Value</em>'. + * @see org.eclipse.papyrus.infra.constraints.ValueProperty#getValue() + * @see #getValueProperty() + * @generated + */ + EAttribute getValueProperty_Value(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.ReferenceProperty <em>Reference Property</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Reference Property</em>'. + * @see org.eclipse.papyrus.infra.constraints.ReferenceProperty + * @generated + */ + EClass getReferenceProperty(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.constraints.ReferenceProperty#getValue <em>Value</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the reference '<em>Value</em>'. + * @see org.eclipse.papyrus.infra.constraints.ReferenceProperty#getValue() + * @see #getReferenceProperty() + * @generated + */ + EReference getReferenceProperty_Value(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the factory that creates the instances of the model. + * @generated + */ + ConstraintsFactory getConstraintsFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @generated + */ + interface Literals { + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.impl.DisplayUnitImpl <em>Display Unit</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.DisplayUnitImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getDisplayUnit() + * @generated + */ + EClass DISPLAY_UNIT = eINSTANCE.getDisplayUnit(); + + /** + * The meta object literal for the '<em><b>Constraints</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference DISPLAY_UNIT__CONSTRAINTS = eINSTANCE.getDisplayUnit_Constraints(); + + /** + * The meta object literal for the '<em><b>Element Multiplicity</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EAttribute DISPLAY_UNIT__ELEMENT_MULTIPLICITY = eINSTANCE.getDisplayUnit_ElementMultiplicity(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl <em>Constraint Descriptor</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getConstraintDescriptor() + * @generated + */ + EClass CONSTRAINT_DESCRIPTOR = eINSTANCE.getConstraintDescriptor(); + + /** + * The meta object literal for the '<em><b>Name</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EAttribute CONSTRAINT_DESCRIPTOR__NAME = eINSTANCE.getConstraintDescriptor_Name(); + + /** + * The meta object literal for the '<em><b>Display</b></em>' container reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference CONSTRAINT_DESCRIPTOR__DISPLAY = eINSTANCE.getConstraintDescriptor_Display(); + + /** + * The meta object literal for the '<em><b>Overrideable</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EAttribute CONSTRAINT_DESCRIPTOR__OVERRIDEABLE = eINSTANCE.getConstraintDescriptor_Overrideable(); + + /** + * The meta object literal for the '<em><b>Overridden Constraints</b></em>' reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS = eINSTANCE.getConstraintDescriptor_OverriddenConstraints(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.impl.SimpleConstraintImpl <em>Simple Constraint</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.SimpleConstraintImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getSimpleConstraint() + * @generated + */ + EClass SIMPLE_CONSTRAINT = eINSTANCE.getSimpleConstraint(); + + /** + * The meta object literal for the '<em><b>Constraint Type</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference SIMPLE_CONSTRAINT__CONSTRAINT_TYPE = eINSTANCE.getSimpleConstraint_ConstraintType(); + + /** + * The meta object literal for the '<em><b>Properties</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference SIMPLE_CONSTRAINT__PROPERTIES = eINSTANCE.getSimpleConstraint_Properties(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.impl.CompositeConstraintImpl <em>Composite Constraint</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.CompositeConstraintImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getCompositeConstraint() + * @generated + */ + EClass COMPOSITE_CONSTRAINT = eINSTANCE.getCompositeConstraint(); + + /** + * The meta object literal for the '<em><b>Constraints</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference COMPOSITE_CONSTRAINT__CONSTRAINTS = eINSTANCE.getCompositeConstraint_Constraints(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.impl.ConfigPropertyImpl <em>Config Property</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ConfigPropertyImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getConfigProperty() + * @generated + */ + EClass CONFIG_PROPERTY = eINSTANCE.getConfigProperty(); + + /** + * The meta object literal for the '<em><b>Name</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EAttribute CONFIG_PROPERTY__NAME = eINSTANCE.getConfigProperty_Name(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.impl.ValuePropertyImpl <em>Value Property</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ValuePropertyImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getValueProperty() + * @generated + */ + EClass VALUE_PROPERTY = eINSTANCE.getValueProperty(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EAttribute VALUE_PROPERTY__VALUE = eINSTANCE.getValueProperty_Value(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.impl.ReferencePropertyImpl <em>Reference Property</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.impl.ReferencePropertyImpl + * @see org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl#getReferenceProperty() + * @generated + */ + EClass REFERENCE_PROPERTY = eINSTANCE.getReferenceProperty(); + + /** + * The meta object literal for the '<em><b>Value</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference REFERENCE_PROPERTY__VALUE = eINSTANCE.getReferenceProperty_Value(); + + } + +} // ConstraintsPackage diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/DisplayUnit.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/DisplayUnit.java new file mode 100644 index 00000000000..a19aa371ab1 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/DisplayUnit.java @@ -0,0 +1,77 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Display Unit</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.DisplayUnit#getConstraints <em>Constraints</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.DisplayUnit#getElementMultiplicity <em>Element Multiplicity</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getDisplayUnit() + * @model abstract="true" + * @generated + */ +public interface DisplayUnit extends EObject { + /** + * Returns the value of the '<em><b>Constraints</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor}. + * It is bidirectional and its opposite is '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getDisplay <em>Display</em>}'. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Constraints</em>' containment reference list isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Constraints</em>' containment reference list. + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getDisplayUnit_Constraints() + * @see org.eclipse.papyrus.infra.constraints.ConstraintDescriptor#getDisplay + * @model opposite="display" containment="true" + * @generated + */ + EList<ConstraintDescriptor> getConstraints(); + + /** + * Returns the value of the '<em><b>Element Multiplicity</b></em>' attribute. + * The default value is <code>"1"</code>. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Element Multiplicity</em>' attribute isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Element Multiplicity</em>' attribute. + * @see #setElementMultiplicity(int) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getDisplayUnit_ElementMultiplicity() + * @model default="1" + * @generated + */ + int getElementMultiplicity(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.DisplayUnit#getElementMultiplicity <em>Element Multiplicity</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Element Multiplicity</em>' attribute. + * @see #getElementMultiplicity() + * @generated + */ + void setElementMultiplicity(int value); + +} // DisplayUnit diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ReferenceProperty.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ReferenceProperty.java new file mode 100644 index 00000000000..d2d9ae6b17d --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ReferenceProperty.java @@ -0,0 +1,56 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Reference Property</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.ReferenceProperty#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getReferenceProperty() + * @model + * @generated + */ +public interface ReferenceProperty extends ConfigProperty { + /** + * Returns the value of the '<em><b>Value</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' reference isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Value</em>' reference. + * @see #setValue(EObject) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getReferenceProperty_Value() + * @model required="true" + * @generated + */ + EObject getValue(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.ReferenceProperty#getValue <em>Value</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Value</em>' reference. + * @see #getValue() + * @generated + */ + void setValue(EObject value); + +} // ReferenceProperty diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/SimpleConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/SimpleConstraint.java new file mode 100644 index 00000000000..1a0c908ad92 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/SimpleConstraint.java @@ -0,0 +1,74 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Simple Constraint</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.SimpleConstraint#getConstraintType <em>Constraint Type</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.SimpleConstraint#getProperties <em>Properties</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getSimpleConstraint() + * @model + * @generated + */ +public interface SimpleConstraint extends ConstraintDescriptor { + /** + * Returns the value of the '<em><b>Constraint Type</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Constraint Type</em>' reference isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Constraint Type</em>' reference. + * @see #setConstraintType(ConstraintType) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getSimpleConstraint_ConstraintType() + * @model required="true" + * @generated + */ + ConstraintType getConstraintType(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.SimpleConstraint#getConstraintType <em>Constraint Type</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Constraint Type</em>' reference. + * @see #getConstraintType() + * @generated + */ + void setConstraintType(ConstraintType value); + + /** + * Returns the value of the '<em><b>Properties</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.constraints.ConfigProperty}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Properties</em>' containment reference list isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Properties</em>' containment reference list. + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getSimpleConstraint_Properties() + * @model containment="true" + * @generated + */ + EList<ConfigProperty> getProperties(); + +} // SimpleConstraint diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ValueProperty.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ValueProperty.java new file mode 100644 index 00000000000..3fdfbadc79e --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/ValueProperty.java @@ -0,0 +1,55 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints; + + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Value Property</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.ValueProperty#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getValueProperty() + * @model + * @generated + */ +public interface ValueProperty extends ConfigProperty { + /** + * Returns the value of the '<em><b>Value</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Value</em>' attribute isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Value</em>' attribute. + * @see #setValue(String) + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#getValueProperty_Value() + * @model required="true" + * @generated + */ + String getValue(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.ValueProperty#getValue <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Value</em>' attribute. + * @see #getValue() + * @generated + */ + void setValue(String value); + +} // ValueProperty diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/ConstraintEnvironment.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/ConstraintEnvironment.java new file mode 100644 index 00000000000..1b35ac39f90 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/ConstraintEnvironment.java @@ -0,0 +1,45 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Constraint Environment</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment#getConstraintTypes <em>Constraint Types</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage#getConstraintEnvironment() + * @model + * @generated + */ +public interface ConstraintEnvironment extends EObject { + /** + * Returns the value of the '<em><b>Constraint Types</b></em>' containment reference list. + * The list contents are of type {@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Constraint Types</em>' containment reference list isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Constraint Types</em>' containment reference list. + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage#getConstraintEnvironment_ConstraintTypes() + * @model containment="true" + * @generated + */ + EList<ConstraintType> getConstraintTypes(); + +} // ConstraintEnvironment diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/ConstraintType.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/ConstraintType.java new file mode 100644 index 00000000000..3efd87dfe14 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/ConstraintType.java @@ -0,0 +1,85 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment; + +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Constraint Type</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getLabel <em>Label</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getConstraintClass <em>Constraint Class</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage#getConstraintType() + * @model + * @generated + */ +public interface ConstraintType extends EObject { + /** + * Returns the value of the '<em><b>Label</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Label</em>' attribute isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Label</em>' attribute. + * @see #setLabel(String) + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage#getConstraintType_Label() + * @model required="true" + * @generated + */ + String getLabel(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getLabel <em>Label</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Label</em>' attribute. + * @see #getLabel() + * @generated + */ + void setLabel(String value); + + /** + * Returns the value of the '<em><b>Constraint Class</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Constraint Class</em>' attribute isn't clear, there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * + * @return the value of the '<em>Constraint Class</em>' attribute. + * @see #setConstraintClass(String) + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage#getConstraintType_ConstraintClass() + * @model required="true" + * @generated + */ + String getConstraintClass(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getConstraintClass <em>Constraint Class</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param value + * the new value of the '<em>Constraint Class</em>' attribute. + * @see #getConstraintClass() + * @generated + */ + void setConstraintClass(String value); + +} // ConstraintType diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/EnvironmentFactory.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/EnvironmentFactory.java new file mode 100644 index 00000000000..9bd2431bd1f --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/EnvironmentFactory.java @@ -0,0 +1,60 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage + * @generated + */ +public interface EnvironmentFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EnvironmentFactory eINSTANCE = org.eclipse.papyrus.infra.constraints.environment.impl.EnvironmentFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Constraint Environment</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return a new object of class '<em>Constraint Environment</em>'. + * @generated + */ + ConstraintEnvironment createConstraintEnvironment(); + + /** + * Returns a new object of class '<em>Constraint Type</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return a new object of class '<em>Constraint Type</em>'. + * @generated + */ + ConstraintType createConstraintType(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the package supported by this factory. + * @generated + */ + EnvironmentPackage getEnvironmentPackage(); + +} // EnvironmentFactory diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/EnvironmentPackage.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/EnvironmentPackage.java new file mode 100644 index 00000000000..bda8f281494 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/EnvironmentPackage.java @@ -0,0 +1,273 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentFactory + * @model kind="package" + * @generated + */ +public interface EnvironmentPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + String eNAME = "environment"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/papyrus/constraints/environment/0.9"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + String eNS_PREFIX = "environment"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EnvironmentPackage eINSTANCE = org.eclipse.papyrus.infra.constraints.environment.impl.EnvironmentPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintEnvironmentImpl <em>Constraint Environment</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintEnvironmentImpl + * @see org.eclipse.papyrus.infra.constraints.environment.impl.EnvironmentPackageImpl#getConstraintEnvironment() + * @generated + */ + int CONSTRAINT_ENVIRONMENT = 0; + + /** + * The feature id for the '<em><b>Constraint Types</b></em>' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES = 0; + + /** + * The number of structural features of the '<em>Constraint Environment</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_ENVIRONMENT_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintTypeImpl <em>Constraint Type</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintTypeImpl + * @see org.eclipse.papyrus.infra.constraints.environment.impl.EnvironmentPackageImpl#getConstraintType() + * @generated + */ + int CONSTRAINT_TYPE = 1; + + /** + * The feature id for the '<em><b>Label</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_TYPE__LABEL = 0; + + /** + * The feature id for the '<em><b>Constraint Class</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_TYPE__CONSTRAINT_CLASS = 1; + + /** + * The number of structural features of the '<em>Constraint Type</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int CONSTRAINT_TYPE_FEATURE_COUNT = 2; + + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment <em>Constraint Environment</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Constraint Environment</em>'. + * @see org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment + * @generated + */ + EClass getConstraintEnvironment(); + + /** + * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment#getConstraintTypes <em>Constraint Types</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the containment reference list '<em>Constraint Types</em>'. + * @see org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment#getConstraintTypes() + * @see #getConstraintEnvironment() + * @generated + */ + EReference getConstraintEnvironment_ConstraintTypes(); + + /** + * Returns the meta object for class '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType <em>Constraint Type</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for class '<em>Constraint Type</em>'. + * @see org.eclipse.papyrus.infra.constraints.environment.ConstraintType + * @generated + */ + EClass getConstraintType(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getLabel <em>Label</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Label</em>'. + * @see org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getLabel() + * @see #getConstraintType() + * @generated + */ + EAttribute getConstraintType_Label(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getConstraintClass <em>Constraint Class</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the meta object for the attribute '<em>Constraint Class</em>'. + * @see org.eclipse.papyrus.infra.constraints.environment.ConstraintType#getConstraintClass() + * @see #getConstraintType() + * @generated + */ + EAttribute getConstraintType_ConstraintClass(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the factory that creates the instances of the model. + * @generated + */ + EnvironmentFactory getEnvironmentFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintEnvironmentImpl <em>Constraint Environment</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintEnvironmentImpl + * @see org.eclipse.papyrus.infra.constraints.environment.impl.EnvironmentPackageImpl#getConstraintEnvironment() + * @generated + */ + EClass CONSTRAINT_ENVIRONMENT = eINSTANCE.getConstraintEnvironment(); + + /** + * The meta object literal for the '<em><b>Constraint Types</b></em>' containment reference list feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EReference CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES = eINSTANCE.getConstraintEnvironment_ConstraintTypes(); + + /** + * The meta object literal for the '{@link org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintTypeImpl <em>Constraint Type</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintTypeImpl + * @see org.eclipse.papyrus.infra.constraints.environment.impl.EnvironmentPackageImpl#getConstraintType() + * @generated + */ + EClass CONSTRAINT_TYPE = eINSTANCE.getConstraintType(); + + /** + * The meta object literal for the '<em><b>Label</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EAttribute CONSTRAINT_TYPE__LABEL = eINSTANCE.getConstraintType_Label(); + + /** + * The meta object literal for the '<em><b>Constraint Class</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + EAttribute CONSTRAINT_TYPE__CONSTRAINT_CLASS = eINSTANCE.getConstraintType_ConstraintClass(); + + } + +} // EnvironmentPackage diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/ConstraintEnvironmentImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/ConstraintEnvironmentImpl.java new file mode 100644 index 00000000000..761f0afc6f1 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/ConstraintEnvironmentImpl.java @@ -0,0 +1,160 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Constraint Environment</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintEnvironmentImpl#getConstraintTypes <em>Constraint Types</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ConstraintEnvironmentImpl extends EObjectImpl implements ConstraintEnvironment { + /** + * The cached value of the '{@link #getConstraintTypes() <em>Constraint Types</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getConstraintTypes() + * @generated + * @ordered + */ + protected EList<ConstraintType> constraintTypes; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintEnvironmentImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return EnvironmentPackage.Literals.CONSTRAINT_ENVIRONMENT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EList<ConstraintType> getConstraintTypes() { + if (constraintTypes == null) { + constraintTypes = new EObjectContainmentEList<ConstraintType>(ConstraintType.class, this, EnvironmentPackage.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES); + } + return constraintTypes; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES: + return ((InternalEList<?>) getConstraintTypes()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES: + return getConstraintTypes(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES: + getConstraintTypes().clear(); + getConstraintTypes().addAll((Collection<? extends ConstraintType>) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES: + getConstraintTypes().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES: + return constraintTypes != null && !constraintTypes.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // ConstraintEnvironmentImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/ConstraintTypeImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/ConstraintTypeImpl.java new file mode 100644 index 00000000000..50682cdee34 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/ConstraintTypeImpl.java @@ -0,0 +1,237 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Constraint Type</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintTypeImpl#getLabel <em>Label</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.environment.impl.ConstraintTypeImpl#getConstraintClass <em>Constraint Class</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ConstraintTypeImpl extends EObjectImpl implements ConstraintType { + /** + * The default value of the '{@link #getLabel() <em>Label</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getLabel() + * @generated + * @ordered + */ + protected static final String LABEL_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getLabel() + * @generated + * @ordered + */ + protected String label = LABEL_EDEFAULT; + + /** + * The default value of the '{@link #getConstraintClass() <em>Constraint Class</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getConstraintClass() + * @generated + * @ordered + */ + protected static final String CONSTRAINT_CLASS_EDEFAULT = null; + + /** + * The cached value of the '{@link #getConstraintClass() <em>Constraint Class</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getConstraintClass() + * @generated + * @ordered + */ + protected String constraintClass = CONSTRAINT_CLASS_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintTypeImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return EnvironmentPackage.Literals.CONSTRAINT_TYPE; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getLabel() { + return label; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setLabel(String newLabel) { + String oldLabel = label; + label = newLabel; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, EnvironmentPackage.CONSTRAINT_TYPE__LABEL, oldLabel, label)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getConstraintClass() { + return constraintClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setConstraintClass(String newConstraintClass) { + String oldConstraintClass = constraintClass; + constraintClass = newConstraintClass; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, EnvironmentPackage.CONSTRAINT_TYPE__CONSTRAINT_CLASS, oldConstraintClass, constraintClass)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_TYPE__LABEL: + return getLabel(); + case EnvironmentPackage.CONSTRAINT_TYPE__CONSTRAINT_CLASS: + return getConstraintClass(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_TYPE__LABEL: + setLabel((String) newValue); + return; + case EnvironmentPackage.CONSTRAINT_TYPE__CONSTRAINT_CLASS: + setConstraintClass((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_TYPE__LABEL: + setLabel(LABEL_EDEFAULT); + return; + case EnvironmentPackage.CONSTRAINT_TYPE__CONSTRAINT_CLASS: + setConstraintClass(CONSTRAINT_CLASS_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case EnvironmentPackage.CONSTRAINT_TYPE__LABEL: + return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label); + case EnvironmentPackage.CONSTRAINT_TYPE__CONSTRAINT_CLASS: + return CONSTRAINT_CLASS_EDEFAULT == null ? constraintClass != null : !CONSTRAINT_CLASS_EDEFAULT.equals(constraintClass); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (label: "); + result.append(label); + result.append(", constraintClass: "); + result.append(constraintClass); + result.append(')'); + return result.toString(); + } + +} // ConstraintTypeImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/EnvironmentFactoryImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/EnvironmentFactoryImpl.java new file mode 100644 index 00000000000..0e160de923b --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/EnvironmentFactoryImpl.java @@ -0,0 +1,119 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentFactory; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * + * @generated + */ +public class EnvironmentFactoryImpl extends EFactoryImpl implements EnvironmentFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static EnvironmentFactory init() { + try { + EnvironmentFactory theEnvironmentFactory = (EnvironmentFactory) EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/constraints/environment/0.9"); + if (theEnvironmentFactory != null) { + return theEnvironmentFactory; + } + } catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new EnvironmentFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT: + return createConstraintEnvironment(); + case EnvironmentPackage.CONSTRAINT_TYPE: + return createConstraintType(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintEnvironment createConstraintEnvironment() { + ConstraintEnvironmentImpl constraintEnvironment = new ConstraintEnvironmentImpl(); + return constraintEnvironment; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintType createConstraintType() { + ConstraintTypeImpl constraintType = new ConstraintTypeImpl(); + return constraintType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentPackage getEnvironmentPackage() { + return (EnvironmentPackage) getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @deprecated + * @generated + */ + @Deprecated + public static EnvironmentPackage getPackage() { + return EnvironmentPackage.eINSTANCE; + } + +} // EnvironmentFactoryImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/EnvironmentPackageImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/EnvironmentPackageImpl.java new file mode 100644 index 00000000000..8fd849b8ff6 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/impl/EnvironmentPackageImpl.java @@ -0,0 +1,245 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentFactory; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; +import org.eclipse.papyrus.infra.constraints.impl.ConstraintsPackageImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * + * @generated + */ +public class EnvironmentPackageImpl extends EPackageImpl implements EnvironmentPackage { + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass constraintEnvironmentEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass constraintTypeEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p> + * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also performs initialization of the package, or returns the registered package, if one already exists. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage#eNS_URI + * @see #init() + * @generated + */ + private EnvironmentPackageImpl() { + super(eNS_URI, EnvironmentFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p> + * This method is used to initialize {@link EnvironmentPackage#eINSTANCE} when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static EnvironmentPackage init() { + if (isInited) { + return (EnvironmentPackage) EPackage.Registry.INSTANCE.getEPackage(EnvironmentPackage.eNS_URI); + } + + // Obtain or create and register package + EnvironmentPackageImpl theEnvironmentPackage = (EnvironmentPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof EnvironmentPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new EnvironmentPackageImpl()); + + isInited = true; + + // Obtain or create and register interdependencies + ConstraintsPackageImpl theConstraintsPackage = (ConstraintsPackageImpl) (EPackage.Registry.INSTANCE.getEPackage(ConstraintsPackage.eNS_URI) instanceof ConstraintsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ConstraintsPackage.eNS_URI) + : ConstraintsPackage.eINSTANCE); + + // Create package meta-data objects + theEnvironmentPackage.createPackageContents(); + theConstraintsPackage.createPackageContents(); + + // Initialize created meta-data + theEnvironmentPackage.initializePackageContents(); + theConstraintsPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theEnvironmentPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(EnvironmentPackage.eNS_URI, theEnvironmentPackage); + return theEnvironmentPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getConstraintEnvironment() { + return constraintEnvironmentEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getConstraintEnvironment_ConstraintTypes() { + return (EReference) constraintEnvironmentEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getConstraintType() { + return constraintTypeEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getConstraintType_Label() { + return (EAttribute) constraintTypeEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getConstraintType_ConstraintClass() { + return (EAttribute) constraintTypeEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentFactory getEnvironmentFactory() { + return (EnvironmentFactory) getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void createPackageContents() { + if (isCreated) { + return; + } + isCreated = true; + + // Create classes and their features + constraintEnvironmentEClass = createEClass(CONSTRAINT_ENVIRONMENT); + createEReference(constraintEnvironmentEClass, CONSTRAINT_ENVIRONMENT__CONSTRAINT_TYPES); + + constraintTypeEClass = createEClass(CONSTRAINT_TYPE); + createEAttribute(constraintTypeEClass, CONSTRAINT_TYPE__LABEL); + createEAttribute(constraintTypeEClass, CONSTRAINT_TYPE__CONSTRAINT_CLASS); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) { + return; + } + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(constraintEnvironmentEClass, ConstraintEnvironment.class, "ConstraintEnvironment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getConstraintEnvironment_ConstraintTypes(), this.getConstraintType(), null, "constraintTypes", null, 0, -1, ConstraintEnvironment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(constraintTypeEClass, ConstraintType.class, "ConstraintType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getConstraintType_Label(), ecorePackage.getEString(), "label", null, 1, 1, ConstraintType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getConstraintType_ConstraintClass(), ecorePackage.getEString(), "constraintClass", null, 1, 1, ConstraintType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + } + +} // EnvironmentPackageImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/util/EnvironmentAdapterFactory.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/util/EnvironmentAdapterFactory.java new file mode 100644 index 00000000000..54c418a51eb --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/util/EnvironmentAdapterFactory.java @@ -0,0 +1,153 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage + * @generated + */ +public class EnvironmentAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected static EnvironmentPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentAdapterFactory() { + if (modelPackage == null) { + modelPackage = EnvironmentPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected EnvironmentSwitch<Adapter> modelSwitch = + new EnvironmentSwitch<Adapter>() { + @Override + public Adapter caseConstraintEnvironment(ConstraintEnvironment object) { + return createConstraintEnvironmentAdapter(); + } + + @Override + public Adapter caseConstraintType(ConstraintType object) { + return createConstraintTypeAdapter(); + } + + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param target + * the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject) target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment <em>Constraint Environment</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment + * @generated + */ + public Adapter createConstraintEnvironmentAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.environment.ConstraintType <em>Constraint Type</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.environment.ConstraintType + * @generated + */ + public Adapter createConstraintTypeAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} // EnvironmentAdapterFactory diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/util/EnvironmentSwitch.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/util/EnvironmentSwitch.java new file mode 100644 index 00000000000..560059290fe --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/environment/util/EnvironmentSwitch.java @@ -0,0 +1,150 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.environment.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage + * @generated + */ +public class EnvironmentSwitch<T> extends Switch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected static EnvironmentPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EnvironmentSwitch() { + if (modelPackage == null) { + modelPackage = EnvironmentPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case EnvironmentPackage.CONSTRAINT_ENVIRONMENT: { + ConstraintEnvironment constraintEnvironment = (ConstraintEnvironment) theEObject; + T result = caseConstraintEnvironment(constraintEnvironment); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case EnvironmentPackage.CONSTRAINT_TYPE: { + ConstraintType constraintType = (ConstraintType) theEObject; + T result = caseConstraintType(constraintType); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Constraint Environment</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Constraint Environment</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseConstraintEnvironment(ConstraintEnvironment object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Constraint Type</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Constraint Type</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseConstraintType(ConstraintType object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} // EnvironmentSwitch diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/CompositeConstraintImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/CompositeConstraintImpl.java new file mode 100644 index 00000000000..94a4f192e6c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/CompositeConstraintImpl.java @@ -0,0 +1,159 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.constraints.CompositeConstraint; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Composite Constraint</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.CompositeConstraintImpl#getConstraints <em>Constraints</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class CompositeConstraintImpl extends ConstraintDescriptorImpl implements CompositeConstraint { + /** + * The cached value of the '{@link #getConstraints() <em>Constraints</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getConstraints() + * @generated + * @ordered + */ + protected EList<SimpleConstraint> constraints; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected CompositeConstraintImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ConstraintsPackage.Literals.COMPOSITE_CONSTRAINT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EList<SimpleConstraint> getConstraints() { + if (constraints == null) { + constraints = new EObjectContainmentEList<SimpleConstraint>(SimpleConstraint.class, this, ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS); + } + return constraints; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS: + return ((InternalEList<?>) getConstraints()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS: + return getConstraints(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS: + getConstraints().clear(); + getConstraints().addAll((Collection<? extends SimpleConstraint>) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS: + getConstraints().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ConstraintsPackage.COMPOSITE_CONSTRAINT__CONSTRAINTS: + return constraints != null && !constraints.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // CompositeConstraintImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConfigPropertyImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConfigPropertyImpl.java new file mode 100644 index 00000000000..60c79d0d880 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConfigPropertyImpl.java @@ -0,0 +1,178 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.papyrus.infra.constraints.ConfigProperty; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Config Property</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.ConfigPropertyImpl#getName <em>Name</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class ConfigPropertyImpl extends EObjectImpl implements ConfigProperty { + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConfigPropertyImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ConstraintsPackage.Literals.CONFIG_PROPERTY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONFIG_PROPERTY__NAME, oldName, name)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ConstraintsPackage.CONFIG_PROPERTY__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ConstraintsPackage.CONFIG_PROPERTY__NAME: + setName((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ConstraintsPackage.CONFIG_PROPERTY__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ConstraintsPackage.CONFIG_PROPERTY__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} // ConfigPropertyImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintDescriptorImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintDescriptorImpl.java new file mode 100644 index 00000000000..d6cd8161851 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintDescriptorImpl.java @@ -0,0 +1,394 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectResolvingEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Constraint Descriptor</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl#getDisplay <em>Display</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl#isOverrideable <em>Overrideable</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.ConstraintDescriptorImpl#getOverriddenConstraints <em>Overridden Constraints</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintDescriptor { + /** + * The default value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() <em>Name</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The default value of the '{@link #isOverrideable() <em>Overrideable</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #isOverrideable() + * @generated + * @ordered + */ + protected static final boolean OVERRIDEABLE_EDEFAULT = true; + + /** + * The cached value of the '{@link #isOverrideable() <em>Overrideable</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #isOverrideable() + * @generated + * @ordered + */ + protected boolean overrideable = OVERRIDEABLE_EDEFAULT; + + /** + * The cached value of the '{@link #getOverriddenConstraints() <em>Overridden Constraints</em>}' reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getOverriddenConstraints() + * @generated + * @ordered + */ + protected EList<SimpleConstraint> overriddenConstraints; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintDescriptorImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ConstraintsPackage.Literals.CONSTRAINT_DESCRIPTOR; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getName() { + return name; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONSTRAINT_DESCRIPTOR__NAME, oldName, name)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public DisplayUnit getDisplay() { + if (eContainerFeatureID() != ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY) { + return null; + } + return (DisplayUnit) eContainer(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public NotificationChain basicSetDisplay(DisplayUnit newDisplay, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject) newDisplay, ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY, msgs); + return msgs; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setDisplay(DisplayUnit newDisplay) { + if (newDisplay != eInternalContainer() || (eContainerFeatureID() != ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY && newDisplay != null)) { + if (EcoreUtil.isAncestor(this, newDisplay)) { + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + } + NotificationChain msgs = null; + if (eInternalContainer() != null) { + msgs = eBasicRemoveFromContainer(msgs); + } + if (newDisplay != null) { + msgs = ((InternalEObject) newDisplay).eInverseAdd(this, ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS, DisplayUnit.class, msgs); + } + msgs = basicSetDisplay(newDisplay, msgs); + if (msgs != null) { + msgs.dispatch(); + } + } + else if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY, newDisplay, newDisplay)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public boolean isOverrideable() { + return overrideable; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setOverrideable(boolean newOverrideable) { + boolean oldOverrideable = overrideable; + overrideable = newOverrideable; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE, oldOverrideable, overrideable)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EList<SimpleConstraint> getOverriddenConstraints() { + if (overriddenConstraints == null) { + overriddenConstraints = new EObjectResolvingEList<SimpleConstraint>(SimpleConstraint.class, this, ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS); + } + return overriddenConstraints; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY: + if (eInternalContainer() != null) { + msgs = eBasicRemoveFromContainer(msgs); + } + return basicSetDisplay((DisplayUnit) otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY: + return basicSetDisplay(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY: + return eInternalContainer().eInverseRemove(this, ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS, DisplayUnit.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__NAME: + return getName(); + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY: + return getDisplay(); + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE: + return isOverrideable(); + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS: + return getOverriddenConstraints(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__NAME: + setName((String) newValue); + return; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY: + setDisplay((DisplayUnit) newValue); + return; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE: + setOverrideable((Boolean) newValue); + return; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS: + getOverriddenConstraints().clear(); + getOverriddenConstraints().addAll((Collection<? extends SimpleConstraint>) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__NAME: + setName(NAME_EDEFAULT); + return; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY: + setDisplay((DisplayUnit) null); + return; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE: + setOverrideable(OVERRIDEABLE_EDEFAULT); + return; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS: + getOverriddenConstraints().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY: + return getDisplay() != null; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE: + return overrideable != OVERRIDEABLE_EDEFAULT; + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS: + return overriddenConstraints != null && !overriddenConstraints.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(", overrideable: "); + result.append(overrideable); + result.append(')'); + return result.toString(); + } + +} // ConstraintDescriptorImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintsFactoryImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintsFactoryImpl.java new file mode 100644 index 00000000000..f4ce36d440c --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintsFactoryImpl.java @@ -0,0 +1,148 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.papyrus.infra.constraints.CompositeConstraint; +import org.eclipse.papyrus.infra.constraints.ConstraintsFactory; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.ReferenceProperty; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.ValueProperty; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintsFactoryImpl extends EFactoryImpl implements ConstraintsFactory { + + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public static ConstraintsFactory init() { + try { + ConstraintsFactory theConstraintsFactory = (ConstraintsFactory) EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/constraints/0.9"); + if (theConstraintsFactory != null) { + return theConstraintsFactory; + } + } catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new ConstraintsFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case ConstraintsPackage.SIMPLE_CONSTRAINT: + return createSimpleConstraint(); + case ConstraintsPackage.COMPOSITE_CONSTRAINT: + return createCompositeConstraint(); + case ConstraintsPackage.VALUE_PROPERTY: + return createValueProperty(); + case ConstraintsPackage.REFERENCE_PROPERTY: + return createReferenceProperty(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public SimpleConstraint createSimpleConstraint() { + SimpleConstraintImpl simpleConstraint = new SimpleConstraintImpl(); + return simpleConstraint; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public CompositeConstraint createCompositeConstraint() { + CompositeConstraintImpl compositeConstraint = new CompositeConstraintImpl(); + return compositeConstraint; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ValueProperty createValueProperty() { + ValuePropertyImpl valueProperty = new ValuePropertyImpl(); + return valueProperty; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ReferenceProperty createReferenceProperty() { + ReferencePropertyImpl referenceProperty = new ReferencePropertyImpl(); + return referenceProperty; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsPackage getConstraintsPackage() { + return (ConstraintsPackage) getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @deprecated + * @generated + */ + @Deprecated + public static ConstraintsPackage getPackage() { + return ConstraintsPackage.eINSTANCE; + } + +} // ConstraintsFactoryImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintsPackageImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintsPackageImpl.java new file mode 100644 index 00000000000..b20845917c4 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ConstraintsPackageImpl.java @@ -0,0 +1,486 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.eclipse.papyrus.infra.constraints.CompositeConstraint; +import org.eclipse.papyrus.infra.constraints.ConfigProperty; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.ConstraintsFactory; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; +import org.eclipse.papyrus.infra.constraints.ReferenceProperty; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.ValueProperty; +import org.eclipse.papyrus.infra.constraints.environment.EnvironmentPackage; +import org.eclipse.papyrus.infra.constraints.environment.impl.EnvironmentPackageImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * + * @generated + */ +public class ConstraintsPackageImpl extends EPackageImpl implements ConstraintsPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass displayUnitEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass constraintDescriptorEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass simpleConstraintEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass compositeConstraintEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass configPropertyEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass valuePropertyEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private EClass referencePropertyEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p> + * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also performs initialization of the package, or returns the registered package, if one already exists. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage#eNS_URI + * @see #init() + * @generated + */ + private ConstraintsPackageImpl() { + super(eNS_URI, ConstraintsFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p> + * This method is used to initialize {@link ConstraintsPackage#eINSTANCE} when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ConstraintsPackage init() { + if (isInited) { + return (ConstraintsPackage) EPackage.Registry.INSTANCE.getEPackage(ConstraintsPackage.eNS_URI); + } + + // Obtain or create and register package + ConstraintsPackageImpl theConstraintsPackage = (ConstraintsPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ConstraintsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ConstraintsPackageImpl()); + + isInited = true; + + // Obtain or create and register interdependencies + EnvironmentPackageImpl theEnvironmentPackage = (EnvironmentPackageImpl) (EPackage.Registry.INSTANCE.getEPackage(EnvironmentPackage.eNS_URI) instanceof EnvironmentPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(EnvironmentPackage.eNS_URI) + : EnvironmentPackage.eINSTANCE); + + // Create package meta-data objects + theConstraintsPackage.createPackageContents(); + theEnvironmentPackage.createPackageContents(); + + // Initialize created meta-data + theConstraintsPackage.initializePackageContents(); + theEnvironmentPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theConstraintsPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(ConstraintsPackage.eNS_URI, theConstraintsPackage); + return theConstraintsPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getDisplayUnit() { + return displayUnitEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getDisplayUnit_Constraints() { + return (EReference) displayUnitEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getDisplayUnit_ElementMultiplicity() { + return (EAttribute) displayUnitEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getConstraintDescriptor() { + return constraintDescriptorEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getConstraintDescriptor_Name() { + return (EAttribute) constraintDescriptorEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getConstraintDescriptor_Display() { + return (EReference) constraintDescriptorEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getConstraintDescriptor_Overrideable() { + return (EAttribute) constraintDescriptorEClass.getEStructuralFeatures().get(2); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getConstraintDescriptor_OverriddenConstraints() { + return (EReference) constraintDescriptorEClass.getEStructuralFeatures().get(3); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getSimpleConstraint() { + return simpleConstraintEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getSimpleConstraint_ConstraintType() { + return (EReference) simpleConstraintEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getSimpleConstraint_Properties() { + return (EReference) simpleConstraintEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getCompositeConstraint() { + return compositeConstraintEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getCompositeConstraint_Constraints() { + return (EReference) compositeConstraintEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getConfigProperty() { + return configPropertyEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getConfigProperty_Name() { + return (EAttribute) configPropertyEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getValueProperty() { + return valuePropertyEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EAttribute getValueProperty_Value() { + return (EAttribute) valuePropertyEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EClass getReferenceProperty() { + return referencePropertyEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EReference getReferenceProperty_Value() { + return (EReference) referencePropertyEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsFactory getConstraintsFactory() { + return (ConstraintsFactory) getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void createPackageContents() { + if (isCreated) { + return; + } + isCreated = true; + + // Create classes and their features + displayUnitEClass = createEClass(DISPLAY_UNIT); + createEReference(displayUnitEClass, DISPLAY_UNIT__CONSTRAINTS); + createEAttribute(displayUnitEClass, DISPLAY_UNIT__ELEMENT_MULTIPLICITY); + + constraintDescriptorEClass = createEClass(CONSTRAINT_DESCRIPTOR); + createEAttribute(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__NAME); + createEReference(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__DISPLAY); + createEAttribute(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__OVERRIDEABLE); + createEReference(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS); + + simpleConstraintEClass = createEClass(SIMPLE_CONSTRAINT); + createEReference(simpleConstraintEClass, SIMPLE_CONSTRAINT__CONSTRAINT_TYPE); + createEReference(simpleConstraintEClass, SIMPLE_CONSTRAINT__PROPERTIES); + + compositeConstraintEClass = createEClass(COMPOSITE_CONSTRAINT); + createEReference(compositeConstraintEClass, COMPOSITE_CONSTRAINT__CONSTRAINTS); + + configPropertyEClass = createEClass(CONFIG_PROPERTY); + createEAttribute(configPropertyEClass, CONFIG_PROPERTY__NAME); + + valuePropertyEClass = createEClass(VALUE_PROPERTY); + createEAttribute(valuePropertyEClass, VALUE_PROPERTY__VALUE); + + referencePropertyEClass = createEClass(REFERENCE_PROPERTY); + createEReference(referencePropertyEClass, REFERENCE_PROPERTY__VALUE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) { + return; + } + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + EnvironmentPackage theEnvironmentPackage = (EnvironmentPackage) EPackage.Registry.INSTANCE.getEPackage(EnvironmentPackage.eNS_URI); + + // Add subpackages + getESubpackages().add(theEnvironmentPackage); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + simpleConstraintEClass.getESuperTypes().add(this.getConstraintDescriptor()); + compositeConstraintEClass.getESuperTypes().add(this.getConstraintDescriptor()); + valuePropertyEClass.getESuperTypes().add(this.getConfigProperty()); + referencePropertyEClass.getESuperTypes().add(this.getConfigProperty()); + + // Initialize classes and features; add operations and parameters + initEClass(displayUnitEClass, DisplayUnit.class, "DisplayUnit", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getDisplayUnit_Constraints(), this.getConstraintDescriptor(), this.getConstraintDescriptor_Display(), "constraints", null, 0, -1, DisplayUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDisplayUnit_ElementMultiplicity(), ecorePackage.getEInt(), "elementMultiplicity", "1", 0, 1, DisplayUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(constraintDescriptorEClass, ConstraintDescriptor.class, "ConstraintDescriptor", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getConstraintDescriptor_Name(), ecorePackage.getEString(), "name", null, 1, 1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getConstraintDescriptor_Display(), this.getDisplayUnit(), this.getDisplayUnit_Constraints(), "display", null, 0, 1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getConstraintDescriptor_Overrideable(), ecorePackage.getEBoolean(), "overrideable", "true", 1, 1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getConstraintDescriptor_OverriddenConstraints(), this.getSimpleConstraint(), null, "overriddenConstraints", null, 0, -1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(simpleConstraintEClass, SimpleConstraint.class, "SimpleConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getSimpleConstraint_ConstraintType(), theEnvironmentPackage.getConstraintType(), null, "constraintType", null, 1, 1, SimpleConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, + IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSimpleConstraint_Properties(), this.getConfigProperty(), null, "properties", null, 0, -1, SimpleConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + + initEClass(compositeConstraintEClass, CompositeConstraint.class, "CompositeConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getCompositeConstraint_Constraints(), this.getSimpleConstraint(), null, "constraints", null, 0, -1, CompositeConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, + !IS_DERIVED, IS_ORDERED); + + initEClass(configPropertyEClass, ConfigProperty.class, "ConfigProperty", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getConfigProperty_Name(), ecorePackage.getEString(), "name", null, 1, 1, ConfigProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(valuePropertyEClass, ValueProperty.class, "ValueProperty", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getValueProperty_Value(), ecorePackage.getEString(), "value", null, 1, 1, ValueProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(referencePropertyEClass, ReferenceProperty.class, "ReferenceProperty", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getReferenceProperty_Value(), ecorePackage.getEObject(), null, "value", null, 1, 1, ReferenceProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, + IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} // ConstraintsPackageImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/DisplayUnitImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/DisplayUnitImpl.java new file mode 100644 index 00000000000..f54c5eabd17 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/DisplayUnitImpl.java @@ -0,0 +1,253 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Display Unit</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.DisplayUnitImpl#getConstraints <em>Constraints</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.DisplayUnitImpl#getElementMultiplicity <em>Element Multiplicity</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public abstract class DisplayUnitImpl extends EObjectImpl implements DisplayUnit { + /** + * The cached value of the '{@link #getConstraints() <em>Constraints</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getConstraints() + * @generated + * @ordered + */ + protected EList<ConstraintDescriptor> constraints; + + /** + * The default value of the '{@link #getElementMultiplicity() <em>Element Multiplicity</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getElementMultiplicity() + * @generated + * @ordered + */ + protected static final int ELEMENT_MULTIPLICITY_EDEFAULT = 1; + /** + * The cached value of the '{@link #getElementMultiplicity() <em>Element Multiplicity</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getElementMultiplicity() + * @generated + * @ordered + */ + protected int elementMultiplicity = ELEMENT_MULTIPLICITY_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected DisplayUnitImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ConstraintsPackage.Literals.DISPLAY_UNIT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EList<ConstraintDescriptor> getConstraints() { + if (constraints == null) { + constraints = new EObjectContainmentWithInverseEList<ConstraintDescriptor>(ConstraintDescriptor.class, this, ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS, ConstraintsPackage.CONSTRAINT_DESCRIPTOR__DISPLAY); + } + return constraints; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public int getElementMultiplicity() { + return elementMultiplicity; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setElementMultiplicity(int newElementMultiplicity) { + int oldElementMultiplicity = elementMultiplicity; + elementMultiplicity = newElementMultiplicity; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.DISPLAY_UNIT__ELEMENT_MULTIPLICITY, oldElementMultiplicity, elementMultiplicity)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS: + return ((InternalEList<InternalEObject>) (InternalEList<?>) getConstraints()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS: + return ((InternalEList<?>) getConstraints()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS: + return getConstraints(); + case ConstraintsPackage.DISPLAY_UNIT__ELEMENT_MULTIPLICITY: + return getElementMultiplicity(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS: + getConstraints().clear(); + getConstraints().addAll((Collection<? extends ConstraintDescriptor>) newValue); + return; + case ConstraintsPackage.DISPLAY_UNIT__ELEMENT_MULTIPLICITY: + setElementMultiplicity((Integer) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS: + getConstraints().clear(); + return; + case ConstraintsPackage.DISPLAY_UNIT__ELEMENT_MULTIPLICITY: + setElementMultiplicity(ELEMENT_MULTIPLICITY_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ConstraintsPackage.DISPLAY_UNIT__CONSTRAINTS: + return constraints != null && !constraints.isEmpty(); + case ConstraintsPackage.DISPLAY_UNIT__ELEMENT_MULTIPLICITY: + return elementMultiplicity != ELEMENT_MULTIPLICITY_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (elementMultiplicity: "); + result.append(elementMultiplicity); + result.append(')'); + return result.toString(); + } + +} // DisplayUnitImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ReferencePropertyImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ReferencePropertyImpl.java new file mode 100644 index 00000000000..63ffe4e0bcf --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ReferencePropertyImpl.java @@ -0,0 +1,171 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.ReferenceProperty; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Reference Property</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.ReferencePropertyImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ReferencePropertyImpl extends ConfigPropertyImpl implements ReferenceProperty { + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getValue() + * @generated + * @ordered + */ + protected EObject value; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ReferencePropertyImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ConstraintsPackage.Literals.REFERENCE_PROPERTY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EObject getValue() { + if (value != null && value.eIsProxy()) { + InternalEObject oldValue = (InternalEObject) value; + value = eResolveProxy(oldValue); + if (value != oldValue) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConstraintsPackage.REFERENCE_PROPERTY__VALUE, oldValue, value)); + } + } + } + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EObject basicGetValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setValue(EObject newValue) { + EObject oldValue = value; + value = newValue; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.REFERENCE_PROPERTY__VALUE, oldValue, value)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ConstraintsPackage.REFERENCE_PROPERTY__VALUE: + if (resolve) { + return getValue(); + } + return basicGetValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ConstraintsPackage.REFERENCE_PROPERTY__VALUE: + setValue((EObject) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ConstraintsPackage.REFERENCE_PROPERTY__VALUE: + setValue((EObject) null); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ConstraintsPackage.REFERENCE_PROPERTY__VALUE: + return value != null; + } + return super.eIsSet(featureID); + } + +} // ReferencePropertyImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/SimpleConstraintImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/SimpleConstraintImpl.java new file mode 100644 index 00000000000..382b29719ab --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/SimpleConstraintImpl.java @@ -0,0 +1,230 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.papyrus.infra.constraints.ConfigProperty; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Simple Constraint</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.SimpleConstraintImpl#getConstraintType <em>Constraint Type</em>}</li> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.SimpleConstraintImpl#getProperties <em>Properties</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class SimpleConstraintImpl extends ConstraintDescriptorImpl implements SimpleConstraint { + /** + * The cached value of the '{@link #getConstraintType() <em>Constraint Type</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getConstraintType() + * @generated + * @ordered + */ + protected ConstraintType constraintType; + + /** + * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getProperties() + * @generated + * @ordered + */ + protected EList<ConfigProperty> properties; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected SimpleConstraintImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ConstraintsPackage.Literals.SIMPLE_CONSTRAINT; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintType getConstraintType() { + if (constraintType != null && constraintType.eIsProxy()) { + InternalEObject oldConstraintType = (InternalEObject) constraintType; + constraintType = (ConstraintType) eResolveProxy(oldConstraintType); + if (constraintType != oldConstraintType) { + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConstraintsPackage.SIMPLE_CONSTRAINT__CONSTRAINT_TYPE, oldConstraintType, constraintType)); + } + } + } + return constraintType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintType basicGetConstraintType() { + return constraintType; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setConstraintType(ConstraintType newConstraintType) { + ConstraintType oldConstraintType = constraintType; + constraintType = newConstraintType; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.SIMPLE_CONSTRAINT__CONSTRAINT_TYPE, oldConstraintType, constraintType)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public EList<ConfigProperty> getProperties() { + if (properties == null) { + properties = new EObjectContainmentEList<ConfigProperty>(ConfigProperty.class, this, ConstraintsPackage.SIMPLE_CONSTRAINT__PROPERTIES); + } + return properties; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ConstraintsPackage.SIMPLE_CONSTRAINT__PROPERTIES: + return ((InternalEList<?>) getProperties()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ConstraintsPackage.SIMPLE_CONSTRAINT__CONSTRAINT_TYPE: + if (resolve) { + return getConstraintType(); + } + return basicGetConstraintType(); + case ConstraintsPackage.SIMPLE_CONSTRAINT__PROPERTIES: + return getProperties(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ConstraintsPackage.SIMPLE_CONSTRAINT__CONSTRAINT_TYPE: + setConstraintType((ConstraintType) newValue); + return; + case ConstraintsPackage.SIMPLE_CONSTRAINT__PROPERTIES: + getProperties().clear(); + getProperties().addAll((Collection<? extends ConfigProperty>) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ConstraintsPackage.SIMPLE_CONSTRAINT__CONSTRAINT_TYPE: + setConstraintType((ConstraintType) null); + return; + case ConstraintsPackage.SIMPLE_CONSTRAINT__PROPERTIES: + getProperties().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ConstraintsPackage.SIMPLE_CONSTRAINT__CONSTRAINT_TYPE: + return constraintType != null; + case ConstraintsPackage.SIMPLE_CONSTRAINT__PROPERTIES: + return properties != null && !properties.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // SimpleConstraintImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ValuePropertyImpl.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ValuePropertyImpl.java new file mode 100644 index 00000000000..447531c6573 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/impl/ValuePropertyImpl.java @@ -0,0 +1,177 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.ValueProperty; + +/** + * <!-- begin-user-doc --> + * An implementation of the model object '<em><b>Value Property</b></em>'. + * <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.papyrus.infra.constraints.impl.ValuePropertyImpl#getValue <em>Value</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class ValuePropertyImpl extends ConfigPropertyImpl implements ValueProperty { + /** + * The default value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getValue() + * @generated + * @ordered + */ + protected static final String VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getValue() <em>Value</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @see #getValue() + * @generated + * @ordered + */ + protected String value = VALUE_EDEFAULT; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ValuePropertyImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ConstraintsPackage.Literals.VALUE_PROPERTY; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public String getValue() { + return value; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public void setValue(String newValue) { + String oldValue = value; + value = newValue; + if (eNotificationRequired()) { + eNotify(new ENotificationImpl(this, Notification.SET, ConstraintsPackage.VALUE_PROPERTY__VALUE, oldValue, value)); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ConstraintsPackage.VALUE_PROPERTY__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ConstraintsPackage.VALUE_PROPERTY__VALUE: + setValue((String) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ConstraintsPackage.VALUE_PROPERTY__VALUE: + setValue(VALUE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ConstraintsPackage.VALUE_PROPERTY__VALUE: + return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) { + return super.toString(); + } + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (value: "); + result.append(value); + result.append(')'); + return result.toString(); + } + +} // ValuePropertyImpl diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/util/ConstraintsAdapterFactory.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/util/ConstraintsAdapterFactory.java new file mode 100644 index 00000000000..1dd84fff518 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/util/ConstraintsAdapterFactory.java @@ -0,0 +1,258 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.constraints.CompositeConstraint; +import org.eclipse.papyrus.infra.constraints.ConfigProperty; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; +import org.eclipse.papyrus.infra.constraints.ReferenceProperty; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.ValueProperty; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage + * @generated + */ +public class ConstraintsAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected static ConstraintsPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsAdapterFactory() { + if (modelPackage == null) { + modelPackage = ConstraintsPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject) object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected ConstraintsSwitch<Adapter> modelSwitch = + new ConstraintsSwitch<Adapter>() { + @Override + public Adapter caseDisplayUnit(DisplayUnit object) { + return createDisplayUnitAdapter(); + } + + @Override + public Adapter caseConstraintDescriptor(ConstraintDescriptor object) { + return createConstraintDescriptorAdapter(); + } + + @Override + public Adapter caseSimpleConstraint(SimpleConstraint object) { + return createSimpleConstraintAdapter(); + } + + @Override + public Adapter caseCompositeConstraint(CompositeConstraint object) { + return createCompositeConstraintAdapter(); + } + + @Override + public Adapter caseConfigProperty(ConfigProperty object) { + return createConfigPropertyAdapter(); + } + + @Override + public Adapter caseValueProperty(ValueProperty object) { + return createValuePropertyAdapter(); + } + + @Override + public Adapter caseReferenceProperty(ReferenceProperty object) { + return createReferencePropertyAdapter(); + } + + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @param target + * the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject) target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.DisplayUnit <em>Display Unit</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.DisplayUnit + * @generated + */ + public Adapter createDisplayUnitAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.ConstraintDescriptor <em>Constraint Descriptor</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.ConstraintDescriptor + * @generated + */ + public Adapter createConstraintDescriptorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.SimpleConstraint <em>Simple Constraint</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.SimpleConstraint + * @generated + */ + public Adapter createSimpleConstraintAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.CompositeConstraint <em>Composite Constraint</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.CompositeConstraint + * @generated + */ + public Adapter createCompositeConstraintAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.ConfigProperty <em>Config Property</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.ConfigProperty + * @generated + */ + public Adapter createConfigPropertyAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.ValueProperty <em>Value Property</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.ValueProperty + * @generated + */ + public Adapter createValuePropertyAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.constraints.ReferenceProperty <em>Reference Property</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @see org.eclipse.papyrus.infra.constraints.ReferenceProperty + * @generated + */ + public Adapter createReferencePropertyAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} // ConstraintsAdapterFactory diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/util/ConstraintsSwitch.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/util/ConstraintsSwitch.java new file mode 100644 index 00000000000..481671b7660 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src-gen/org/eclipse/papyrus/infra/constraints/util/ConstraintsSwitch.java @@ -0,0 +1,292 @@ +/** + * <copyright> + * </copyright> + * + * $Id$ + */ +package org.eclipse.papyrus.infra.constraints.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.eclipse.papyrus.infra.constraints.CompositeConstraint; +import org.eclipse.papyrus.infra.constraints.ConfigProperty; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.ConstraintsPackage; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; +import org.eclipse.papyrus.infra.constraints.ReferenceProperty; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.ValueProperty; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * + * @see org.eclipse.papyrus.infra.constraints.ConstraintsPackage + * @generated + */ +public class ConstraintsSwitch<T> extends Switch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + protected static ConstraintsPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @generated + */ + public ConstraintsSwitch() { + if (modelPackage == null) { + modelPackage = ConstraintsPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case ConstraintsPackage.DISPLAY_UNIT: { + DisplayUnit displayUnit = (DisplayUnit) theEObject; + T result = caseDisplayUnit(displayUnit); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ConstraintsPackage.CONSTRAINT_DESCRIPTOR: { + ConstraintDescriptor constraintDescriptor = (ConstraintDescriptor) theEObject; + T result = caseConstraintDescriptor(constraintDescriptor); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ConstraintsPackage.SIMPLE_CONSTRAINT: { + SimpleConstraint simpleConstraint = (SimpleConstraint) theEObject; + T result = caseSimpleConstraint(simpleConstraint); + if (result == null) { + result = caseConstraintDescriptor(simpleConstraint); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ConstraintsPackage.COMPOSITE_CONSTRAINT: { + CompositeConstraint compositeConstraint = (CompositeConstraint) theEObject; + T result = caseCompositeConstraint(compositeConstraint); + if (result == null) { + result = caseConstraintDescriptor(compositeConstraint); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ConstraintsPackage.CONFIG_PROPERTY: { + ConfigProperty configProperty = (ConfigProperty) theEObject; + T result = caseConfigProperty(configProperty); + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ConstraintsPackage.VALUE_PROPERTY: { + ValueProperty valueProperty = (ValueProperty) theEObject; + T result = caseValueProperty(valueProperty); + if (result == null) { + result = caseConfigProperty(valueProperty); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case ConstraintsPackage.REFERENCE_PROPERTY: { + ReferenceProperty referenceProperty = (ReferenceProperty) theEObject; + T result = caseReferenceProperty(referenceProperty); + if (result == null) { + result = caseConfigProperty(referenceProperty); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + default: + return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Display Unit</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Display Unit</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDisplayUnit(DisplayUnit object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Constraint Descriptor</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Constraint Descriptor</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseConstraintDescriptor(ConstraintDescriptor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Simple Constraint</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Simple Constraint</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSimpleConstraint(SimpleConstraint object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Composite Constraint</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Composite Constraint</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCompositeConstraint(CompositeConstraint object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Config Property</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Config Property</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseConfigProperty(ConfigProperty object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Value Property</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Value Property</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseValueProperty(ValueProperty object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Reference Property</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Reference Property</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseReferenceProperty(ReferenceProperty object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} // ConstraintsSwitch diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/Activator.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/Activator.java new file mode 100644 index 00000000000..1a8d8d8b43e --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/Activator.java @@ -0,0 +1,66 @@ +/***************************************************************************** + * Copyright (c) 2011, 2016 CEA LIST, Christian W. Damus, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + /** + * The plug-in ID + */ + public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.constraints"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The plug-in's logger + */ + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + log = new LogHelper(this); + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AbstractConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AbstractConstraint.java new file mode 100644 index 00000000000..c758dfd4a0f --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AbstractConstraint.java @@ -0,0 +1,268 @@ +/***************************************************************************** + * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.papyrus.infra.constraints.Activator; +import org.eclipse.papyrus.infra.constraints.ConfigProperty; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; +import org.eclipse.papyrus.infra.constraints.ReferenceProperty; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.ValueProperty; + +/** + * An abstract implementation for the Constraint interface. + * + * @author Camille Letavernier + * + */ +public abstract class AbstractConstraint implements Constraint { + + /** + * The descriptor used to instantiate this constraint. + * Contains some attributes for this constraint + */ + protected ConstraintDescriptor descriptor; + + /** + * The display unit (Section or View) associated to this constraint + */ + protected DisplayUnit display; + + @Override + public final void setConstraintDescriptor(ConstraintDescriptor descriptor) { + this.descriptor = descriptor; + display = getDisplay(descriptor); + if (descriptor instanceof SimpleConstraint) { + setDescriptor((SimpleConstraint) descriptor); + } + } + + private DisplayUnit getDisplay(ConstraintDescriptor descriptor) { + if (descriptor.getDisplay() == null) { + if (descriptor.eContainer() instanceof ConstraintDescriptor) { + return getDisplay((ConstraintDescriptor) descriptor.eContainer()); + } + } + return descriptor.getDisplay(); + } + + @Override + public DisplayUnit getDisplayUnit() { + return display; + } + + /** + * A constraint for a Single element (Exactly one) overrides + * the same constraint for a multiple element (One or more) + */ + @Override + public boolean overrides(Constraint constraint) { + if (equivalent(constraint)) { + if (getDisplayUnit().getElementMultiplicity() == 1) { + if (constraint.getDisplayUnit().getElementMultiplicity() != 1) { + return true; + } + } + } + + return false; + } + + /** + * Tests if two constraints are equivalent. + * Two constraints are equivalent if they have the same parameters. + * Two equivalent constraints may have different Display units, with + * different multiplicities. + * + * @param constraint + * @return + * True if this object is equivalent to the given constraint + */ + protected abstract boolean equivalent(Constraint constraint); + + @Override + public ConstraintDescriptor getDescriptor() { + return descriptor; + } + + /** + * Returns the ConfigProperty corresponding to the given propertyName + * + * @param propertyName + * The name of the property to retrieve + * @return + * The ConfigProperty corresponding to the given propertyName + */ + protected ConfigProperty getProperty(String propertyName) { + if (descriptor == null || !(descriptor instanceof SimpleConstraint)) { + Activator.log.warn("The constraint descriptor has not been set for this constraint : " + this); //$NON-NLS-1$ + } else { + for (ConfigProperty property : ((SimpleConstraint) descriptor).getProperties()) { + if (property.getName().equals(propertyName)) { + return property; + } + } + } + + Activator.log.warn("The property " + propertyName + " has not been set for constraint " + descriptor.getName()); //$NON-NLS-1$ //$NON-NLS-2$ + + return null; + } + + /** + * Tests whether a value is available for the requested property + * + * @param propertyName + * @return + * True if the property exists in the constraint descriptor + */ + protected boolean hasProperty(String propertyName) { + if (descriptor == null || !(descriptor instanceof SimpleConstraint)) { + Activator.log.warn("The constraint descriptor has not been set for this constraint : " + this); //$NON-NLS-1$ + } else { + for (ConfigProperty property : ((SimpleConstraint) descriptor).getProperties()) { + if (property.getName().equals(propertyName)) { + return true; + } + } + } + + return false; + } + + /** + * Returns the value associated to the given property + * + * @param propertyName + * The name of the property for which we want to retrieve the value + * The name must correspond to a valid ValueProperty + * @return + * The value associated to the given property + * + * @see #getReferenceValue(String) + */ + protected String getValue(String propertyName) { + ConfigProperty property = getProperty(propertyName); + + if (property instanceof ValueProperty) { + return ((ValueProperty) property).getValue(); + } + + Activator.log.warn("The property " + propertyName + " is not a ValueProperty (Constraint " + descriptor.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + return null; + } + + /** + * Returns the value associated to the given property + * + * @param propertyName + * The name of the property for which we want to retrieve the value + * The name must correspond to a valid ReferenceProperty + * @return + * The value associated to the given property + * + * @see #getValue(String) + */ + protected Object getReferenceValue(String propertyName) { + ConfigProperty property = getProperty(propertyName); + if (property instanceof ReferenceProperty) { + return ((ReferenceProperty) property).getValue(); + } + + Activator.log.warn("The property " + propertyName + " is not a ReferenceProperty (Constraint " + descriptor.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + return null; + } + + /** + * Sets the Constraint Descriptor for this constraint. + * The constraint descriptor may contain some parameters to configure this + * constraint. + * Implementors may override. + * + * @param descriptor + * The constraint descriptor to be associated to this constraint + * + * @see #setConstraintDescriptor(ConstraintDescriptor) + */ + protected void setDescriptor(SimpleConstraint descriptor) { + // Implementors may override + } + + /** + * {@inheritDoc} + * + * The default implementation matches a selection iff the constraint matches + * each object of the selection. + */ + @Override + public boolean match(Collection<?> selection) { + if (selection.isEmpty()) { + return false; + } + + + int elementMultiplicity; + + elementMultiplicity = display.getElementMultiplicity(); + + int selectionSize = selection.size(); + if (elementMultiplicity == 1) { + if (selectionSize == 1) { + if (match(first(selection))) { + return true; + } + } + } else if (elementMultiplicity == selectionSize || elementMultiplicity < 0) { + Iterator<?> selectionIterator = selection.iterator(); + while (selectionIterator.hasNext()) { + Object selectedItem = selectionIterator.next(); + if (!match(selectedItem)) { + return false; + } + } + + return true; + } + + return false; + } + + protected Object first(Collection<?> collection) { + return (collection instanceof List<?>) + ? ((List<?>) collection).get(0) + : collection.iterator().next(); + } + + /** + * Tests if this constraint matches the given object + * This methods only needs to be implemented when you don't + * override {@link AbstractConstraint#match(IStructuredSelection)} + * + * @param selection + * The object to be tested against this constraint + * @return + * True if this constraint matches the given object + * + * @see {@link #match(IStructuredSelection)} + */ + protected abstract boolean match(Object selection); + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AttachedToResourceConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AttachedToResourceConstraint.java new file mode 100644 index 00000000000..5859aac77fd --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AttachedToResourceConstraint.java @@ -0,0 +1,56 @@ +/***************************************************************************** + * Copyright (c) 2014 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.constraints.constraints; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; + +/** + * A properties view constraint that matches objects that are attached to some resource. + */ +public class AttachedToResourceConstraint extends AbstractConstraint { + + /** + * Initializes me. + */ + public AttachedToResourceConstraint() { + super(); + } + + @Override + protected boolean match(Object selection) { + boolean result = false; + + EObject object = EMFHelper.getEObject(selection); + + if (object != null) { + result = object.eResource() != null; + } + + return result; + } + + @Override + protected boolean equivalent(Constraint constraint) { + if (this == constraint) { + return true; + } + return constraint instanceof AttachedToResourceConstraint; + } + + @Override + public String toString() { + return "AttachedToResourceConstraint"; //$NON-NLS-1$ + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/CompoundConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/CompoundConstraint.java new file mode 100644 index 00000000000..839ef1454b5 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/CompoundConstraint.java @@ -0,0 +1,120 @@ +/***************************************************************************** + * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; + +/** + * A Composite constraint. It matches a given selection if and only if + * all its sub constraints match this selection. + * + * @author Camille Letavernier + */ +public class CompoundConstraint extends AbstractConstraint { + + /** + * Adds a sub-constraint to this constraint + * + * @param subConstraint + * The sub-constraint to be added + */ + public void addConstraint(Constraint subConstraint) { + if (subConstraint == null) { + throw new IllegalArgumentException("The subConstraint shall not be null"); + } + constraints.add(subConstraint); + } + + /** + * A Composite Constraints matches a selection if and only if + * all its inner constraints match it + */ + @Override + public boolean match(Collection<?> selection) { + for (Constraint constraint : constraints) { + if (!constraint.match(selection)) { + return false; + } + } + return true; + } + + @Override + protected boolean match(Object selection) { + // Unused: we override AbstractConstraint#match(IStructuredSelection) + return false; + } + + @Override + public boolean overrides(Constraint constraint) { + if (constraints.size() == 0) { + return false; + } + + if (constraints.size() == 1) { + return constraints.get(0).overrides(constraint); + } + + // A Composite overrides another Composite if at least one sub-constraint overrides another one, + // and each sub-constraint is at least equal to another one + if (constraint instanceof CompoundConstraint) { + boolean atLeastOneOverride = false; + for (Constraint subConstraint : constraints) { + boolean equalsOrOverride = false; + for (Constraint otherSubConstraint : ((CompoundConstraint) constraint).constraints) { + if (subConstraint.overrides(otherSubConstraint)) { + atLeastOneOverride = true; + break; + } + if (subConstraint.equals(otherSubConstraint)) { + equalsOrOverride = true; + } + } + + if (!equalsOrOverride) { + return false; + } + } + + if (atLeastOneOverride) { + return true; + } + } else { // At least one of our constraints must override or be equal to the other constraint + for (Constraint c : constraints) { + if (c.overrides(constraint) || c.equals(constraint)) { + // TODO : The equals() method is not defined for most constraint implementations. + // We may actually need an "isEquivalent" method, defined in the Constraint Interface + return true; + } + } + } + + return false; + } + + @Override + public String toString() { + return constraints.toString(); + } + + private List<Constraint> constraints = new LinkedList<Constraint>(); + + @Override + protected boolean equivalent(Constraint constraint) { + return false; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/Constraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/Constraint.java new file mode 100644 index 00000000000..b6a96f7bc0b --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/Constraint.java @@ -0,0 +1,76 @@ +/***************************************************************************** + * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +import java.util.Collection; + +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; + +/** + * An interface representing a Constraint. A Constraint is used to test if a selection + * is matching a pre-configured property view. + * + * @author Camille Letavernier + * + */ +public interface Constraint { + + /** + * Sets the Constraint Descriptor for this constraint. + * The constraint descriptor may contain some parameters to configure this + * constraint + * + * @param descriptor + * The constraint descriptor to be associated to this constraint + */ + public void setConstraintDescriptor(ConstraintDescriptor descriptor); + + /** + * Tests if this constraint matches the given selection + * + * @param selection + * The selection to be tested against this constraint + * @return + * True if this constraint matches the given selection + */ + public boolean match(Collection<?> selection); + + /** + * Returns the view associated to this constraint, or null if the constraint is associated to another + * kind of display unit (e.g. a section) + * + * @return + * The view associated to this constraint + */ + public DisplayUnit getDisplayUnit(); + + /** + * Tests if this constraint should override the given constraint. If true, + * the other constraint's display unit won't be displayed. A constraint should + * never override itself, and you should ensure that there are no loops in the + * constraint overriding graph. If such a loops occurs, nothing will be displayed + * + * @param constraint + * The tested constraint + * @return + * True if this constraint overrides the given constraint + */ + public boolean overrides(Constraint constraint); + + /** + * @return the constraint descriptor associated to this constraint + */ + public ConstraintDescriptor getDescriptor(); +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/EMFInstanceOfConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/EMFInstanceOfConstraint.java new file mode 100644 index 00000000000..86374d2d625 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/EMFInstanceOfConstraint.java @@ -0,0 +1,117 @@ +/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.papyrus.infra.constraints.Activator; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; + +/** + * A constraint testing if a Selection is an EObject, instance of the given + * EClass. The EClass is identified by its nsURI and name. + * + * @author Camille Letavernier + * + */ +public class EMFInstanceOfConstraint extends AbstractConstraint { + + private String className; + + private String nsUri; + + private EPackage metamodel; + + @Override + protected void setDescriptor(SimpleConstraint descriptor) { + className = getValue("className"); //$NON-NLS-1$ + nsUri = getValue("nsUri"); //$NON-NLS-1$ + metamodel = EPackage.Registry.INSTANCE.getEPackage(nsUri); + if (metamodel == null) { + Activator.log.warn("Metamodel with nsUri " + nsUri + " not found"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * A class constraint overrides its superclass constraints + * e.g. : instanceOf(Class) overrides instanceOf(Classifier) + */ + @Override + public boolean overrides(Constraint otherConstraint) { + if (!(otherConstraint instanceof EMFInstanceOfConstraint)) { + return false; + } + + EMFInstanceOfConstraint constraint = (EMFInstanceOfConstraint) otherConstraint; + EClass thisClass = EMFHelper.getEClass(nsUri, className); + EClass otherClass = EMFHelper.getEClass(constraint.nsUri, constraint.className); + boolean result = (!equals(constraint)) && EMFHelper.isSubclass(thisClass, otherClass) && thisClass != otherClass; + + return result || super.overrides(constraint); + } + + @Override + public boolean match(Object selection) { + if (className == null || nsUri == null) { + return false; + } + + EObject selectedItem = EMFHelper.getEObject(selection); + + if (selectedItem != null) { + if (metamodel == null) { // This may be a dynamic, local (non-registered) EPackage + return EMFHelper.isInstance(selectedItem, className, nsUri); + } else { + return EMFHelper.isInstance(selectedItem, className, metamodel); + } + } + + return false; + } + + @Override + public String toString() { + return "EMFInstanceOfConstraint (" + nsUri + "/" + className + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + @Override + protected boolean equivalent(Constraint constraint) { + if (this == constraint) { + return true; + } + if (constraint == null) { + return false; + } + if (!(constraint instanceof EMFInstanceOfConstraint)) { + return false; + } + EMFInstanceOfConstraint other = (EMFInstanceOfConstraint) constraint; + if (className == null) { + if (other.className != null) { + return false; + } + } else if (!className.equals(other.className)) { + return false; + } + if (nsUri == null) { + if (other.nsUri != null) { + return false; + } + } else if (!nsUri.equals(other.nsUri)) { + return false; + } + return true; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/EMFQueryConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/EMFQueryConstraint.java new file mode 100644 index 00000000000..33d1c361798 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/EMFQueryConstraint.java @@ -0,0 +1,83 @@ +/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + + +/** + * A constraint applying an EMF Query on a selection. The Query should return + * a Boolean. + * + * @author Camille Letavernier + */ +public class EMFQueryConstraint extends AbstractConstraint { + + @Override + protected boolean equivalent(Constraint constraint) { + // TODO Auto-generated method stub + return false; + } + + @Override + protected boolean match(Object selection) { + // TODO Auto-generated method stub + return false; + } + + // private OCLModelQuery query; + // + // @Override + // protected void setDescriptor(SimpleConstraint descriptor) { + // ConfigProperty property = getProperty("query"); //$NON-NLS-1$ + // if(property instanceof ReferenceProperty) { + // query = (OCLModelQuery)getReferenceValue("query"); //$NON-NLS-1$ + // } else { + // String queryExpression = ((ValueProperty)property).getValue(); + // query = QueryFactory.eINSTANCE.createOCLModelQuery(); + // query.setQuery(queryExpression); + // query.setReturnType(EcorePackage.eINSTANCE.getEBoolean()); + // query.getScope().add(EcorePackage.eINSTANCE.getEObject()); + // throw new UnsupportedOperationException(); + // } + // } + // + // public boolean match(Object selection) { + // if(query == null) { + // return false; + // } + // + // EObject selectedItem = EMFHelper.getEObject(selection); + // + // if(selectedItem != null) { + // try { + // ModelQuerySetCatalog catalog = ModelQuerySetCatalog.getSingleton(); + // AbstractModelQuery abstractQuery = catalog.getModelQueryImpl(query); + // ModelQueryResult result = abstractQuery.evaluate(selectedItem); + // Object value = result.getValue(); + // return value == null ? false : (Boolean)value; + // } catch (Exception ex) { + // Activator.log.error(ex); + // } + // + // } + // return false; + // } + // + // @Override + // protected boolean equivalent(Constraint constraint) { + // if(constraint != null && constraint instanceof EMFQueryConstraint) { + // EMFQueryConstraint other = (EMFQueryConstraint)constraint; + // return other.query.equals(query); + // } + // return false; + // } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/HasEAnnotationConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/HasEAnnotationConstraint.java new file mode 100644 index 00000000000..06da4f02a91 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/HasEAnnotationConstraint.java @@ -0,0 +1,55 @@ +/***************************************************************************** + * Copyright (c) 2013 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; + +/** + * A Constraint to test whether the selected EObject has a specific EAnnotation + * + * @author Camille Letavernier + * + */ +public class HasEAnnotationConstraint extends AbstractConstraint { + + protected String annotationName; + + @Override + protected boolean equivalent(Constraint constraint) { + if (constraint instanceof HasEAnnotationConstraint) { + HasEAnnotationConstraint other = (HasEAnnotationConstraint) constraint; + return annotationName.equals(other.annotationName); + } + return false; + } + + @Override + protected void setDescriptor(SimpleConstraint descriptor) { + super.setDescriptor(descriptor); + this.annotationName = getValue("annotationName"); + } + + @Override + protected boolean match(Object selection) { + EObject eObject = EMFHelper.getEObject(selection); + if (eObject instanceof EModelElement) { + EModelElement modelElement = (EModelElement) eObject; + return modelElement.getEAnnotation(annotationName) != null; + } + + return false; + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaInstanceOf.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaInstanceOf.java new file mode 100644 index 00000000000..0f038831a83 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaInstanceOf.java @@ -0,0 +1,46 @@ +/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.tools.util.ClassLoaderHelper; + +/** + * A Constraint to test if an object is an instance of a given + * Java class + * + * @author Camille Letavernier + */ +public class JavaInstanceOf extends AbstractConstraint { + + private Class<?> clazz; + + @Override + public void setDescriptor(SimpleConstraint descriptor) { + clazz = ClassLoaderHelper.loadClass(getValue("class")); //$NON-NLS-1$ + } + + @Override + public boolean match(Object selection) { + if (clazz == null) { + return false; + } + + return clazz.isInstance(selection); + } + + @Override + protected boolean equivalent(Constraint constraint) { + return false; // TODO + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaQuery.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaQuery.java new file mode 100644 index 00000000000..9e3d08b8486 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaQuery.java @@ -0,0 +1,39 @@ +/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +/** + * Represents a Java Query + */ +public interface JavaQuery { + + /** + * Tests whether the query matches a given object + * + * @param selection + * @return + */ + public boolean match(Object selection); + + /** + * A Java query which is always false + * + * @author Camille Letavernier + * + */ + public class FalseQuery implements JavaQuery { + + public boolean match(Object selection) { + return false; + } + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaQueryConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaQueryConstraint.java new file mode 100644 index 00000000000..0aa5cffd5f5 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/JavaQueryConstraint.java @@ -0,0 +1,63 @@ +/***************************************************************************** + * Copyright (c) 2014 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Patrick Tessier (CEA LIST) - Initial API and implementation + /*****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +import org.eclipse.papyrus.infra.constraints.Activator; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.constraints.JavaQuery.FalseQuery; +import org.eclipse.papyrus.infra.tools.util.ClassLoaderHelper; + +/** + * This constraint allows to define a Java Query (without parameters) without + * defining it in an environment file. + * + * The constraint takes one parameter ("className"), which defines the + * qualified name of the Java class used to implement the constraint. + * + * The Java class must implement the {@link JavaQuery} interface + * + * @author Camille Letavernier + */ +public class JavaQueryConstraint extends AbstractConstraint { + + /** + * The Java Class property + */ + public final static String QUERY_CLASS_NAME_PROPERTY = "className"; //$NON-NLS-1$ + + private JavaQuery query = new FalseQuery(); + + @Override + protected void setDescriptor(SimpleConstraint descriptor) { + String queryClassName = getValue(QUERY_CLASS_NAME_PROPERTY); + query = ClassLoaderHelper.newInstance(queryClassName, JavaQuery.class); + if (query == null) { + Activator.log.warn("Cannot load the JavaQuery for this constraint : " + descriptor.getName()); + } + } + + @Override + public boolean match(Object selection) { + return query.match(selection); + } + + @Override + protected boolean equivalent(Constraint constraint) { + if (constraint instanceof JavaQueryConstraint) { + return ((JavaQueryConstraint) constraint).query.getClass().equals(query.getClass()); + } + return false; + } + + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/TrueConstraint.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/TrueConstraint.java new file mode 100644 index 00000000000..050810aba81 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/TrueConstraint.java @@ -0,0 +1,32 @@ +/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.constraints; + +/** + * A Constraint always returning true. + * + * @author Camille Letavernier + */ +public class TrueConstraint extends AbstractConstraint { + + @Override + public boolean match(Object selection) { + return true; + } + + @Override + protected boolean equivalent(Constraint constraint) { + // return constraint != null && constraint instanceof TrueConstraint; + return false; // TrueConstraint is always true ; it shouldn't override another "always true" constraint + } + +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintEngine.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintEngine.java new file mode 100644 index 00000000000..0d93115d4d2 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintEngine.java @@ -0,0 +1,61 @@ +/***************************************************************************** + * Copyright (c) 2010, 2014 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 417409 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.runtime; + +import java.util.Collection; +import java.util.Set; + +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; + +/** + * An interface representing a Constraint Engine. + * The Constraint Engine is responsible for retrieving the DisplayUnits + * to display for a given ISelection. + * + * @author Camille Letavernier + * @param <E> + * The type of DisplayUnit managed by this Constraint Engine + */ +public interface ConstraintEngine<E extends DisplayUnit> { + + /** + * Returns the DisplayUnits matching the given selection + * + * @param a + * plastic "selection" of objects, which may be a {@link Collection} of + * some kind, something convertible to a collection (like a JFace {@code IStructuredSelection}), + * or just a single object + * + * @return the display units applicable to the selection + */ + public Set<E> getDisplayUnits(Object selection); + + /** + * Adds a constraint descriptor to this engine + * + * @param descriptor + */ + public void addConstraint(ConstraintDescriptor descriptor); + + /** + * Indicate that the available constraints might have changed + * Refreshes the Constraint Engine + */ + public void refresh(); + + void addConstraintEngineListener(ConstraintEngineListener listener); + + void removeConstraintEngineListener(ConstraintEngineListener listener); +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintEngineListener.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintEngineListener.java new file mode 100644 index 00000000000..208b50e409f --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintEngineListener.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2014 CEA and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.constraints.runtime; + +import java.util.EventListener; + + +/** + * Protocol for notifications of changes in the constraint listener that may affect its clients. + */ +public interface ConstraintEngineListener extends EventListener { + + /** + * Notifies listeners that the engine's constraints have changed, so any remembered calculation results may need to be recomputed. + * + * @param event + * the notification object + */ + void constraintsChanged(ConstraintsChangedEvent event); +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintFactory.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintFactory.java new file mode 100644 index 00000000000..72aed02e3c2 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintFactory.java @@ -0,0 +1,91 @@ +/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.runtime; + +import org.eclipse.papyrus.infra.constraints.Activator; +import org.eclipse.papyrus.infra.constraints.CompositeConstraint; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.SimpleConstraint; +import org.eclipse.papyrus.infra.constraints.constraints.CompoundConstraint; +import org.eclipse.papyrus.infra.constraints.constraints.Constraint; +import org.eclipse.papyrus.infra.tools.util.ClassLoaderHelper; + + +/** + * A Singleton class for creating {@link Constraint}s from a {@link ConstraintDescriptor} + * + * @author Camille Letavernier + */ +public class ConstraintFactory { + + private ConstraintFactory() { + + } + + /** + * @return the singleton instance + */ + public static ConstraintFactory getInstance() { + return instance; + } + + /** + * Creates a new Constraint from the given ConstraintDescriptor + * + * @param model + * The ConstraintDescriptor describing the Constraint + * @return + * The new constraint instance + */ + public Constraint createFromModel(ConstraintDescriptor model) { + Constraint constraint = null; + if (model instanceof CompositeConstraint) { + CompoundConstraint cConstraint = new CompoundConstraint(); + cConstraint.setConstraintDescriptor(model); + for (SimpleConstraint descriptor : ((CompositeConstraint) model).getConstraints()) { + Constraint subConstraint = loadConstraint(descriptor); + + // One of the subConstraint is invalid : we stop building the constraint + if (subConstraint == null) { + Activator.log.warn("Cannot load constraint " + model.getName()); //$NON-NLS-1$ + return null; + } + + cConstraint.addConstraint(subConstraint); + } + + constraint = cConstraint; + } else { + constraint = loadConstraint((SimpleConstraint) model); + } + return constraint; + } + + private Constraint loadConstraint(SimpleConstraint model) { + Constraint constraint = null; + + if (model.getConstraintType() != null) { + String className = model.getConstraintType().getConstraintClass(); + constraint = ClassLoaderHelper.newInstance(className, Constraint.class); + } + + if (constraint == null) { + Activator.log.warn("Cannot load constraint " + model.getName()); //$NON-NLS-1$ + return null; + } + + constraint.setConstraintDescriptor(model); + return constraint; + } + + private static ConstraintFactory instance = new ConstraintFactory(); +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsChangedEvent.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsChangedEvent.java new file mode 100644 index 00000000000..c6d7776db3b --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsChangedEvent.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2014 CEA and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus (CEA) - Initial API and implementation + * + */ +package org.eclipse.papyrus.infra.constraints.runtime; + +import java.util.EventObject; + + +/** + * Notification object for the {@linkplain ConstraintEngineListener#constraintsChanged(ConstraintsChangedEvent) constraints-changed event}. + */ +public class ConstraintsChangedEvent extends EventObject { + + private static final long serialVersionUID = 1L; + + /** + * Initializes me with my originating constraint engine. + * + * @param source + * my source + */ + public ConstraintsChangedEvent(ConstraintEngine<?> source) { + super(source); + } + + /** + * Queries the constraint engine that generated this event. + * + * @return the source constraint engine + */ + public ConstraintEngine<?> getConstraintEngine() { + return (ConstraintEngine<?>) getSource(); + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java new file mode 100644 index 00000000000..072fe8e856b --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/ConstraintsManager.java @@ -0,0 +1,113 @@ +/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.runtime; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.papyrus.infra.constraints.Activator; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintEnvironment; +import org.eclipse.papyrus.infra.constraints.environment.ConstraintType; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; + +/** + * A singleton instance to manage constraints. + * The available constraints can be loaded from an extension point, or + * dynamically + * + * @author Camille Letavernier + * + */ +public class ConstraintsManager { + + /** + * The Constraints extension point ID + */ + public final static String EXTENSION_ID = Activator.PLUGIN_ID + ".ConstraintEnvironment"; //$NON-NLS-1$ + + private ResourceSet resourceSet; + + private final Set<ConstraintEnvironment> environments; + + private ConstraintsManager() { + environments = new HashSet<ConstraintEnvironment>(); + resourceSet = new ResourceSetImpl(); + loadExtensionPoint(); + } + + private void loadExtensionPoint() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); + + for (IConfigurationElement e : config) { + final String environmentResource = e.getAttribute("environmentModel"); //$NON-NLS-1$ + URI uri = URI.createPlatformPluginURI(e.getContributor().getName() + "/" + environmentResource, true); //$NON-NLS-1$ + try { + addEnvironment(uri); + } catch (IOException ex) { + Activator.log.error("The plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex); //$NON-NLS-1$//$NON-NLS-2$ + } + } + } + + /** + * Adds a constraint environment model, which should be loaded at + * the given URI. The root element should be a {@link ConstraintEnvironment} + * + * @param uri + * The location of the model to load. Its root element should be a {@link ConstraintEnvironment} + * @throws IOException + * If the model cannot be loaded + */ + public void addEnvironment(URI uri) throws IOException { + EObject model = EMFHelper.loadEMFModel(resourceSet, uri); + if (model instanceof ConstraintEnvironment) { + addEnvironment((ConstraintEnvironment) model); + } + } + + /** + * Adds a constraint environment model to the manager + * + * @param environment + * The {@link ConstraintEnvironment} to add to the manager + */ + public void addEnvironment(ConstraintEnvironment environment) { + environments.add(environment); + } + + /** + * The singleton instance of {@link ConstraintsManager} + */ + public static final ConstraintsManager instance = new ConstraintsManager(); + + /** + * Returns all {@link ConstraintType}s contained in the {@link ConstraintEnvironment} managed by this singleton + * + * @return + * All known {@link ConstraintType}s + */ + public Collection<ConstraintType> getConstraintTypes() { + Collection<ConstraintType> constraintTypes = new HashSet<ConstraintType>(); + for (ConstraintEnvironment environment : environments) { + constraintTypes.addAll(environment.getConstraintTypes()); + } + return constraintTypes; + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/DefaultConstraintEngine.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/DefaultConstraintEngine.java new file mode 100644 index 00000000000..63bae2ba467 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/runtime/DefaultConstraintEngine.java @@ -0,0 +1,226 @@ +/***************************************************************************** + * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 417409 + * Christian W. Damus - bug 485220 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.runtime; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.papyrus.infra.constraints.Activator; +import org.eclipse.papyrus.infra.constraints.ConstraintDescriptor; +import org.eclipse.papyrus.infra.constraints.DisplayUnit; +import org.eclipse.papyrus.infra.constraints.constraints.Constraint; + +/** + * The default, generic implementation for ConstraintEngine + * + * @author Camille Letavernier + * @param <E> + * The type of DisplayUnit managed by this Constraint Engine + */ +public abstract class DefaultConstraintEngine<E extends DisplayUnit> implements ConstraintEngine<E> { + + // Pattern for names of methods that convert an object to a collection + private static final Pattern CONVERTER_PATTERN = Pattern.compile("(?:to|as)(?:Collection|List|Set)"); //$NON-NLS-1$ + + private static final Method NO_CONVERTER = Object.class.getMethods()[0]; + + private final ListenerList listeners = new ListenerList(ListenerList.IDENTITY); + + /** + * The constraints instantiated by this Engine + */ + protected final Set<Constraint> constraints = new LinkedHashSet<Constraint>(); + + private final Class<? extends E> displayUnitType; + + private final Map<Class<?>, Method> collectionConverters = new HashMap<>(); + + protected DefaultConstraintEngine(Class<? extends E> displayUnitType) { + super(); + + this.displayUnitType = displayUnitType; + } + + @Override + public abstract void refresh(); + + @Override + public synchronized void addConstraint(ConstraintDescriptor descriptor) { + Constraint constraint = ConstraintFactory.getInstance().createFromModel(descriptor); + if (constraint != null) { + constraints.add(constraint); + } + } + + @Override + public synchronized Set<E> getDisplayUnits(final Object selection) { + Collection<?> collection = asCollection(selection); + + Set<Constraint> matchedConstraints = match(collection); + + return getDisplayUnits(matchedConstraints); + } + + private Set<Constraint> match(final Collection<?> selection) { + Set<Constraint> matchedConstraints = new LinkedHashSet<Constraint>(); + + if (selection.isEmpty()) { + return matchedConstraints; + } + + for (Constraint c : constraints) { + try { + if (c.match(selection)) { + matchedConstraints.add(c); + } + } catch (Throwable ex) { + String errorMessage = String.format("An error occurred when executing the matching constraint %s. This constraint will be ignored", c.getDescriptor().getName()); + Activator.log.error(errorMessage, ex); + } + + } + + // String logValue; + // + // logValue = "Filtered Constraints : "; //$NON-NLS-1$ + // for(Constraint constraint : matchedConstraints) { + // logValue += constraint.getDescriptor().getName() + ", "; + // } + // Activator.log.warn(logValue); + + resolveConstraintConflicts(matchedConstraints); + + // logValue = "Filtered Constraints : "; //$NON-NLS-1$ + // for(Constraint constraint : matchedConstraints) { + // logValue += constraint.getDescriptor().getName() + ", "; + // } + // + // Activator.log.warn(logValue); + + return matchedConstraints; + } + + private void resolveConstraintConflicts(final Set<Constraint> matchedConstraints) { + Set<Constraint> constraintsSet = new HashSet<Constraint>(matchedConstraints); + for (Constraint c : constraintsSet) { + for (Constraint c2 : constraintsSet) { + if (c == c2) { + continue; + } + + if (c.getDescriptor().getOverriddenConstraints().contains(c2.getDescriptor())) { + matchedConstraints.remove(c2); + continue; + } + + if (c2.getDescriptor().isOverrideable() && c.overrides(c2)) { + matchedConstraints.remove(c2); + continue; + } + } + } + } + + private Set<E> getDisplayUnits(final Set<Constraint> matchedConstraints) { + Set<E> displayUnits = new LinkedHashSet<E>(); + for (Constraint c : matchedConstraints) { + displayUnits.add(displayUnitType.cast(c.getDescriptor().getDisplay())); + } + return displayUnits; + } + + @Override + public void addConstraintEngineListener(ConstraintEngineListener listener) { + listeners.add(listener); + } + + @Override + public void removeConstraintEngineListener(ConstraintEngineListener listener) { + listeners.remove(listener); + } + + protected void fireConstraintsChanged() { + if (!listeners.isEmpty()) { + Object[] toNotify = listeners.getListeners(); + ConstraintsChangedEvent event = new ConstraintsChangedEvent(this); + for (int i = 0; i < toNotify.length; i++) { + try { + ((ConstraintEngineListener) toNotify[i]).constraintsChanged(event); + } catch (Exception e) { + Activator.log.error("Uncaught exception in constraints-changed listener.", e); //$NON-NLS-1$ + } + } + } + } + + private Collection<?> asCollection(Object object) { + Collection<?> result; + + if (object == null) { + result = Collections.EMPTY_LIST; + } else if (object instanceof Collection<?>) { + result = (Collection<?>) object; + } else if (object instanceof Iterable<?>) { + result = StreamSupport.stream(((Iterable<?>) object).spliterator(), false).collect(Collectors.toList()); + } else { + Method converter = getToCollectionMethod(object); + if (converter != null) { + try { + result = (Collection<?>) converter.invoke(object); + } catch (Exception e) { + // Converter not valid. Fine. Don't try it again + rejectConverter(object); + result = Collections.EMPTY_LIST; + } + } else { + result = Collections.singletonList(object); + } + } + + return result; + } + + private Method getToCollectionMethod(Object object) { + Class<?> key = object.getClass(); + Method result = collectionConverters.computeIfAbsent(key, owner -> { + for (Method next : owner.getMethods()) { + if (((next.getModifiers() & Modifier.STATIC) == 0) + && Collection.class.isAssignableFrom(next.getReturnType()) + && (next.getParameterCount() == 0) + && CONVERTER_PATTERN.matcher(next.getName()).matches()) { + return next; + } + } + return NO_CONVERTER; + }); + + return (result == NO_CONVERTER) ? null : result; + } + + private void rejectConverter(Object object) { + collectionConverters.put(object.getClass(), NO_CONVERTER); + } +} diff --git a/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/util/ClassLoader.java b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/util/ClassLoader.java new file mode 100644 index 00000000000..ab0ad2832d0 --- /dev/null +++ b/plugins/infra/constraints/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/util/ClassLoader.java @@ -0,0 +1,84 @@ +/***************************************************************************** + * 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: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.constraints.util; + +import org.eclipse.papyrus.infra.constraints.Activator; + +/** + * A Helper class for Class Loading. + * + * @author Camille Letavernier + */ +public class ClassLoader { + + /** + * Loads the class matching the given className. Exceptions are caught and sent + * to the Logger. + * + * @param className + * The qualified name of the Class to load. + * @return + * The loaded Class, or null if an error occured + */ + public Class<?> loadClass(String className) { + try { + Class<?> clazz = Activator.getDefault().getBundle().loadClass(className); + return clazz; + } catch (ClassNotFoundException ex) { + Activator.log.error("Cannot load class " + className, ex); //$NON-NLS-1$ + } catch (ClassCastException ex) { + Activator.log.error("Cannot load class " + className, ex); //$NON-NLS-1$ + } catch (NullPointerException ex) { + Activator.log.error("Cannot load class " + className, ex); //$NON-NLS-1$ + } + + return null; + } + + /** + * Returns a new Instance of the given class + * + * @param className + * The qualified name of the Class to instantiate + * @return + * A new instance of the given class, or null if the class couldn't be + * instantiated + */ + public Object newInstance(String className) { + return newInstance(loadClass(className)); + } + + /** + * Returns a new Instance of the given class + * + * @param theClass + * The Class to instantiate + * @return + * A new instance of the given class, or null if the class couldn't be + * instantiated + */ + public <T extends Object> T newInstance(Class<T> theClass) { + if (theClass == null) { + return null; + } + + try { + return theClass.newInstance(); + } catch (IllegalAccessException ex) { + Activator.log.error(ex); + } catch (InstantiationException ex) { + Activator.log.error(ex); + } + + return null; + } +} diff --git a/plugins/infra/constraints/pom.xml b/plugins/infra/constraints/pom.xml new file mode 100644 index 00000000000..f5e1d348b6a --- /dev/null +++ b/plugins/infra/constraints/pom.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<project> + <modelVersion>4.0.0</modelVersion> + <artifactId>org.eclipse.papyrus.infra-constraints</artifactId> + <packaging>pom</packaging> + <parent> + <groupId>org.eclipse.papyrus</groupId> + <artifactId>org.eclipse.papyrus.infra</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <name>Papyrus Infra Constraints</name> + <description>Model and UI for constraints supporting conditional UI presentation as in the Papyrus Properties framework.</description> + + <modules> + <module>org.eclipse.papyrus.infra.constraints</module> + <module>org.eclipse.papyrus.infra.constraints.edit</module> + <module>org.eclipse.papyrus.infra.constraints.editor</module> + <module>org.eclipse.papyrus.infra.constraints.ui</module> + </modules> +</project> |