diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.classpath b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.project b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.project new file mode 100644 index 00000000..0dfc6236 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.integration + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.settings/org.eclipse.jdt.core.prefs b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..dcf24084 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,426 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes=_p +org.eclipse.jdt.core.codeComplete.fieldPrefixes=_ +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=__ +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +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_bitwise_operator=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_logical_operator=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_multiplicative_operator=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_string_concatenation=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_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=80 +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=2 +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_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_additive_operator=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_bitwise_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_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=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_relational_operator=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_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=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_bitwise_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_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=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_relational_operator=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_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=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=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +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=80 +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=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=2 +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_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/META-INF/MANIFEST.MF b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/META-INF/MANIFEST.MF new file mode 100644 index 00000000..f15620e9 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Bridge Mapping Capella Scopes +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.integration +Bundle-Version: 0.14.1.qualifier +Bundle-Activator: org.polarsys.capella.diffmerge.bridge.integration.internal.Activator +Require-Bundle: org.eclipse.emf.diffmerge.bridge.interactive, + org.eclipse.emf.diffmerge.bridge.mapping, + org.polarsys.capella.core.compare;bundle-version="1.4.0", + org.polarsys.capella.core.model.skeleton;bundle-version="1.4.0", + org.polarsys.capella.core.model.handler;bundle-version="1.4.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: org.polarsys.capella.diffmerge.bridge.integration, + org.polarsys.capella.diffmerge.bridge.integration.policies, + org.polarsys.capella.diffmerge.bridge.integration.scopes, + org.polarsys.capella.diffmerge.bridge.integration.util +Bundle-Vendor: www.polarsys.org +Automatic-Module-Name: org.polarsys.capella.diffmerge.bridge.capella.integration diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/about.html b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

About This Content

+ +

August 17, 2018

+

License

+

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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

+

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 http://www.eclipse.org.

+ + \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/build.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/build.properties new file mode 100644 index 00000000..883cfc6d --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/build.properties @@ -0,0 +1,13 @@ +############################################################################### +# Copyright (c) 2016-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . +jre.compilation.profile = J2SE-1.5 diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/CapellaBridgeJob.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/CapellaBridgeJob.java new file mode 100644 index 00000000..6fadbb91 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/CapellaBridgeJob.java @@ -0,0 +1,336 @@ +/********************************************************************* + * Copyright (c) 2016-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.integration; + +import static org.eclipse.emf.diffmerge.impl.policies.ConfigurableMatchPolicy.CRITERION_SEMANTICS_DEFAULTCONTENTS; +import static org.eclipse.emf.diffmerge.impl.policies.ConfigurableMatchPolicy.CRITERION_STRUCTURE_ROOTS; +import static org.eclipse.emf.diffmerge.impl.policies.ConfigurableMatchPolicy.MatchCriterionKind.SEMANTICS; +import static org.eclipse.emf.diffmerge.impl.policies.ConfigurableMatchPolicy.MatchCriterionKind.STRUCTURE; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.diffmerge.generic.api.IDiffPolicy; +import org.eclipse.emf.diffmerge.generic.api.IMatchPolicy; +import org.eclipse.emf.diffmerge.generic.api.IMergePolicy; +import org.eclipse.emf.diffmerge.generic.api.IMergeSelector; +import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; +import org.eclipse.emf.diffmerge.bridge.api.IBridge; +import org.eclipse.emf.diffmerge.bridge.api.IBridgeTrace; +import org.eclipse.emf.diffmerge.bridge.api.IBridgeTrace.Editable; +import org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob; +import org.eclipse.emf.diffmerge.bridge.interactive.EMFInteractiveBridge; +import org.eclipse.emf.diffmerge.bridge.interactive.util.ResourceUtil; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.emf.EMFMappingBridge; +import org.eclipse.emf.diffmerge.diffdata.EComparison; +import org.eclipse.emf.diffmerge.diffdata.impl.EComparisonImpl; +import org.eclipse.emf.diffmerge.impl.policies.ConfigurableDiffPolicy; +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.edit.domain.AdapterFactoryEditingDomain; +import org.eclipse.emf.edit.domain.EditingDomain; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.polarsys.capella.common.ef.ExecutionManager; +import org.polarsys.capella.common.ef.ExecutionManagerRegistry; +import org.polarsys.capella.common.ef.command.ICommand; +import org.polarsys.capella.core.compare.CapellaMatchPolicy; +import org.polarsys.capella.core.data.capellamodeller.Project; +import org.polarsys.capella.core.model.handler.helpers.CapellaProjectHelper.ProjectApproach; +import org.polarsys.capella.core.model.skeleton.EngineeringDomain; +import org.polarsys.capella.core.model.skeleton.impl.SkeletonServicesImpl; +import org.polarsys.capella.core.model.skeleton.impl.cmd.CreateCapellaProjectCmd; +import org.polarsys.capella.diffmerge.bridge.integration.policies.DelegatingTraceBasedMatchPolicy; +import org.polarsys.capella.diffmerge.bridge.integration.scopes.CapellaIntermediateUpdateScope; +import org.polarsys.capella.diffmerge.bridge.integration.scopes.CapellaUpdateScope; + + +/** + * A bridge job pre-configured for Capella models as targets. + * + * @author Amine Lajmi + * + * @param the source data set + */ +public class CapellaBridgeJob extends BridgeJob { + + /** + * The default bridge job label + */ + private static final String DEFAULT_BRIDGE_JOB_LABEL = "Capella Bridge Job"; //$NON-NLS-1$ + + /** + * The default constructor + * + * @param context_p the (non-null) source data set + * @param targetURI_p the (non-null) uri of the target resource + */ + public CapellaBridgeJob(SD context_p, URI targetURI_p) { + this(DEFAULT_BRIDGE_JOB_LABEL, context_p, targetURI_p); + } + + /** + * Additional constructor with custom bridge job label + * + * @param jobLabel_p the (non-null) job label + * @param context_p the (non-null) context + * @param targetURI_p the (non-null) uri of the target resource + */ + public CapellaBridgeJob(String jobLabel_p, SD context_p, URI targetURI_p) { + super(jobLabel_p, context_p, targetURI_p); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob#getBridge() + */ + @Override + protected EMFInteractiveBridge getBridge() { + EMFInteractiveBridge result = + new EMFInteractiveBridge( + createMappingBridge(), createDiffPolicy(), createMergePolicy(), createMergeSelector()) { + /** + * @see org.eclipse.emf.diffmerge.bridge.incremental.EMFIncrementalBridge#createIntermediateDataSet(java.lang.Object, org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope) + */ + @Override + public IEditableModelScope createIntermediateDataSet(SD sourceDataSet_p, IEditableModelScope targetDataSet_p) { + if (targetDataSet_p instanceof CapellaUpdateScope) { + // make an in-memory copy of the existing model + final Project emptyProject = createEmptyProject(targetDataSet_p); + CapellaUpdateScope scope = new CapellaUpdateScope(emptyProject); + return createIntermediateCapellaScope(sourceDataSet_p, scope); + } + return super.createIntermediateDataSet(sourceDataSet_p, targetDataSet_p); + } + /** + * @see org.eclipse.emf.diffmerge.bridge.incremental.EMFIncrementalBridge#compare(org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope, org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope, org.eclipse.emf.diffmerge.bridge.api.IBridgeTrace, org.eclipse.emf.diffmerge.bridge.api.IBridgeTrace, org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + protected EComparison compare(IEditableModelScope created_p, IEditableModelScope existing_p, IBridgeTrace createdTrace_p, IBridgeTrace existingTrace_p, IProgressMonitor monitor_p) { + EComparison comparison = new EComparisonImpl(existing_p, created_p); + IMatchPolicy delegate = createMatchPolicyDelegate(); + IMatchPolicy matchPolicy = createDelegatingMatchPolicy(created_p, createdTrace_p, existingTrace_p, delegate); + comparison.compute(matchPolicy, getDiffPolicy(), getMergePolicy(), monitor_p); + return comparison; + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.incremental.EMFIncrementalBridge#createTrace() + */ + @Override + protected Editable createTrace() { + Editable trace = super.createTrace(); + return configureTrace(trace); + } + }; + return result; + } + + /** + * For default trace customization + * + * @param trace_p the (non-null) the default created trace + * @return the (non-null) trace with additional configurations, by default + * do nothing. + */ + protected Editable configureTrace(Editable trace_p) { + return trace_p; + } + + /** + * @return the default merge policy + */ + protected IMergePolicy createMergePolicy() { + return null; + } + + /** + * @return the default merge selector + */ + protected IMergeSelector createMergeSelector() { + return null; + } + + /** + * @return the default configurable diff policy + */ + protected IDiffPolicy createDiffPolicy() { + return new ConfigurableDiffPolicy(); + } + + /** + * @return the extended EMF mapping bridge + */ + protected IBridge createMappingBridge() { + return new EMFMappingBridge(); + } + + /** + * Creates and configures the match policy to delegate to. By default, the + * following fine-grained criteria are used: + *
  • Structural matching of roots + *
  • Semantic matching of project structure + * + * @return the match policy to delegate to. + */ + protected IMatchPolicy createMatchPolicyDelegate() { + CapellaMatchPolicy delegate = new CapellaMatchPolicy(); + delegate.setUseCriterion(STRUCTURE, true); + delegate.setUseCriterion(SEMANTICS, true); + delegate.setUseFineGrainedCriterion(CRITERION_STRUCTURE_ROOTS, true); + delegate.setUseFineGrainedCriterion(CRITERION_SEMANTICS_DEFAULTCONTENTS, true); + return delegate; + } + + /** + * Creates and configures a delegating match policy with default delegation + * configured to the match policy returned by + * {@link org.polarsys.capella.diffmerge.bridge.integration.CapellaBridgeJob#createMatchPolicyDelegate() + * createMatchPolicyDelegate}. + * + * @param createdScope_p a non-null model scope + * @param createdTrace_p a non-null trace + * @param existingTrace_p a non-null trace + * @param delegate_p the non-null match policy to delegate to + * @return the delegating match policy. + */ + protected IMatchPolicy createDelegatingMatchPolicy(IEditableModelScope createdScope_p, + IBridgeTrace createdTrace_p, IBridgeTrace existingTrace_p, IMatchPolicy delegate_p) { + IMatchPolicy matchPolicy = new DelegatingTraceBasedMatchPolicy( + createdScope_p, createdTrace_p, existingTrace_p, delegate_p); + return matchPolicy; + } + + /** + * Creates an intermediate model scope tailored for Capella models + * + * @param sourceDataSet_p the (non-null) source data set + * @param scope the (non-null) Capella model scope + * @return the intermediate model scope + */ + protected IEditableModelScope createIntermediateCapellaScope(SD sourceDataSet_p, CapellaUpdateScope scope) { + return new CapellaIntermediateUpdateScope(sourceDataSet_p, scope); + } + + /** + * Creates a fake resource hosting a freshly created empty Capella model + * + * @param targetDataSet_p + * the target data set from which to retrieve and load the + * Capella model + * @return a fresh empty Capella model root + */ + protected Project createEmptyProject(final IEditableModelScope targetDataSet_p) { + TransactionalEditingDomain editingDomain = getTargetEditingDomain(targetDataSet_p); + Project capellaRoot = ((CapellaUpdateScope) targetDataSet_p).getProject(); + URI targetURI = capellaRoot.eResource().getURI(); + + // create a new empty model + ExecutionManager executionManager = ExecutionManagerRegistry + .getInstance().getExecutionManager(editingDomain); + ResourceSet resourceSet = editingDomain.getResourceSet(); + + Resource resource = resourceSet.getResource(targetURI, true); + final Project project = (Project) resource.getContents().get(0); + + ICommand command = null; + Resource semanticResource = null; + String projectName = project.getName(); + + URI uri = URI.createURI("dummy:/" + targetURI.devicePath()); //$NON-NLS-1$ + + semanticResource = resourceSet.createResource(uri); + command = createInitialElementsCommand(semanticResource, projectName, new NullProgressMonitor()); + if (command != null) { + executionManager.execute(command); + } + // invoke the skeleton services used by default in Capella to create the + // in-memory empty Capella project + SkeletonServicesImpl skeletonServicesImpl = new SkeletonServicesImpl(); + EngineeringDomain engDomain = EngineeringDomain.System; + Project tmpProject = (Project) semanticResource.getContents().get(0); + skeletonServicesImpl.doSystemEngineering(tmpProject, projectName, engDomain, true); + return tmpProject; + } + + /** + * Returns the transactional editing domain given the target data set + * + * @param targetDataSet_p the (non-null) target data set + * @return the (possibly null) editing domain + */ + protected TransactionalEditingDomain getTargetEditingDomain(IEditableModelScope targetDataSet_p) { + if (targetDataSet_p instanceof CapellaUpdateScope) { + EObject scopeRoot = ((CapellaUpdateScope) targetDataSet_p).getProject(); + ResourceSet resourceSet = scopeRoot.eResource().getResourceSet(); + return (TransactionalEditingDomain) AdapterFactoryEditingDomain.getEditingDomainFor(resourceSet); + } + return null; + } + + /** + * Issues the initial Capella model elements creation command + * + * @param resource_p the initially empty semantic resource + * @param projectName_p the (non-null) Capella project name + * @param monitor_p a (non-null) progress monitor + * @return the initial elements creation command + */ + protected ICommand createInitialElementsCommand(Resource resource_p, String projectName_p, IProgressMonitor monitor_p) { + return new CreateCapellaProjectCmd(resource_p, projectName_p, ProjectApproach.SingletonComponents); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob#getTargetEditingDomain() + */ + @Override + protected EditingDomain getTargetEditingDomain() { + EditingDomain result = null; + ResourceSet rs = getTargetResourceSet(); + result = AdapterFactoryEditingDomain.getEditingDomainFor(rs); + return result; + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob#initializeTargetResourceSet() + */ + @Override + protected ResourceSet initializeTargetResourceSet() { + ExecutionManager executionManager = ExecutionManagerRegistry.getInstance().addNewManager(); + TransactionalEditingDomain domain = executionManager.getEditingDomain(); + return domain.getResourceSet(); + } + + /** + * Loads trace resource into a separate resource set. + * + * @param traceURI_p + * the (non-null) trace URI + * @return trace resource + */ + @Override + protected Resource getCreateTraceResource(URI traceURI_p) { + ResourceSetImpl rs = new ResourceSetImpl(); + Resource traceResource = ResourceUtil.getCreateResourceForUri(traceURI_p, rs); + ResourceUtil.ensureLoaded(traceResource); + return traceResource; + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob#getTargetScope(org.eclipse.emf.ecore.resource.Resource) + */ + @Override + protected IEditableModelScope getTargetScope(final Resource resource_p) { + Project project = (Project) resource_p.getContents().get(0); + return new CapellaUpdateScope(project); + } +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/internal/Activator.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/internal/Activator.java new file mode 100644 index 00000000..72e7ce7e --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/internal/Activator.java @@ -0,0 +1,49 @@ +/********************************************************************* + * Copyright (c) 2016-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.integration.internal; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * The bundle activator + */ +public class Activator implements BundleActivator { + + /** + * The bundle context + */ + private static BundleContext context; + + /** + * @return the bundle context + */ + static BundleContext getContext() { + return context; + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + Activator.context = null; + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/DelegatingTraceBasedMatchPolicy.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/DelegatingTraceBasedMatchPolicy.java new file mode 100644 index 00000000..9af2303a --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/DelegatingTraceBasedMatchPolicy.java @@ -0,0 +1,73 @@ +/********************************************************************* + * Copyright (c) 2016-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.integration.policies; + +import org.eclipse.emf.diffmerge.bridge.api.IBridgeTrace; +import org.eclipse.emf.diffmerge.bridge.incremental.BridgeTraceBasedMatchPolicy; +import org.eclipse.emf.diffmerge.generic.api.IMatchPolicy; +import org.eclipse.emf.diffmerge.generic.api.scopes.ITreeDataScope; +import org.eclipse.emf.ecore.EObject; + +/** + * A delegating trace-based match policy. It uses the trace primarily to return + * match identifiers, when it cannot, it delegate to a second matching policy. + * + */ +public class DelegatingTraceBasedMatchPolicy extends + BridgeTraceBasedMatchPolicy { + + /** + * The second match policy to delegate to + */ + private final IMatchPolicy delegate; + + /** + * Default constructor + * + * @param createdScope_p + * a non-null model scope + * @param createdTrace_p + * a non-null trace + * @param existingTrace_p + * a non-null trace + * @param delegate_p + * the non-null match policy to delegate to + */ + public DelegatingTraceBasedMatchPolicy(ITreeDataScope createdScope_p, + IBridgeTrace createdTrace_p, IBridgeTrace existingTrace_p, + IMatchPolicy delegate_p) { + super(createdScope_p, createdTrace_p, existingTrace_p); + this.delegate = delegate_p; + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.incremental.BridgeTraceBasedMatchPolicy#getMatchID(java.lang.Object, org.eclipse.emf.diffmerge.generic.api.scopes.ITreeDataScope) + */ + @Override + public Object getMatchID(EObject element_p, ITreeDataScope scope_p) { + IBridgeTrace trace = scope_p == _createdScope ? _createdTrace + : _existingTrace; + Object result = trace.getCause(element_p); + if (result == null) + result = getDelegate().getMatchID(element_p, scope_p); + return result; + } + + /** + * Returns the match policy this policy delegates to. + * + * @return the match policy delegate. + */ + protected IMatchPolicy getDelegate() { + return delegate; + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/Messages.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/Messages.java new file mode 100644 index 00000000..9cb1d884 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/Messages.java @@ -0,0 +1,48 @@ +/********************************************************************* + * Copyright (c) 2016-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.integration.policies; + +import org.eclipse.osgi.util.NLS; + + +/** + * Message management. + */ +@SuppressWarnings("javadoc") +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.polarsys.capella.diffmerge.bridge.capella.integration.policies.messages"; //$NON-NLS-1$ + + public static String ConfigurableMatchPolicy_Semantics_DefaultContents_Description; + public static String ConfigurableMatchPolicy_Semantics_DefaultContents_Name; + public static String ConfigurableMatchPolicy_Structure_Children_Description; + public static String ConfigurableMatchPolicy_Structure_Children_Name; + public static String ConfigurableMatchPolicy_Structure_Roots_Description; + public static String ConfigurableMatchPolicy_Structure_Roots_Name; + public static String ConfigurableMatchPolicy_Structure_UniqueChildren_Description; + public static String ConfigurableMatchPolicy_Structure_UniqueChildren_Name; + public static String DecoratedCapellaComparisonMethodFactory_TechnicalElements_Name; + public static String DecoratedCapellaComparisonMethodFactory_TechnicalElements_Description; + public static String DecoratedCapellaComparisonMethodFactory_Links_Name; + public static String DecoratedCapellaComparisonMethodFactory_Links_Description; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + /** + * Constructor + */ + private Messages() { + // Nothing needed + } +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/messages.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/messages.properties new file mode 100644 index 00000000..8b8ee153 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/policies/messages.properties @@ -0,0 +1,20 @@ +############################################################################### +# Copyright (c) 2016-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +ConfigurableMatchPolicy_Structure_Children_Description=Match elements that have the same container and cannot be confused with other siblings (more general than "Match unique children"). +ConfigurableMatchPolicy_Structure_Children_Name=Match unambiguous children +ConfigurableMatchPolicy_Semantics_DefaultContents_Description=When a new model is being created, it is usually filled with default model elements: match these default elements if present.\nIt may only work if the top-level elements of the models match (see "Structure - Match unambiguous roots"). +ConfigurableMatchPolicy_Semantics_DefaultContents_Name=Match default model contents +ConfigurableMatchPolicy_Structure_Roots_Description=Match root elements that cannot be confused with others. +ConfigurableMatchPolicy_Structure_Roots_Name=Match unambiguous roots +ConfigurableMatchPolicy_Structure_UniqueChildren_Description=Match elements that have the same container and play the same discriminating role within it. +ConfigurableMatchPolicy_Structure_UniqueChildren_Name=Match unique children +DecoratedCapellaComparisonMethodFactory_Links_Name=Capella Exchanges/Links: Name according to ends +DecoratedCapellaComparisonMethodFactory_Links_Description=Take into account the ends of Exchanges or Links to name them.\nExchanges or links that have the same name but connect different elements will thus be distinguished. +DecoratedCapellaComparisonMethodFactory_TechnicalElements_Name=Match equivalent technical elements +DecoratedCapellaComparisonMethodFactory_TechnicalElements_Description=Certain elements are purely technical and usually invisible to model users: for example, allocations of Capella functions to components.\nMatch such elements according to their meaning: for example, match allocations of the same function to the same component. \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/scopes/CapellaIntermediateUpdateScope.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/scopes/CapellaIntermediateUpdateScope.java new file mode 100644 index 00000000..e42483c5 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/scopes/CapellaIntermediateUpdateScope.java @@ -0,0 +1,56 @@ +/********************************************************************* + * Copyright (c) 2016-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.integration.scopes; + +import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; +import org.eclipse.emf.diffmerge.bridge.incremental.Messages; + +/** + * A Capella intermediate model scope exposing its target data set + */ +public class CapellaIntermediateUpdateScope extends CapellaUpdateScope { + + /** The optional source data set */ + protected final Object _sourceDataSet; + + /** The optional target data set */ + protected final IEditableModelScope _targetDataSet; + + /** + * Constructor + * + * @param sourceDataSet_p a (non-null) source data set + * @param targetDataSet_p a (non-null) target data set + */ + public CapellaIntermediateUpdateScope(Object sourceDataSet_p, + CapellaUpdateScope targetDataSet_p) { + super(targetDataSet_p.getProject()); + _sourceDataSet = sourceDataSet_p; + _targetDataSet = targetDataSet_p; + } + + /** + * @see org.eclipse.emf.diffmerge.impl.scopes.AbstractModelScope#getOriginator() + */ + @Override + public Object getOriginator() { + return Messages.IntermediateModelScope_Originator; + } + + /** + * @return the target data set + */ + @Override + public IEditableModelScope getTargetDataSet() { + return _targetDataSet; + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/scopes/CapellaUpdateScope.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/scopes/CapellaUpdateScope.java new file mode 100644 index 00000000..20981056 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/scopes/CapellaUpdateScope.java @@ -0,0 +1,80 @@ +/********************************************************************* + * Copyright (c) 2016-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.integration.scopes; + +import java.util.ArrayList; +import java.util.Arrays; + +import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; +import org.eclipse.emf.diffmerge.impl.scopes.RootedModelScope; +import org.eclipse.emf.ecore.EObject; +import org.polarsys.capella.core.data.capellamodeller.Project; + +/** + * A model scope rooted at the Capella project to be used in incremental bridges + * + */ +public class CapellaUpdateScope extends RootedModelScope { + + /** + * The label of the already persisted target scope as it will appear in the + * diff/merge UI. + */ + private static final String TARGET_ORIGINATOR_LABEL = "Resulting Model"; //$NON-NLS-1$ + + /** + * The Capella model root + */ + private final Project _project; + + /** + * The unique entry point to this scope + * + * @param project_p the (non-null) Capella project + */ + public CapellaUpdateScope(final Project project_p) { + super(new ArrayList(Arrays.asList(project_p)), true); + this._project = project_p; + } + + /** + * @see org.eclipse.emf.diffmerge.impl.scopes.RootedModelScope#add(org.eclipse.emf.ecore.EObject) + */ + @Override + public boolean add(final EObject element_p) { + return super.add(element_p); + } + + /** + * @see org.eclipse.emf.diffmerge.impl.scopes.AbstractModelScope#getOriginator() + */ + @Override + public Object getOriginator() { + return TARGET_ORIGINATOR_LABEL; + } + + /** + * Expose the root to outside. + * + * @return the Capella model root + */ + public Project getProject() { + return _project; + } + + /** + * @return the target data set + */ + public IEditableModelScope getTargetDataSet() { + return this; + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/util/CapellaUtil.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/util/CapellaUtil.java new file mode 100644 index 00000000..b91308b8 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.capella.integration/src/org/polarsys/capella/diffmerge/bridge/integration/util/CapellaUtil.java @@ -0,0 +1,285 @@ +/********************************************************************* + * Copyright (c) 2016-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.integration.util; + +import java.util.List; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.polarsys.capella.core.data.capellamodeller.ModelRoot; +import org.polarsys.capella.core.data.capellamodeller.Project; +import org.polarsys.capella.core.data.capellamodeller.SystemEngineering; +import org.polarsys.capella.core.data.fa.FunctionPkg; +import org.polarsys.capella.core.data.la.LogicalArchitecture; +import org.polarsys.capella.core.data.la.LogicalComponent; +import org.polarsys.capella.core.data.la.LogicalFunction; +import org.polarsys.capella.core.data.la.LogicalFunctionPkg; +import org.polarsys.capella.core.data.pa.PhysicalArchitecture; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalFunction; +import org.polarsys.capella.core.data.pa.PhysicalFunctionPkg; +import org.polarsys.capella.core.model.handler.command.CapellaResourceHelper; + +/** + * A utility helper to retrieve parts of a Capella model + * + * @author Amine Lajmi + * + */ +public class CapellaUtil { + + /** + * The Capella model file extension + */ + public static final String CAPELLA_MODEL_FILE_EXTENSION = "melodymodeller"; //$NON-NLS-1$ + + /** + * The Aird file extension + */ + public static final String AIRD_FILE_EXTENSION = "aird"; //$NON-NLS-1$ + + /** + * Returns the root physical component of the Capella physical architecture + * given a semantic object + * + * @param source_p + * a (non-null) Capella semantic object + * @return the (possibly null) physical system root + */ + public static PhysicalComponent getPhysicalSystemRoot(EObject source_p) { + ResourceSet resourceSet = source_p.eResource().getResourceSet(); + URI semanticResourceURI = source_p + .eResource() + .getURI() + .trimFileExtension() + .appendFileExtension( + CapellaResourceHelper.CAPELLA_MODEL_FILE_EXTENSION); + Resource semanticResource = resourceSet.getResource( + semanticResourceURI, false); + if (semanticResource != null) { + EObject root = semanticResource.getContents().get(0); + if (root instanceof Project) { + EList ownedModelRoots = ((Project) root) + .getOwnedModelRoots(); + for (ModelRoot modelRoot : ownedModelRoots) { + if (modelRoot instanceof SystemEngineering) { + EList containedPhysicalArchitectures = ((SystemEngineering) modelRoot) + .getContainedPhysicalArchitectures(); + for (PhysicalArchitecture arch : containedPhysicalArchitectures) { + return (PhysicalComponent)arch.getSystem(); + } + } + } + } + } + return null; + } + + /** + * Returns the root physical component of the Capella physical architecture + * + * @param resource_p + * (non-null) Capella semantic resource + * @return the physical system root given a resource. + */ + public static PhysicalComponent getPhysicalSystemRoot(Resource resource_p) { + return getPhysicalSystemRoot(resource_p.getContents().get(0)); + } + + /** + * Returns the physical function package of a Capella model + * + * @param source_p + * a (non-null) Capella semantic object + * @return the physical function package. + */ + public static PhysicalFunctionPkg getPhysicalFunctionPackage(EObject source_p) { + ResourceSet resourceSet = source_p.eResource().getResourceSet(); + URI semanticResourceURI = source_p.eResource().getURI().trimFileExtension() + .appendFileExtension(CapellaResourceHelper.CAPELLA_MODEL_FILE_EXTENSION); + Resource semanticResource = resourceSet.getResource(semanticResourceURI, false); + PhysicalFunctionPkg physicalFunctionPkgTmp = null; + if (semanticResource != null) { + EObject root = semanticResource.getContents().get(0); + if (root instanceof Project) { + EList ownedModelRoots = ((Project) root).getOwnedModelRoots(); + for (ModelRoot modelRoot : ownedModelRoots) { + if (modelRoot instanceof SystemEngineering) { + EList containedPhysicalArchitectures = ((SystemEngineering) modelRoot) + .getContainedPhysicalArchitectures(); + for (PhysicalArchitecture arch : containedPhysicalArchitectures) { + FunctionPkg ownedFunctionPkg = arch.getOwnedFunctionPkg(); + if (ownedFunctionPkg instanceof PhysicalFunctionPkg) { + physicalFunctionPkgTmp = (PhysicalFunctionPkg) ownedFunctionPkg; + break; + } + } + } + } + } + } + return physicalFunctionPkgTmp; + } + + /** + * Returns the physical function root of a Capella model + * + * @param source_p + * a (non-null) Capella semantic object + * @return the physical function root given an eObject. + */ + public static PhysicalFunction getPhysicalFunctionRoot(EObject source_p) { + PhysicalFunctionPkg functionPackage = getPhysicalFunctionPackage(source_p); + List subFunctions = functionPackage.getOwnedPhysicalFunctions(); + return subFunctions.isEmpty()? null: subFunctions.get(0); + } + + /** + * Returns the physical function root of a Capella model + * + * @param resource_p the (non-null) semantic resource + * @return the physical function root given a resource. + */ + public static PhysicalFunction getPhysicalFunctionRoot(Resource resource_p) { + PhysicalFunctionPkg functionPackage = getPhysicalFunctionPackage(resource_p.getContents().get(0)); + return functionPackage.getOwnedPhysicalFunctions().get(0); + } + + /** + * Returns the logical component system root given a semantic object + * + * @param source_p + * the semantic object + * @return the logical component root + */ + public static LogicalComponent getLogicalSystemRoot(EObject source_p) { + ResourceSet resourceSet = source_p.eResource().getResourceSet(); + URI semanticResourceURI = source_p.eResource().getURI() + .trimFileExtension() + .appendFileExtension(CAPELLA_MODEL_FILE_EXTENSION); + Resource semanticResource = resourceSet.getResource( + semanticResourceURI, false); + if (semanticResource != null) { + EObject root = semanticResource.getContents().get(0); + if (root instanceof Project) { + EList ownedModelRoots = ((Project) root) + .getOwnedModelRoots(); + for (ModelRoot modelRoot : ownedModelRoots) { + if (modelRoot instanceof SystemEngineering) { + EList containedLogicalArchitecture = ((SystemEngineering) modelRoot) + .getContainedLogicalArchitectures(); + for (LogicalArchitecture arch : containedLogicalArchitecture) { + return (LogicalComponent)arch.getSystem(); + } + } + } + } + } + return null; + } + + /** + * Returns the root physical component of the Capella physical architecture + * + * @param resource_p + * (non-null) Capella semantic resource + * @return the physical system root given a resource. + */ + public static LogicalComponent getLogicalSystemRoot(Resource resource_p) { + return getLogicalSystemRoot(resource_p.getContents().get(0)); + } + + /** + * Returns the physical function package of a Capella model + * + * @param source_p + * a (non-null) Capella semantic object + * @return the physical function package. + */ + public static LogicalFunctionPkg getLogicalFunctionPackage(EObject source_p) { + ResourceSet resourceSet = source_p.eResource().getResourceSet(); + URI semanticResourceURI = source_p.eResource().getURI() + .trimFileExtension() + .appendFileExtension(CAPELLA_MODEL_FILE_EXTENSION); + Resource semanticResource = resourceSet.getResource( + semanticResourceURI, false); + LogicalFunctionPkg logicalFunctionPkgTmp = null; + if (semanticResource != null) { + EObject root = semanticResource.getContents().get(0); + if (root instanceof Project) { + EList ownedModelRoots = ((Project) root) + .getOwnedModelRoots(); + for (ModelRoot modelRoot : ownedModelRoots) { + if (modelRoot instanceof SystemEngineering) { + EList containedPhysicalArchitectures = ((SystemEngineering) modelRoot) + .getContainedLogicalArchitectures(); + for (LogicalArchitecture arch : containedPhysicalArchitectures) { + FunctionPkg ownedFunctionPkg = arch + .getOwnedFunctionPkg(); + if (ownedFunctionPkg instanceof LogicalFunctionPkg) { + logicalFunctionPkgTmp = (LogicalFunctionPkg) ownedFunctionPkg; + break; + } + } + } + } + } + } + return logicalFunctionPkgTmp; + } + + /** + * Returns the logical function root of a Capella model + * + * @param source_p + * a (non-null) Capella semantic object + * @return the logical function root given an eObject. + */ + public static LogicalFunction getLogicalFunctionRoot(EObject source_p) { + LogicalFunctionPkg functionPackage = getLogicalFunctionPackage(source_p); + return functionPackage.getOwnedLogicalFunctions().get(0); + } + + /** + * Returns the logical function root of a Capella model + * + * @param resource_p + * the (non-null) semantic resource + * @return the logical function root given a resource. + */ + public static LogicalFunction getLogicalFunctionRoot(Resource resource_p) { + LogicalFunctionPkg functionPackage = getLogicalFunctionPackage(resource_p + .getContents().get(0)); + return functionPackage.getOwnedLogicalFunctions().get(0); + } + + /** + * Returns the system engineering root from the Capella project + * + * @param project_p + * a Capella project + * @return the system engineering root + */ + public static SystemEngineering getSystemEngineering(Project project_p) { + if (project_p != null) { + for (ModelRoot root : project_p.getOwnedModelRoots()) { + if (root instanceof SystemEngineering) { + return (SystemEngineering) root; + } + } + } + return null; + } +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.classpath b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.project b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.project new file mode 100644 index 00000000..9475eebf --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.settings/org.eclipse.jdt.core.prefs b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..b8322f41 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,117 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=error +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/META-INF/MANIFEST.MF b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/META-INF/MANIFEST.MF new file mode 100644 index 00000000..29b6f98b --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit;singleton:=true +Bundle-Version: 0.14.1.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: org.polarsys.capella.diffmerge.bridge.examples.apa.provider +Require-Bundle: org.eclipse.core.runtime, + org.polarsys.capella.diffmerge.bridge.examples.apa.gen;visibility:=reexport, + org.eclipse.emf.edit;visibility:=reexport +Bundle-ActivationPolicy: lazy +Eclipse-LazyStart: true +Bundle-Activator: org.polarsys.capella.diffmerge.bridge.examples.apa.provider.ApaEditPlugin$Implementation +Automatic-Module-Name: org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/about.html b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

    About This Content

    + +

    August 17, 2018

    +

    License

    +

    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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

    +

    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 http://www.eclipse.org.

    + + \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/build.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/build.properties new file mode 100644 index 00000000..5289aca4 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/build.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateABehavior_functions_AFunction.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateABehavior_functions_AFunction.gif new file mode 100644 index 00000000..dcbb9e88 Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateABehavior_functions_AFunction.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateANode_behaviors_ABehavior.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateANode_behaviors_ABehavior.gif new file mode 100644 index 00000000..e3cf235b Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateANode_behaviors_ABehavior.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateAScope_exchanges_AExchange.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateAScope_exchanges_AExchange.gif new file mode 100644 index 00000000..210e1566 Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateAScope_exchanges_AExchange.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateAScope_nodes_ANode.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateAScope_nodes_ANode.gif new file mode 100644 index 00000000..568a3d4c Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/ctool16/CreateAScope_nodes_ANode.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/ABehavior.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/ABehavior.gif new file mode 100644 index 00000000..45731fe2 Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/ABehavior.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AExchange.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AExchange.gif new file mode 100644 index 00000000..a3908bcf Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AExchange.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AFunction.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AFunction.gif new file mode 100644 index 00000000..d3dc5a9a Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AFunction.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/ANode.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/ANode.gif new file mode 100644 index 00000000..134551bf Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/ANode.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AScope.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AScope.gif new file mode 100644 index 00000000..739ebbfa Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/icons/full/obj16/AScope.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/plugin.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/plugin.properties new file mode 100644 index 00000000..ffff9d60 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/plugin.properties @@ -0,0 +1,58 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +# ==================================================================== +# To code developer: +# Do NOT change the properties between this line and the +# "%%% END OF TRANSLATED PROPERTIES %%%" line. +# Make a new property name, append to the end of the file and change +# the code to use the new property. +# ==================================================================== + +# ==================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# ==================================================================== + +pluginName = APA Edit Support (Incubation) +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_ANamedElement_type = ANamed Element +_UI_AScope_type = AScope +_UI_ANode_type = ANode +_UI_ABehavior_type = ABehavior +_UI_AFunction_type = AFunction +_UI_AExchange_type = AExchange +_UI_Unknown_type = Object + +_UI_Unknown_datatype= Value + +_UI_ANamedElement_id_feature = Id +_UI_ANamedElement_name_feature = Name +_UI_AScope_nodes_feature = Nodes +_UI_AScope_exchanges_feature = Exchanges +_UI_ANode_owningScope_feature = Owning Scope +_UI_ANode_behaviors_feature = Behaviors +_UI_ABehavior_owningNode_feature = Owning Node +_UI_ABehavior_functions_feature = Functions +_UI_AFunction_owningBehavior_feature = Owning Behavior +_UI_AFunction_incoming_feature = Incoming +_UI_AFunction_outgoing_feature = Outgoing +_UI_AExchange_owningScope_feature = Owning Scope +_UI_AExchange_source_feature = Source +_UI_AExchange_target_feature = Target +_UI_Unknown_feature = Unspecified + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/plugin.xml b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/plugin.xml new file mode 100644 index 00000000..630161cd --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/plugin.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ABehaviorItemProvider.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ABehaviorItemProvider.java new file mode 100644 index 00000000..929eafda --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ABehaviorItemProvider.java @@ -0,0 +1,152 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * This is the item provider adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior} object. + * + * + * @generated + */ +public class ABehaviorItemProvider extends ANamedElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ABehaviorItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List 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}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(ApaPackage.Literals.ABEHAVIOR__FUNCTIONS); + } + return childrenFeatures; + } + + /** + * + * + * @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 ABehavior.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ABehavior")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ABehavior)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_ABehavior_type") : + getString("_UI_ABehavior_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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ABehavior.class)) { + case ApaPackage.ABEHAVIOR__FUNCTIONS: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (ApaPackage.Literals.ABEHAVIOR__FUNCTIONS, + ApaFactory.eINSTANCE.createAFunction())); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AExchangeItemProvider.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AExchangeItemProvider.java new file mode 100644 index 00000000..a8bc94c4 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AExchangeItemProvider.java @@ -0,0 +1,154 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.IItemPropertyDescriptor; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * This is the item provider adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange} object. + * + * + * @generated + */ +public class AExchangeItemProvider extends ANamedElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public AExchangeItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addSourcePropertyDescriptor(object); + addTargetPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Source feature. + * + * + * @generated + */ + protected void addSourcePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_AExchange_source_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_AExchange_source_feature", "_UI_AExchange_type"), + ApaPackage.Literals.AEXCHANGE__SOURCE, + true, + false, + true, + null, + null, + null)); + } + + /** + * This adds a property descriptor for the Target feature. + * + * + * @generated + */ + protected void addTargetPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_AExchange_target_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_AExchange_target_feature", "_UI_AExchange_type"), + ApaPackage.Literals.AEXCHANGE__TARGET, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns AExchange.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/AExchange")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((AExchange)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_AExchange_type") : + getString("_UI_AExchange_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}. + * + * + * @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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AFunctionItemProvider.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AFunctionItemProvider.java new file mode 100644 index 00000000..722c9fad --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AFunctionItemProvider.java @@ -0,0 +1,154 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.IItemPropertyDescriptor; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * This is the item provider adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction} object. + * + * + * @generated + */ +public class AFunctionItemProvider extends ANamedElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public AFunctionItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addIncomingPropertyDescriptor(object); + addOutgoingPropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Incoming feature. + * + * + * @generated + */ + protected void addIncomingPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_AFunction_incoming_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_AFunction_incoming_feature", "_UI_AFunction_type"), + ApaPackage.Literals.AFUNCTION__INCOMING, + true, + false, + true, + null, + null, + null)); + } + + /** + * This adds a property descriptor for the Outgoing feature. + * + * + * @generated + */ + protected void addOutgoingPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_AFunction_outgoing_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_AFunction_outgoing_feature", "_UI_AFunction_type"), + ApaPackage.Literals.AFUNCTION__OUTGOING, + true, + false, + true, + null, + null, + null)); + } + + /** + * This returns AFunction.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/AFunction")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((AFunction)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_AFunction_type") : + getString("_UI_AFunction_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}. + * + * + * @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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ANamedElementItemProvider.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ANamedElementItemProvider.java new file mode 100644 index 00000000..e3047705 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ANamedElementItemProvider.java @@ -0,0 +1,178 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * This is the item provider adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement} object. + * + * + * @generated + */ +public class ANamedElementItemProvider + extends ItemProviderAdapter + implements + IEditingDomainItemProvider, + IStructuredItemContentProvider, + ITreeItemContentProvider, + IItemLabelProvider, + IItemPropertySource { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ANamedElementItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + addIdPropertyDescriptor(object); + addNamePropertyDescriptor(object); + } + return itemPropertyDescriptors; + } + + /** + * This adds a property descriptor for the Id feature. + * + * + * @generated + */ + protected void addIdPropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ANamedElement_id_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ANamedElement_id_feature", "_UI_ANamedElement_type"), + ApaPackage.Literals.ANAMED_ELEMENT__ID, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This adds a property descriptor for the Name feature. + * + * + * @generated + */ + protected void addNamePropertyDescriptor(Object object) { + itemPropertyDescriptors.add + (createItemPropertyDescriptor + (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), + getResourceLocator(), + getString("_UI_ANamedElement_name_feature"), + getString("_UI_PropertyDescriptor_description", "_UI_ANamedElement_name_feature", "_UI_ANamedElement_type"), + ApaPackage.Literals.ANAMED_ELEMENT__NAME, + true, + false, + false, + ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, + null, + null)); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ANamedElement)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_ANamedElement_type") : + getString("_UI_ANamedElement_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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ANamedElement.class)) { + case ApaPackage.ANAMED_ELEMENT__ID: + case ApaPackage.ANAMED_ELEMENT__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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + + /** + * Return the resource locator for this item provider's resources. + * + * + * @generated + */ + @Override + public ResourceLocator getResourceLocator() { + return ApaEditPlugin.INSTANCE; + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ANodeItemProvider.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ANodeItemProvider.java new file mode 100644 index 00000000..826873dd --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ANodeItemProvider.java @@ -0,0 +1,152 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * This is the item provider adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode} object. + * + * + * @generated + */ +public class ANodeItemProvider extends ANamedElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public ANodeItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List 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}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(ApaPackage.Literals.ANODE__BEHAVIORS); + } + return childrenFeatures; + } + + /** + * + * + * @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 ANode.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/ANode")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((ANode)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_ANode_type") : + getString("_UI_ANode_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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(ANode.class)) { + case ApaPackage.ANODE__BEHAVIORS: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (ApaPackage.Literals.ANODE__BEHAVIORS, + ApaFactory.eINSTANCE.createABehavior())); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AScopeItemProvider.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AScopeItemProvider.java new file mode 100644 index 00000000..a62c3bfc --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/AScopeItemProvider.java @@ -0,0 +1,159 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.IItemPropertyDescriptor; +import org.eclipse.emf.edit.provider.ViewerNotification; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * This is the item provider adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope} object. + * + * + * @generated + */ +public class AScopeItemProvider extends ANamedElementItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * + * @generated + */ + public AScopeItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * + * @generated + */ + @Override + public List 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}. + * + * + * @generated + */ + @Override + public Collection getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(ApaPackage.Literals.ASCOPE__NODES); + childrenFeatures.add(ApaPackage.Literals.ASCOPE__EXCHANGES); + } + return childrenFeatures; + } + + /** + * + * + * @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 AScope.gif. + * + * + * @generated + */ + @Override + public Object getImage(Object object) { + return overlayImage(object, getResourceLocator().getImage("full/obj16/AScope")); + } + + /** + * This returns the label text for the adapted class. + * + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((AScope)object).getName(); + return label == null || label.length() == 0 ? + getString("_UI_AScope_type") : + getString("_UI_AScope_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}. + * + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + updateChildren(notification); + + switch (notification.getFeatureID(AScope.class)) { + case ApaPackage.ASCOPE__NODES: + case ApaPackage.ASCOPE__EXCHANGES: + 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. + * + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (ApaPackage.Literals.ASCOPE__NODES, + ApaFactory.eINSTANCE.createANode())); + + newChildDescriptors.add + (createChildParameter + (ApaPackage.Literals.ASCOPE__EXCHANGES, + ApaFactory.eINSTANCE.createAExchange())); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ApaEditPlugin.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ApaEditPlugin.java new file mode 100644 index 00000000..b7ec8bfc --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ApaEditPlugin.java @@ -0,0 +1,98 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.provider; + +import org.eclipse.emf.common.EMFPlugin; + +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * This is the central singleton for the Apa edit plugin. + * + * + * @generated + */ +public final class ApaEditPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final ApaEditPlugin INSTANCE = new ApaEditPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public ApaEditPlugin() { + super + (new ResourceLocator [] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * @generated + */ + public static class Implementation extends EclipsePlugin { + /** + * Creates an instance. + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ApaItemProviderAdapterFactory.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ApaItemProviderAdapterFactory.java new file mode 100644 index 00000000..f6fa3637 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit/src/org/polarsys/capella/diffmerge/bridge/examples/apa/provider/ApaItemProviderAdapterFactory.java @@ -0,0 +1,302 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.polarsys.capella.diffmerge.bridge.examples.apa.util.ApaAdapterFactory; + +/** + * 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. + * + * + * @generated + */ +public class ApaItemProviderAdapterFactory extends ApaAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { + /** + * This keeps track of the root adapter factory that delegates to this adapter factory. + * + * + * @generated + */ + protected ComposedAdapterFactory parentAdapterFactory; + + /** + * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. + * + * + * @generated + */ + protected IChangeNotifier changeNotifier = new ChangeNotifier(); + + /** + * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. + * + * + * @generated + */ + protected Collection supportedTypes = new ArrayList(); + + /** + * This constructs an instance. + * + * + * @generated + */ + public ApaItemProviderAdapterFactory() { + 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.polarsys.capella.diffmerge.bridge.examples.apa.AScope} instances. + * + * + * @generated + */ + protected AScopeItemProvider aScopeItemProvider; + + /** + * This creates an adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope}. + * + * + * @generated + */ + @Override + public Adapter createAScopeAdapter() { + if (aScopeItemProvider == null) { + aScopeItemProvider = new AScopeItemProvider(this); + } + + return aScopeItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode} instances. + * + * + * @generated + */ + protected ANodeItemProvider aNodeItemProvider; + + /** + * This creates an adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode}. + * + * + * @generated + */ + @Override + public Adapter createANodeAdapter() { + if (aNodeItemProvider == null) { + aNodeItemProvider = new ANodeItemProvider(this); + } + + return aNodeItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior} instances. + * + * + * @generated + */ + protected ABehaviorItemProvider aBehaviorItemProvider; + + /** + * This creates an adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior}. + * + * + * @generated + */ + @Override + public Adapter createABehaviorAdapter() { + if (aBehaviorItemProvider == null) { + aBehaviorItemProvider = new ABehaviorItemProvider(this); + } + + return aBehaviorItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction} instances. + * + * + * @generated + */ + protected AFunctionItemProvider aFunctionItemProvider; + + /** + * This creates an adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction}. + * + * + * @generated + */ + @Override + public Adapter createAFunctionAdapter() { + if (aFunctionItemProvider == null) { + aFunctionItemProvider = new AFunctionItemProvider(this); + } + + return aFunctionItemProvider; + } + + /** + * This keeps track of the one adapter used for all {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange} instances. + * + * + * @generated + */ + protected AExchangeItemProvider aExchangeItemProvider; + + /** + * This creates an adapter for a {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange}. + * + * + * @generated + */ + @Override + public Adapter createAExchangeAdapter() { + if (aExchangeItemProvider == null) { + aExchangeItemProvider = new AExchangeItemProvider(this); + } + + return aExchangeItemProvider; + } + + /** + * This returns the root adapter factory that contains this factory. + * + * + * @generated + */ + public ComposeableAdapterFactory getRootAdapterFactory() { + return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); + } + + /** + * This sets the composed adapter factory that contains this factory. + * + * + * @generated + */ + public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { + this.parentAdapterFactory = parentAdapterFactory; + } + + /** + * + * + * @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. + * + * + * @generated + */ + @Override + public Adapter adapt(Notifier notifier, Object type) { + return super.adapt(notifier, this); + } + + /** + * + * + * @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. + * + * + * @generated + */ + public void addListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.addListener(notifyChangedListener); + } + + /** + * This removes a listener. + * + * + * @generated + */ + public void removeListener(INotifyChangedListener notifyChangedListener) { + changeNotifier.removeListener(notifyChangedListener); + } + + /** + * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. + * + * + * @generated + */ + 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. + * + * + * @generated + */ + public void dispose() { + if (aScopeItemProvider != null) aScopeItemProvider.dispose(); + if (aNodeItemProvider != null) aNodeItemProvider.dispose(); + if (aBehaviorItemProvider != null) aBehaviorItemProvider.dispose(); + if (aFunctionItemProvider != null) aFunctionItemProvider.dispose(); + if (aExchangeItemProvider != null) aExchangeItemProvider.dispose(); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.classpath b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.project b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.project new file mode 100644 index 00000000..943e92f7 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.settings/org.eclipse.jdt.core.prefs b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..b8322f41 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,117 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=error +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/META-INF/MANIFEST.MF b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/META-INF/MANIFEST.MF new file mode 100644 index 00000000..34e297fb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor;singleton:=true +Bundle-Version: 0.14.1.qualifier +Bundle-ClassPath: . +Bundle-Activator: org.polarsys.capella.diffmerge.bridge.examples.apa.presentation.ApaEditorPlugin$Implementation +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: org.polarsys.capella.diffmerge.bridge.examples.apa.presentation +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources;visibility:=reexport, + org.polarsys.capella.diffmerge.bridge.examples.apa.gen.edit;visibility:=reexport, + org.eclipse.emf.ecore.xmi;visibility:=reexport, + org.eclipse.emf.edit.ui;visibility:=reexport, + org.eclipse.ui.ide;visibility:=reexport +Bundle-ActivationPolicy: lazy +Eclipse-LazyStart: true +Automatic-Module-Name: org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/about.html b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

    About This Content

    + +

    August 17, 2018

    +

    License

    +

    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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

    +

    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 http://www.eclipse.org.

    + + \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/build.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/build.properties new file mode 100644 index 00000000..5289aca4 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/build.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +bin.includes = .,\ + icons/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/icons/full/obj16/ApaModelFile.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/icons/full/obj16/ApaModelFile.gif new file mode 100644 index 00000000..c6b1acd6 Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/icons/full/obj16/ApaModelFile.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/icons/full/wizban/NewApa.gif b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/icons/full/wizban/NewApa.gif new file mode 100644 index 00000000..73117b66 Binary files /dev/null and b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/icons/full/wizban/NewApa.gif differ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/plugin.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/plugin.properties new file mode 100644 index 00000000..81655b3a --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/plugin.properties @@ -0,0 +1,73 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +# ==================================================================== +# To code developer: +# Do NOT change the properties between this line and the +# "%%% END OF TRANSLATED PROPERTIES %%%" line. +# Make a new property name, append to the end of the file and change +# the code to use the new property. +# ==================================================================== + +# ==================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# ==================================================================== + +pluginName = APA Editor (Incubation) +providerName = www.polarsys.org + +_UI_ApaEditor_menu = &Apa 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_ApaModelWizard_label = Apa Model +_UI_ApaModelWizard_description = Create a new Apa model + +_UI_ApaEditor_label = Apa Model Editor + +_UI_ApaEditorFilenameDefaultBase = My +_UI_ApaEditorFilenameExtension = apa + +_UI_Wizard_label = New + +_WARN_FilenameExtension = The file name must end in ".{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? + +_UI_ApaEditorFilenameExtensions = apa + _WARN_FilenameExtensions = The file name must have one of the following extensions: {0} + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/plugin.xml b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/plugin.xml new file mode 100644 index 00000000..16d55d82 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/plugin.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + %_UI_ApaModelWizard_description + + + + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaActionBarContributor.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaActionBarContributor.java new file mode 100644 index 00000000..f671d947 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaActionBarContributor.java @@ -0,0 +1,432 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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 Apa model editor. + * + * + * @generated + */ +public class ApaActionBarContributor + extends EditingDomainActionBarContributor + implements ISelectionChangedListener { + /** + * This keeps track of the active editor. + * + * + * @generated + */ + protected IEditorPart activeEditorPart; + + /** + * This keeps track of the current selection provider. + * + * + * @generated + */ + protected ISelectionProvider selectionProvider; + + /** + * This action opens the Properties view. + * + * + * @generated + */ + protected IAction showPropertiesViewAction = + new Action(ApaEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) { + @Override + public void run() { + try { + getPage().showView("org.eclipse.ui.views.PropertySheet"); + } + catch (PartInitException exception) { + ApaEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * This action refreshes the viewer of the current editor if the editor + * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. + * + * + * @generated + */ + protected IAction refreshViewerAction = + new Action(ApaEditorPlugin.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. + * + * + * @generated + */ + protected Collection createChildActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateChild actions. + * + * + * @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. + * + * + * @generated + */ + protected Collection createSiblingActions; + + /** + * This is the menu manager into which menu contribution items should be added for CreateSibling actions. + * + * + * @generated + */ + protected IMenuManager createSiblingMenuManager; + + /** + * This creates an instance of the contributor. + * + * + * @generated + */ + public ApaActionBarContributor() { + super(ADDITIONS_LAST_STYLE); + loadResourceAction = new LoadResourceAction(); + validateAction = new ValidateAction(); + controlAction = new ControlAction(); + } + + /** + * This adds Separators for editor additions to the tool bar. + * + * + * @generated + */ + @Override + public void contributeToToolBar(IToolBarManager toolBarManager) { + toolBarManager.add(new Separator("apa-settings")); + toolBarManager.add(new Separator("apa-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. + * + * + * @generated + */ + @Override + public void contributeToMenu(IMenuManager menuManager) { + super.contributeToMenu(menuManager); + + IMenuManager submenuManager = new MenuManager(ApaEditorPlugin.INSTANCE.getString("_UI_ApaEditor_menu"), "org.polarsys.capella.diffmerge.bridge.examples.apaMenuID"); + 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(ApaEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + submenuManager.insertBefore("additions", createChildMenuManager); + + // Prepare for CreateSibling item addition or removal. + // + createSiblingMenuManager = new MenuManager(ApaEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + submenuManager.insertBefore("additions", createSiblingMenuManager); + + // Force an update because Eclipse hides empty menus now. + // + submenuManager.addMenuListener + (new IMenuListener() { + 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. + * + * + * @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. + * + * + * @generated + */ + 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 descriptors, + * and returns the collection of these actions. + * + * + * @generated + */ + protected Collection generateCreateChildActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + 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 descriptors, + * and returns the collection of these actions. + * + * + * @generated + */ + protected Collection generateCreateSiblingActions(Collection descriptors, ISelection selection) { + Collection actions = new ArrayList(); + if (descriptors != null) { + for (Object descriptor : descriptors) { + actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); + } + } + return actions; + } + + /** + * This populates the specified manager with {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection, + * by inserting them before the specified contribution item contributionID. + * If contributionID is null, they are simply added. + * + * + * @generated + */ + protected void populateManager(IContributionManager manager, Collection 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 manager all {@link org.eclipse.jface.action.ActionContributionItem}s + * based on the {@link org.eclipse.jface.action.IAction}s contained in the actions collection. + * + * + * @generated + */ + protected void depopulateManager(IContributionManager manager, Collection 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. + * + * + * @generated + */ + @Override + public void menuAboutToShow(IMenuManager menuManager) { + super.menuAboutToShow(menuManager); + MenuManager submenuManager = null; + + submenuManager = new MenuManager(ApaEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); + populateManager(submenuManager, createChildActions, null); + menuManager.insertBefore("edit", submenuManager); + + submenuManager = new MenuManager(ApaEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); + populateManager(submenuManager, createSiblingActions, null); + menuManager.insertBefore("edit", submenuManager); + } + + /** + * This inserts global actions before the "additions-end" separator. + * + * + * @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. + * + * + * @generated + */ + @Override + protected boolean removeAllReferencesOnDelete() { + return true; + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaEditor.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaEditor.java new file mode 100644 index 00000000..5fd9cd17 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaEditor.java @@ -0,0 +1,1821 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.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.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.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; +import org.polarsys.capella.diffmerge.bridge.examples.apa.provider.ApaItemProviderAdapterFactory; +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.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.ui.actions.WorkspaceModifyOperation; + + +/** + * This is an example of a Apa model editor. + * + * + * @generated + */ +public class ApaEditor + 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. + * + * + * @generated + */ + protected AdapterFactoryEditingDomain editingDomain; + + /** + * This is the one adapter factory used for providing views of the model. + * + * + * @generated + */ + protected ComposedAdapterFactory adapterFactory; + + /** + * This is the content outline page. + * + * + * @generated + */ + protected IContentOutlinePage contentOutlinePage; + + /** + * This is a kludge... + * + * + * @generated + */ + protected IStatusLineManager contentOutlineStatusLineManager; + + /** + * This is the content outline page's viewer. + * + * + * @generated + */ + protected TreeViewer contentOutlineViewer; + + /** + * This is the property sheet page. + * + * + * @generated + */ + protected List propertySheetPages = new ArrayList(); + + /** + * This is the viewer that shadows the selection in the content outline. + * The parent relation must be correctly defined for this to work. + * + * + * @generated + */ + protected TreeViewer selectionViewer; + + /** + * This inverts the roll of parent and child in the content provider and show parents as a tree. + * + * + * @generated + */ + protected TreeViewer parentViewer; + + /** + * This shows how a tree view works. + * + * + * @generated + */ + protected TreeViewer treeViewer; + + /** + * This shows how a list view works. + * A list viewer doesn't support icons. + * + * + * @generated + */ + protected ListViewer listViewer; + + /** + * This shows how a table view works. + * A table can be used as a list with icons. + * + * + * @generated + */ + protected TableViewer tableViewer; + + /** + * This shows how a tree view with columns works. + * + * + * @generated + */ + protected TreeViewer treeViewerWithColumns; + + /** + * This keeps track of the active viewer pane, in the book. + * + * + * @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. + * + * + * @generated + */ + protected Viewer currentViewer; + + /** + * This listens to which ever viewer is active. + * + * + * @generated + */ + protected ISelectionChangedListener selectionChangedListener; + + /** + * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor. + * + * + * @generated + */ + protected Collection selectionChangedListeners = new ArrayList(); + + /** + * This keeps track of the selection of the editor as a whole. + * + * + * @generated + */ + protected ISelection editorSelection = StructuredSelection.EMPTY; + + /** + * The MarkerHelper is responsible for creating workspace resource markers presented + * in Eclipse's Problems View. + * + * + * @generated + */ + protected MarkerHelper markerHelper = new EditUIMarkerHelper(); + + /** + * This listens for when the outline becomes active + * + * + * @generated + */ + protected IPartListener partListener = + new IPartListener() { + public void partActivated(IWorkbenchPart p) { + if (p instanceof ContentOutline) { + if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) { + getActionBarContributor().setActiveEditor(ApaEditor.this); + + setCurrentViewer(contentOutlineViewer); + } + } + else if (p instanceof PropertySheet) { + if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + getActionBarContributor().setActiveEditor(ApaEditor.this); + handleActivate(); + } + } + else if (p == ApaEditor.this) { + handleActivate(); + } + } + public void partBroughtToTop(IWorkbenchPart p) { + // Ignore. + } + public void partClosed(IWorkbenchPart p) { + // Ignore. + } + public void partDeactivated(IWorkbenchPart p) { + // Ignore. + } + public void partOpened(IWorkbenchPart p) { + // Ignore. + } + }; + + /** + * Resources that have been removed since last activation. + * + * + * @generated + */ + protected Collection removedResources = new ArrayList(); + + /** + * Resources that have been changed since last activation. + * + * + * @generated + */ + protected Collection changedResources = new ArrayList(); + + /** + * Resources that have been saved. + * + * + * @generated + */ + protected Collection savedResources = new ArrayList(); + + /** + * Map to store the diagnostic associated with a resource. + * + * + * @generated + */ + protected Map resourceToDiagnosticMap = new LinkedHashMap(); + + /** + * Controls whether the problem indication should be updated. + * + * + * @generated + */ + protected boolean updateProblemIndication = true; + + /** + * Adapter used to update the problem indication when resources are demanded loaded. + * + * + * @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() { + 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); + resourceToDiagnosticMap.remove(target); + if (updateProblemIndication) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + updateProblemIndication(); + } + }); + } + } + }; + + /** + * This listens for workspace changes. + * + * + * @generated + */ + protected IResourceChangeListener resourceChangeListener = + new IResourceChangeListener() { + public void resourceChanged(IResourceChangeEvent event) { + IResourceDelta delta = event.getDelta(); + try { + class ResourceDeltaVisitor implements IResourceDeltaVisitor { + protected ResourceSet resourceSet = editingDomain.getResourceSet(); + protected Collection changedResources = new ArrayList(); + protected Collection removedResources = new ArrayList(); + + 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 false; + } + + return true; + } + + public Collection getChangedResources() { + return changedResources; + } + + public Collection getRemovedResources() { + return removedResources; + } + } + + final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(); + delta.accept(visitor); + + if (!visitor.getRemovedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + removedResources.addAll(visitor.getRemovedResources()); + if (!isDirty()) { + getSite().getPage().closeEditor(ApaEditor.this, false); + } + } + }); + } + + if (!visitor.getChangedResources().isEmpty()) { + getSite().getShell().getDisplay().asyncExec + (new Runnable() { + public void run() { + changedResources.addAll(visitor.getChangedResources()); + if (getSite().getPage().getActiveEditor() == ApaEditor.this) { + handleActivate(); + } + } + }); + } + } + catch (CoreException exception) { + ApaEditorPlugin.INSTANCE.log(exception); + } + } + }; + + /** + * Handles activation of the editor or it's associated views. + * + * + * @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(ApaEditor.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. + * + * + * @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. + * + * + * @generated + */ + protected void updateProblemIndication() { + if (updateProblemIndication) { + BasicDiagnostic diagnostic = + new BasicDiagnostic + (Diagnostic.OK, + "org.polarsys.capella.diffmerge.bridge.examples.apa.gen.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) { + ApaEditorPlugin.INSTANCE.log(exception); + } + } + + if (markerHelper.hasMarkers(editingDomain.getResourceSet())) { + markerHelper.deleteMarkers(editingDomain.getResourceSet()); + if (diagnostic.getSeverity() != Diagnostic.OK) { + try { + markerHelper.createMarkers(diagnostic); + } + catch (CoreException exception) { + ApaEditorPlugin.INSTANCE.log(exception); + } + } + } + } + } + + /** + * Shows a dialog that asks if conflicting changes should be discarded. + * + * + * @generated + */ + protected boolean handleDirtyConflict() { + return + MessageDialog.openQuestion + (getSite().getShell(), + getString("_UI_FileConflict_label"), + getString("_WARN_FileConflict")); + } + + /** + * This creates a model editor. + * + * + * @generated + */ + public ApaEditor() { + super(); + initializeEditingDomain(); + } + + /** + * This sets up the editing domain for the model editor. + * + * + * @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 ApaItemProviderAdapterFactory()); + 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() { + public void commandStackChanged(final EventObject event) { + getContainer().getDisplay().asyncExec + (new Runnable() { + 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()); + } + for (Iterator i = propertySheetPages.iterator(); i.hasNext(); ) { + PropertySheetPage propertySheetPage = i.next(); + if (propertySheetPage.getControl().isDisposed()) { + i.remove(); + } + else { + propertySheetPage.refresh(); + } + } + } + }); + } + }); + + // Create the editing domain with a special command stack. + // + editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap()); + } + + /** + * This is here for the listener to be able to call it. + * + * + * @generated + */ + @Override + protected void firePropertyChange(int action) { + super.firePropertyChange(action); + } + + /** + * This sets the selection into whichever viewer is active. + * + * + * @generated + */ + public void setSelectionToViewer(Collection collection) { + final Collection theSelection = collection; + // Make sure it's okay. + // + if (theSelection != null && !theSelection.isEmpty()) { + Runnable runnable = + new Runnable() { + 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}. + * + * + * @generated + */ + public EditingDomain getEditingDomain() { + return editingDomain; + } + + /** + * + * + * @generated + */ + public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider { + /** + * + * + * @generated + */ + public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * + * + * @generated + */ + @Override + public Object [] getElements(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * @generated + */ + @Override + public Object [] getChildren(Object object) { + Object parent = super.getParent(object); + return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray(); + } + + /** + * + * + * @generated + */ + @Override + public boolean hasChildren(Object object) { + Object parent = super.getParent(object); + return parent != null; + } + + /** + * + * + * @generated + */ + @Override + public Object getParent(Object object) { + return null; + } + } + + /** + * + * + * @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. + * + * + * @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. + // + 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. + * + * + * @generated + */ + public Viewer getViewer() { + return currentViewer; + } + + /** + * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. + * + * + * @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. + * + * + * @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). + * + * + * @generated + */ + public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { + boolean hasErrors = !resource.getErrors().isEmpty(); + if (hasErrors || !resource.getWarnings().isEmpty()) { + BasicDiagnostic basicDiagnostic = + new BasicDiagnostic + (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, + "org.polarsys.capella.diffmerge.bridge.examples.apa.gen.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.polarsys.capella.diffmerge.bridge.examples.apa.gen.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. + * + * + * @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(), ApaEditor.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(), ApaEditor.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(), ApaEditor.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(), ApaEditor.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(), ApaEditor.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(), ApaEditor.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() { + 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() { + public void run() { + updateProblemIndication(); + } + }); + } + + /** + * If there is just one page in the multi-page editor part, + * this hides the single tab at the bottom. + * + * + * @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. + * + * + * @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. + * + * + * @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. + * + * + * @generated + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + @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. + * + * + * @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. + // + public void selectionChanged(SelectionChangedEvent event) { + handleContentOutlineSelection(event.getSelection()); + } + }); + } + + return contentOutlinePage; + } + + /** + * This accesses a cached version of the property sheet. + * + * + * @generated + */ + public IPropertySheetPage getPropertySheetPage() { + PropertySheetPage propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List selection) { + ApaEditor.this.setSelectionToViewer(selection); + ApaEditor.this.setFocus(); + } + + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + propertySheetPages.add(propertySheetPage); + + return propertySheetPage; + } + + /** + * This deals with how we want selection in the outliner to affect the other views. + * + * + * @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 selectionList = new ArrayList(); + 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. + * + * + * @generated + */ + @Override + public boolean isDirty() { + return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded(); + } + + /** + * This is for implementing {@link IEditorPart} and simply saves the model file. + * + * + * @generated + */ + @Override + public void doSave(IProgressMonitor progressMonitor) { + // Save only resources that have actually changed. + // + final Map saveOptions = new HashMap(); + 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. + // + ApaEditorPlugin.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. + * + * + * @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. + * + * + * @generated + */ + @Override + public boolean isSaveAsAllowed() { + return true; + } + + /** + * This also changes the editor's input. + * + * + * @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)); + } + } + } + + /** + * + * + * @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); + } + + /** + * + * + * @generated + */ + public void gotoMarker(IMarker marker) { + List targetObjects = markerHelper.getTargetObjects(editingDomain, marker); + if (!targetObjects.isEmpty()) { + setSelectionToViewer(targetObjects); + } + } + + /** + * This is called during startup. + * + * + * @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); + } + + /** + * + * + * @generated + */ + @Override + public void setFocus() { + if (currentViewerPane != null) { + currentViewerPane.setFocus(); + } + else { + getControl(getActivePage()).setFocus(); + } + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * @generated + */ + public void addSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.add(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. + * + * + * @generated + */ + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + selectionChangedListeners.remove(listener); + } + + /** + * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection. + * + * + * @generated + */ + 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. + * + * + * @generated + */ + public void setSelection(ISelection selection) { + editorSelection = selection; + + for (ISelectionChangedListener listener : selectionChangedListeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + setStatusLineManager(selection); + } + + /** + * + * + * @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. + * + * + * @generated + */ + private static String getString(String key) { + return ApaEditorPlugin.INSTANCE.getString(key); + } + + /** + * This looks up a string in plugin.properties, making a substitution. + * + * + * @generated + */ + private static String getString(String key, Object s1) { + return ApaEditorPlugin.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. + * + * + * @generated + */ + public void menuAboutToShow(IMenuManager menuManager) { + ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager); + } + + /** + * + * + * @generated + */ + public EditingDomainActionBarContributor getActionBarContributor() { + return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor(); + } + + /** + * + * + * @generated + */ + public IActionBars getActionBars() { + return getActionBarContributor().getActionBars(); + } + + /** + * + * + * @generated + */ + public AdapterFactory getAdapterFactory() { + return adapterFactory; + } + + /** + * + * + * @generated + */ + @Override + public void dispose() { + updateProblemIndication = false; + + ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener); + + getSite().getPage().removePartListener(partListener); + + adapterFactory.dispose(); + + if (getActionBarContributor().getActiveEditor() == this) { + getActionBarContributor().setActiveEditor(null); + } + + for (PropertySheetPage propertySheetPage : propertySheetPages) { + propertySheetPage.dispose(); + } + + if (contentOutlinePage != null) { + contentOutlinePage.dispose(); + } + + super.dispose(); + } + + /** + * Returns whether the outline view should be presented to the user. + * + * + * @generated + */ + protected boolean showOutlineView() { + return true; + } +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaEditorPlugin.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaEditorPlugin.java new file mode 100644 index 00000000..bcdef50d --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaEditorPlugin.java @@ -0,0 +1,100 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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 Apa editor plugin. + * + * + * @generated + */ +public final class ApaEditorPlugin extends EMFPlugin { + /** + * Keep track of the singleton. + * + * + * @generated + */ + public static final ApaEditorPlugin INSTANCE = new ApaEditorPlugin(); + + /** + * Keep track of the singleton. + * + * + * @generated + */ + private static Implementation plugin; + + /** + * Create the instance. + * + * + * @generated + */ + public ApaEditorPlugin() { + super + (new ResourceLocator [] { + }); + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * Returns the singleton instance of the Eclipse plugin. + * + * + * @return the singleton instance. + * @generated + */ + public static Implementation getPlugin() { + return plugin; + } + + /** + * The actual implementation of the Eclipse Plugin. + * + * + * @generated + */ + public static class Implementation extends EclipseUIPlugin { + /** + * Creates an instance. + * + * + * @generated + */ + public Implementation() { + super(); + + // Remember the static instance. + // + plugin = this; + } + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaModelWizard.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaModelWizard.java new file mode 100644 index 00000000..16d867bc --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen.editor/src/org/polarsys/capella/diffmerge/bridge/examples/apa/presentation/ApaModelWizard.java @@ -0,0 +1,634 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.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.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; + +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.eclipse.emf.ecore.xmi.XMLResource; + +import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; + +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.jface.dialogs.MessageDialog; + +import org.eclipse.jface.viewers.IStructuredSelection; + +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; + +import org.eclipse.swt.SWT; + +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.ModifyEvent; + +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.actions.WorkspaceModifyOperation; + +import org.eclipse.ui.dialogs.WizardNewFileCreationPage; + +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ISetSelectionTarget; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; +import org.polarsys.capella.diffmerge.bridge.examples.apa.provider.ApaEditPlugin; +import org.eclipse.core.runtime.Path; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; + +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; + + +/** + * This is a simple wizard for creating a new model file. + * + * + * @generated + */ +public class ApaModelWizard extends Wizard implements INewWizard { + /** + * The supported extensions for created files. + * + * + * @generated + */ + public static final List FILE_EXTENSIONS = + Collections.unmodifiableList(Arrays.asList(ApaEditorPlugin.INSTANCE.getString("_UI_ApaEditorFilenameExtensions").split("\\s*,\\s*"))); + + /** + * A formatted list of supported file extensions, suitable for display. + * + * + * @generated + */ + public static final String FORMATTED_FILE_EXTENSIONS = + ApaEditorPlugin.INSTANCE.getString("_UI_ApaEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); + + /** + * This caches an instance of the model package. + * + * + * @generated + */ + protected ApaPackage apaPackage = ApaPackage.eINSTANCE; + + /** + * This caches an instance of the model factory. + * + * + * @generated + */ + protected ApaFactory apaFactory = apaPackage.getApaFactory(); + + /** + * This is the file creation page. + * + * + * @generated + */ + protected ApaModelWizardNewFileCreationPage newFileCreationPage; + + /** + * This is the initial object creation page. + * + * + * @generated + */ + protected ApaModelWizardInitialObjectCreationPage initialObjectCreationPage; + + /** + * Remember the selection during initialization for populating the default container. + * + * + * @generated + */ + protected IStructuredSelection selection; + + /** + * Remember the workbench during initialization. + * + * + * @generated + */ + protected IWorkbench workbench; + + /** + * Caches the names of the types that can be created as the root object. + * + * + * @generated + */ + protected List initialObjectNames; + + /** + * This just records the information. + * + * + * @generated + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + this.selection = selection; + setWindowTitle(ApaEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); + setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ApaEditorPlugin.INSTANCE.getImage("full/wizban/NewApa"))); + } + + /** + * Returns the names of the types that can be created as the root object. + * + * + * @generated + */ + protected Collection getInitialObjectNames() { + if (initialObjectNames == null) { + initialObjectNames = new ArrayList(); + for (EClassifier eClassifier : apaPackage.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. + * + * + * @generated + */ + protected EObject createInitialModel() { + EClass eClass = (EClass)apaPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); + EObject rootObject = apaFactory.create(eClass); + return rootObject; + } + + /** + * Do the work after everything is specified. + * + * + * @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 options = new HashMap(); + options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); + resource.save(options); + } + catch (Exception exception) { + ApaEditorPlugin.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() { + 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(), ApaEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); + return false; + } + + return true; + } + catch (Exception exception) { + ApaEditorPlugin.INSTANCE.log(exception); + return false; + } + } + + /** + * This is the one page of the wizard. + * + * + * @generated + */ + public class ApaModelWizardNewFileCreationPage extends WizardNewFileCreationPage { + /** + * Pass in the selection. + * + * + * @generated + */ + public ApaModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { + super(pageId, selection); + } + + /** + * The framework calls this to see if the file is correct. + * + * + * @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(ApaEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); + return false; + } + return true; + } + return false; + } + + /** + * + * + * @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. + * + * + * @generated + */ + public class ApaModelWizardInitialObjectCreationPage extends WizardPage { + /** + * + * + * @generated + */ + protected Combo initialObjectField; + + /** + * @generated + * + * + */ + protected List encodings; + + /** + * + * + * @generated + */ + protected Combo encodingField; + + /** + * Pass in the selection. + * + * + * @generated + */ + public ApaModelWizardInitialObjectCreationPage(String pageId) { + super(pageId); + } + + /** + * + * + * @generated + */ + 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(ApaEditorPlugin.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(ApaEditorPlugin.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); + } + + /** + * + * + * @generated + */ + protected ModifyListener validator = + new ModifyListener() { + public void modifyText(ModifyEvent e) { + setPageComplete(validatePage()); + } + }; + + /** + * + * + * @generated + */ + protected boolean validatePage() { + return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); + } + + /** + * + * + * @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(); + } + } + } + + /** + * + * + * @generated + */ + public String getInitialObjectName() { + String label = initialObjectField.getText(); + + for (String name : getInitialObjectNames()) { + if (getLabel(name).equals(label)) { + return name; + } + } + return null; + } + + /** + * + * + * @generated + */ + public String getEncoding() { + return encodingField.getText(); + } + + /** + * Returns the label for the specified type name. + * + * + * @generated + */ + protected String getLabel(String typeName) { + try { + return ApaEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); + } + catch(MissingResourceException mre) { + ApaEditorPlugin.INSTANCE.log(mre); + } + return typeName; + } + + /** + * + * + * @generated + */ + protected Collection getEncodings() { + if (encodings == null) { + encodings = new ArrayList(); + for (StringTokenizer stringTokenizer = new StringTokenizer(ApaEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { + encodings.add(stringTokenizer.nextToken()); + } + } + return encodings; + } + } + + /** + * The framework calls this to create the contents of the wizard. + * + * + * @generated + */ + @Override + public void addPages() { + // Create a page, set the title, and the initial model file name. + // + newFileCreationPage = new ApaModelWizardNewFileCreationPage("Whatever", selection); + newFileCreationPage.setTitle(ApaEditorPlugin.INSTANCE.getString("_UI_ApaModelWizard_label")); + newFileCreationPage.setDescription(ApaEditorPlugin.INSTANCE.getString("_UI_ApaModelWizard_description")); + newFileCreationPage.setFileName(ApaEditorPlugin.INSTANCE.getString("_UI_ApaEditorFilenameDefaultBase") + "." + 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 = ApaEditorPlugin.INSTANCE.getString("_UI_ApaEditorFilenameDefaultBase"); + 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 ApaModelWizardInitialObjectCreationPage("Whatever2"); + initialObjectCreationPage.setTitle(ApaEditorPlugin.INSTANCE.getString("_UI_ApaModelWizard_label")); + initialObjectCreationPage.setDescription(ApaEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); + addPage(initialObjectCreationPage); + } + + /** + * Get the file from the page. + * + * + * @generated + */ + public IFile getModelFile() { + return newFileCreationPage.getModelFile(); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.classpath b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.project b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.project new file mode 100644 index 00000000..f7980a59 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.examples.apa.gen + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.settings/org.eclipse.jdt.core.prefs b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..3c814e5e --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,117 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=error +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=ignore +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/META-INF/MANIFEST.MF b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/META-INF/MANIFEST.MF new file mode 100644 index 00000000..7cb4a5de --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.examples.apa.gen;singleton:=true +Bundle-Version: 0.14.1.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Export-Package: org.polarsys.capella.diffmerge.bridge.examples.apa, + org.polarsys.capella.diffmerge.bridge.examples.apa.impl, + org.polarsys.capella.diffmerge.bridge.examples.apa.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport +Bundle-ActivationPolicy: lazy +Eclipse-LazyStart: true +Automatic-Module-Name: org.polarsys.capella.diffmerge.bridge.examples.apa.gen diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/about.html b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

    About This Content

    + +

    August 17, 2018

    +

    License

    +

    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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

    +

    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 http://www.eclipse.org.

    + + \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/build.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/build.properties new file mode 100644 index 00000000..776cca19 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/build.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties,\ + about.html +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/model/Apa.ecore b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/model/Apa.ecore new file mode 100644 index 00000000..8d39d19a --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/model/Apa.ecore @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/model/Apa.genmodel b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/model/Apa.genmodel new file mode 100644 index 00000000..58b3f4ca --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/model/Apa.genmodel @@ -0,0 +1,38 @@ + + + Apa.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/plugin.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/plugin.properties new file mode 100644 index 00000000..dd97116b --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/plugin.properties @@ -0,0 +1,11 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +pluginName = APA - Abstract Physical Architecture Model (Incubation) +providerName = www;polarsys.org +# ==================================================================== diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/plugin.xml b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/plugin.xml new file mode 100644 index 00000000..a74b3997 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/plugin.xml @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ABehavior.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ABehavior.java new file mode 100644 index 00000000..3f38dd13 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ABehavior.java @@ -0,0 +1,80 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'ABehavior'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getOwningNode Owning Node}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getFunctions Functions}
    • + *
    + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getABehavior() + * @model + * @generated + */ +public interface ABehavior extends ANamedElement { + /** + * Returns the value of the 'Owning Node' container reference. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getBehaviors Behaviors}'. + * + *

    + * If the meaning of the 'Owning Node' container reference isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Owning Node' container reference. + * @see #setOwningNode(ANode) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getABehavior_OwningNode() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getBehaviors + * @model opposite="behaviors" required="true" transient="false" + * @generated + */ + ANode getOwningNode(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getOwningNode Owning Node}' container reference. + * + * + * @param value the new value of the 'Owning Node' container reference. + * @see #getOwningNode() + * @generated + */ + void setOwningNode(ANode value); + + /** + * Returns the value of the 'Functions' containment reference list. + * The list contents are of type {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction}. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOwningBehavior Owning Behavior}'. + * + *

    + * If the meaning of the 'Functions' containment reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Functions' containment reference list. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getABehavior_Functions() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOwningBehavior + * @model opposite="owningBehavior" containment="true" + * @generated + */ + EList getFunctions(); + +} // ABehavior diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AExchange.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AExchange.java new file mode 100644 index 00000000..29944054 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AExchange.java @@ -0,0 +1,118 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + + +/** + * + * A representation of the model object 'AExchange'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getOwningScope Owning Scope}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getSource Source}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getTarget Target}
    • + *
    + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAExchange() + * @model + * @generated + */ +public interface AExchange extends ANamedElement { + /** + * Returns the value of the 'Owning Scope' container reference. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getExchanges Exchanges}'. + * + *

    + * If the meaning of the 'Owning Scope' container reference isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Owning Scope' container reference. + * @see #setOwningScope(AScope) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAExchange_OwningScope() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getExchanges + * @model opposite="exchanges" required="true" transient="false" + * @generated + */ + AScope getOwningScope(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getOwningScope Owning Scope}' container reference. + * + * + * @param value the new value of the 'Owning Scope' container reference. + * @see #getOwningScope() + * @generated + */ + void setOwningScope(AScope value); + + /** + * Returns the value of the 'Source' reference. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOutgoing Outgoing}'. + * + *

    + * If the meaning of the 'Source' reference isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Source' reference. + * @see #setSource(AFunction) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAExchange_Source() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOutgoing + * @model opposite="outgoing" required="true" + * @generated + */ + AFunction getSource(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getSource Source}' reference. + * + * + * @param value the new value of the 'Source' reference. + * @see #getSource() + * @generated + */ + void setSource(AFunction value); + + /** + * Returns the value of the 'Target' reference. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getIncoming Incoming}'. + * + *

    + * If the meaning of the 'Target' reference isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Target' reference. + * @see #setTarget(AFunction) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAExchange_Target() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getIncoming + * @model opposite="incoming" required="true" + * @generated + */ + AFunction getTarget(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getTarget Target}' reference. + * + * + * @param value the new value of the 'Target' reference. + * @see #getTarget() + * @generated + */ + void setTarget(AFunction value); + +} // AExchange diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AFunction.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AFunction.java new file mode 100644 index 00000000..2d3aaf9e --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AFunction.java @@ -0,0 +1,99 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'AFunction'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOwningBehavior Owning Behavior}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getIncoming Incoming}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOutgoing Outgoing}
    • + *
    + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAFunction() + * @model + * @generated + */ +public interface AFunction extends ANamedElement { + /** + * Returns the value of the 'Owning Behavior' container reference. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getFunctions Functions}'. + * + *

    + * If the meaning of the 'Owning Behavior' container reference isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Owning Behavior' container reference. + * @see #setOwningBehavior(ABehavior) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAFunction_OwningBehavior() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getFunctions + * @model opposite="functions" required="true" transient="false" + * @generated + */ + ABehavior getOwningBehavior(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOwningBehavior Owning Behavior}' container reference. + * + * + * @param value the new value of the 'Owning Behavior' container reference. + * @see #getOwningBehavior() + * @generated + */ + void setOwningBehavior(ABehavior value); + + /** + * Returns the value of the 'Incoming' reference list. + * The list contents are of type {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange}. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getTarget Target}'. + * + *

    + * If the meaning of the 'Incoming' reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Incoming' reference list. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAFunction_Incoming() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getTarget + * @model opposite="target" + * @generated + */ + EList getIncoming(); + + /** + * Returns the value of the 'Outgoing' reference list. + * The list contents are of type {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange}. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getSource Source}'. + * + *

    + * If the meaning of the 'Outgoing' reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Outgoing' reference list. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAFunction_Outgoing() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getSource + * @model opposite="source" + * @generated + */ + EList getOutgoing(); + +} // AFunction diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ANamedElement.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ANamedElement.java new file mode 100644 index 00000000..4cee9fbf --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ANamedElement.java @@ -0,0 +1,86 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'ANamed Element'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getId Id}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getName Name}
    • + *
    + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getANamedElement() + * @model abstract="true" + * @generated + */ +public interface ANamedElement extends EObject { + /** + * Returns the value of the 'Id' attribute. + * + *

    + * If the meaning of the 'Id' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Id' attribute. + * @see #setId(String) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getANamedElement_Id() + * @model id="true" required="true" + * @generated + */ + String getId(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getId Id}' attribute. + * + * + * @param value the new value of the 'Id' attribute. + * @see #getId() + * @generated + */ + void setId(String value); + + /** + * Returns the value of the 'Name' attribute. + * + *

    + * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getANamedElement_Name() + * @model required="true" + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + +} // ANamedElement diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ANode.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ANode.java new file mode 100644 index 00000000..51fb4ed7 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ANode.java @@ -0,0 +1,80 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'ANode'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getOwningScope Owning Scope}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getBehaviors Behaviors}
    • + *
    + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getANode() + * @model + * @generated + */ +public interface ANode extends ANamedElement { + /** + * Returns the value of the 'Owning Scope' container reference. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getNodes Nodes}'. + * + *

    + * If the meaning of the 'Owning Scope' container reference isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Owning Scope' container reference. + * @see #setOwningScope(AScope) + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getANode_OwningScope() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getNodes + * @model opposite="nodes" required="true" transient="false" + * @generated + */ + AScope getOwningScope(); + + /** + * Sets the value of the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getOwningScope Owning Scope}' container reference. + * + * + * @param value the new value of the 'Owning Scope' container reference. + * @see #getOwningScope() + * @generated + */ + void setOwningScope(AScope value); + + /** + * Returns the value of the 'Behaviors' containment reference list. + * The list contents are of type {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior}. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getOwningNode Owning Node}'. + * + *

    + * If the meaning of the 'Behaviors' containment reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Behaviors' containment reference list. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getANode_Behaviors() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getOwningNode + * @model opposite="owningNode" containment="true" + * @generated + */ + EList getBehaviors(); + +} // ANode diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AScope.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AScope.java new file mode 100644 index 00000000..74a0452f --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/AScope.java @@ -0,0 +1,70 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.emf.common.util.EList; + +/** + * + * A representation of the model object 'AScope'. + * + * + *

    + * The following features are supported: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getNodes Nodes}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getExchanges Exchanges}
    • + *
    + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAScope() + * @model + * @generated + */ +public interface AScope extends ANamedElement { + /** + * Returns the value of the 'Nodes' containment reference list. + * The list contents are of type {@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode}. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getOwningScope Owning Scope}'. + * + *

    + * If the meaning of the 'Nodes' containment reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Nodes' containment reference list. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAScope_Nodes() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getOwningScope + * @model opposite="owningScope" containment="true" + * @generated + */ + EList getNodes(); + + /** + * Returns the value of the 'Exchanges' containment reference list. + * The list contents are of type {@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange}. + * It is bidirectional and its opposite is '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getOwningScope Owning Scope}'. + * + *

    + * If the meaning of the 'Exchanges' containment reference list isn't clear, + * there really should be more of a description here... + *

    + * + * @return the value of the 'Exchanges' containment reference list. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#getAScope_Exchanges() + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getOwningScope + * @model opposite="owningScope" containment="true" + * @generated + */ + EList getExchanges(); + +} // AScope diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ApaFactory.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ApaFactory.java new file mode 100644 index 00000000..59847cd1 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ApaFactory.java @@ -0,0 +1,87 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage + * @generated + */ +public interface ApaFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + ApaFactory eINSTANCE = org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaFactoryImpl.init(); + + /** + * Returns a new object of class 'AScope'. + * + * + * @return a new object of class 'AScope'. + * @generated + */ + AScope createAScope(); + + /** + * Returns a new object of class 'ANode'. + * + * + * @return a new object of class 'ANode'. + * @generated + */ + ANode createANode(); + + /** + * Returns a new object of class 'ABehavior'. + * + * + * @return a new object of class 'ABehavior'. + * @generated + */ + ABehavior createABehavior(); + + /** + * Returns a new object of class 'AFunction'. + * + * + * @return a new object of class 'AFunction'. + * @generated + */ + AFunction createAFunction(); + + /** + * Returns a new object of class 'AExchange'. + * + * + * @return a new object of class 'AExchange'. + * @generated + */ + AExchange createAExchange(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + ApaPackage getApaPackage(); + +} //ApaFactory diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ApaPackage.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ApaPackage.java new file mode 100644 index 00000000..e5d77f68 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/ApaPackage.java @@ -0,0 +1,863 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
      + *
    • each class,
    • + *
    • each feature of each class,
    • + *
    • each enum,
    • + *
    • and each data type
    • + *
    + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory + * @model kind="package" + * @generated + */ +public interface ApaPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "apa"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/diffmerge/bridge/apa/1.0.0"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "org.polarsys.capella.diffmerge.bridge.examples.apa.gen"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + ApaPackage eINSTANCE = org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl.init(); + + /** + * The meta object id for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANamedElementImpl ANamed Element}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANamedElementImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getANamedElement() + * @generated + */ + int ANAMED_ELEMENT = 0; + + /** + * The feature id for the 'Id' attribute. + * + * + * @generated + * @ordered + */ + int ANAMED_ELEMENT__ID = 0; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int ANAMED_ELEMENT__NAME = 1; + + /** + * The number of structural features of the 'ANamed Element' class. + * + * + * @generated + * @ordered + */ + int ANAMED_ELEMENT_FEATURE_COUNT = 2; + + /** + * The number of operations of the 'ANamed Element' class. + * + * + * @generated + * @ordered + */ + int ANAMED_ELEMENT_OPERATION_COUNT = 0; + + /** + * The meta object id for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AScopeImpl AScope}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AScopeImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getAScope() + * @generated + */ + int ASCOPE = 1; + + /** + * The feature id for the 'Id' attribute. + * + * + * @generated + * @ordered + */ + int ASCOPE__ID = ANAMED_ELEMENT__ID; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int ASCOPE__NAME = ANAMED_ELEMENT__NAME; + + /** + * The feature id for the 'Nodes' containment reference list. + * + * + * @generated + * @ordered + */ + int ASCOPE__NODES = ANAMED_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Exchanges' containment reference list. + * + * + * @generated + * @ordered + */ + int ASCOPE__EXCHANGES = ANAMED_ELEMENT_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'AScope' class. + * + * + * @generated + * @ordered + */ + int ASCOPE_FEATURE_COUNT = ANAMED_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'AScope' class. + * + * + * @generated + * @ordered + */ + int ASCOPE_OPERATION_COUNT = ANAMED_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANodeImpl ANode}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANodeImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getANode() + * @generated + */ + int ANODE = 2; + + /** + * The feature id for the 'Id' attribute. + * + * + * @generated + * @ordered + */ + int ANODE__ID = ANAMED_ELEMENT__ID; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int ANODE__NAME = ANAMED_ELEMENT__NAME; + + /** + * The feature id for the 'Owning Scope' container reference. + * + * + * @generated + * @ordered + */ + int ANODE__OWNING_SCOPE = ANAMED_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Behaviors' containment reference list. + * + * + * @generated + * @ordered + */ + int ANODE__BEHAVIORS = ANAMED_ELEMENT_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'ANode' class. + * + * + * @generated + * @ordered + */ + int ANODE_FEATURE_COUNT = ANAMED_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'ANode' class. + * + * + * @generated + * @ordered + */ + int ANODE_OPERATION_COUNT = ANAMED_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ABehaviorImpl ABehavior}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ABehaviorImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getABehavior() + * @generated + */ + int ABEHAVIOR = 3; + + /** + * The feature id for the 'Id' attribute. + * + * + * @generated + * @ordered + */ + int ABEHAVIOR__ID = ANAMED_ELEMENT__ID; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int ABEHAVIOR__NAME = ANAMED_ELEMENT__NAME; + + /** + * The feature id for the 'Owning Node' container reference. + * + * + * @generated + * @ordered + */ + int ABEHAVIOR__OWNING_NODE = ANAMED_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Functions' containment reference list. + * + * + * @generated + * @ordered + */ + int ABEHAVIOR__FUNCTIONS = ANAMED_ELEMENT_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'ABehavior' class. + * + * + * @generated + * @ordered + */ + int ABEHAVIOR_FEATURE_COUNT = ANAMED_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of operations of the 'ABehavior' class. + * + * + * @generated + * @ordered + */ + int ABEHAVIOR_OPERATION_COUNT = ANAMED_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AFunctionImpl AFunction}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AFunctionImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getAFunction() + * @generated + */ + int AFUNCTION = 4; + + /** + * The feature id for the 'Id' attribute. + * + * + * @generated + * @ordered + */ + int AFUNCTION__ID = ANAMED_ELEMENT__ID; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int AFUNCTION__NAME = ANAMED_ELEMENT__NAME; + + /** + * The feature id for the 'Owning Behavior' container reference. + * + * + * @generated + * @ordered + */ + int AFUNCTION__OWNING_BEHAVIOR = ANAMED_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Incoming' reference list. + * + * + * @generated + * @ordered + */ + int AFUNCTION__INCOMING = ANAMED_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Outgoing' reference list. + * + * + * @generated + * @ordered + */ + int AFUNCTION__OUTGOING = ANAMED_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'AFunction' class. + * + * + * @generated + * @ordered + */ + int AFUNCTION_FEATURE_COUNT = ANAMED_ELEMENT_FEATURE_COUNT + 3; + + /** + * The number of operations of the 'AFunction' class. + * + * + * @generated + * @ordered + */ + int AFUNCTION_OPERATION_COUNT = ANAMED_ELEMENT_OPERATION_COUNT + 0; + + /** + * The meta object id for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AExchangeImpl AExchange}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AExchangeImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getAExchange() + * @generated + */ + int AEXCHANGE = 5; + + /** + * The feature id for the 'Id' attribute. + * + * + * @generated + * @ordered + */ + int AEXCHANGE__ID = ANAMED_ELEMENT__ID; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int AEXCHANGE__NAME = ANAMED_ELEMENT__NAME; + + /** + * The feature id for the 'Owning Scope' container reference. + * + * + * @generated + * @ordered + */ + int AEXCHANGE__OWNING_SCOPE = ANAMED_ELEMENT_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Source' reference. + * + * + * @generated + * @ordered + */ + int AEXCHANGE__SOURCE = ANAMED_ELEMENT_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Target' reference. + * + * + * @generated + * @ordered + */ + int AEXCHANGE__TARGET = ANAMED_ELEMENT_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'AExchange' class. + * + * + * @generated + * @ordered + */ + int AEXCHANGE_FEATURE_COUNT = ANAMED_ELEMENT_FEATURE_COUNT + 3; + + + /** + * The number of operations of the 'AExchange' class. + * + * + * @generated + * @ordered + */ + int AEXCHANGE_OPERATION_COUNT = ANAMED_ELEMENT_OPERATION_COUNT + 0; + + + /** + * Returns the meta object for class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement ANamed Element}'. + * + * + * @return the meta object for class 'ANamed Element'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement + * @generated + */ + EClass getANamedElement(); + + /** + * Returns the meta object for the attribute '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getId Id}'. + * + * + * @return the meta object for the attribute 'Id'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getId() + * @see #getANamedElement() + * @generated + */ + EAttribute getANamedElement_Id(); + + /** + * Returns the meta object for the attribute '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement#getName() + * @see #getANamedElement() + * @generated + */ + EAttribute getANamedElement_Name(); + + /** + * Returns the meta object for class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope AScope}'. + * + * + * @return the meta object for class 'AScope'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AScope + * @generated + */ + EClass getAScope(); + + /** + * Returns the meta object for the containment reference list '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getNodes Nodes}'. + * + * + * @return the meta object for the containment reference list 'Nodes'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getNodes() + * @see #getAScope() + * @generated + */ + EReference getAScope_Nodes(); + + /** + * Returns the meta object for the containment reference list '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getExchanges Exchanges}'. + * + * + * @return the meta object for the containment reference list 'Exchanges'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AScope#getExchanges() + * @see #getAScope() + * @generated + */ + EReference getAScope_Exchanges(); + + /** + * Returns the meta object for class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode ANode}'. + * + * + * @return the meta object for class 'ANode'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANode + * @generated + */ + EClass getANode(); + + /** + * Returns the meta object for the container reference '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getOwningScope Owning Scope}'. + * + * + * @return the meta object for the container reference 'Owning Scope'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getOwningScope() + * @see #getANode() + * @generated + */ + EReference getANode_OwningScope(); + + /** + * Returns the meta object for the containment reference list '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getBehaviors Behaviors}'. + * + * + * @return the meta object for the containment reference list 'Behaviors'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANode#getBehaviors() + * @see #getANode() + * @generated + */ + EReference getANode_Behaviors(); + + /** + * Returns the meta object for class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior ABehavior}'. + * + * + * @return the meta object for class 'ABehavior'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior + * @generated + */ + EClass getABehavior(); + + /** + * Returns the meta object for the container reference '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getOwningNode Owning Node}'. + * + * + * @return the meta object for the container reference 'Owning Node'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getOwningNode() + * @see #getABehavior() + * @generated + */ + EReference getABehavior_OwningNode(); + + /** + * Returns the meta object for the containment reference list '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getFunctions Functions}'. + * + * + * @return the meta object for the containment reference list 'Functions'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior#getFunctions() + * @see #getABehavior() + * @generated + */ + EReference getABehavior_Functions(); + + /** + * Returns the meta object for class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction AFunction}'. + * + * + * @return the meta object for class 'AFunction'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction + * @generated + */ + EClass getAFunction(); + + /** + * Returns the meta object for the container reference '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOwningBehavior Owning Behavior}'. + * + * + * @return the meta object for the container reference 'Owning Behavior'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOwningBehavior() + * @see #getAFunction() + * @generated + */ + EReference getAFunction_OwningBehavior(); + + /** + * Returns the meta object for the reference list '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getIncoming Incoming}'. + * + * + * @return the meta object for the reference list 'Incoming'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getIncoming() + * @see #getAFunction() + * @generated + */ + EReference getAFunction_Incoming(); + + /** + * Returns the meta object for the reference list '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOutgoing Outgoing}'. + * + * + * @return the meta object for the reference list 'Outgoing'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction#getOutgoing() + * @see #getAFunction() + * @generated + */ + EReference getAFunction_Outgoing(); + + /** + * Returns the meta object for class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange AExchange}'. + * + * + * @return the meta object for class 'AExchange'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange + * @generated + */ + EClass getAExchange(); + + /** + * Returns the meta object for the container reference '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getOwningScope Owning Scope}'. + * + * + * @return the meta object for the container reference 'Owning Scope'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getOwningScope() + * @see #getAExchange() + * @generated + */ + EReference getAExchange_OwningScope(); + + /** + * Returns the meta object for the reference '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getSource Source}'. + * + * + * @return the meta object for the reference 'Source'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getSource() + * @see #getAExchange() + * @generated + */ + EReference getAExchange_Source(); + + /** + * Returns the meta object for the reference '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getTarget Target}'. + * + * + * @return the meta object for the reference 'Target'. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange#getTarget() + * @see #getAExchange() + * @generated + */ + EReference getAExchange_Target(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + ApaFactory getApaFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
      + *
    • each class,
    • + *
    • each feature of each class,
    • + *
    • each enum,
    • + *
    • and each data type
    • + *
    + * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANamedElementImpl ANamed Element}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANamedElementImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getANamedElement() + * @generated + */ + EClass ANAMED_ELEMENT = eINSTANCE.getANamedElement(); + + /** + * The meta object literal for the 'Id' attribute feature. + * + * + * @generated + */ + EAttribute ANAMED_ELEMENT__ID = eINSTANCE.getANamedElement_Id(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute ANAMED_ELEMENT__NAME = eINSTANCE.getANamedElement_Name(); + + /** + * The meta object literal for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AScopeImpl AScope}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AScopeImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getAScope() + * @generated + */ + EClass ASCOPE = eINSTANCE.getAScope(); + + /** + * The meta object literal for the 'Nodes' containment reference list feature. + * + * + * @generated + */ + EReference ASCOPE__NODES = eINSTANCE.getAScope_Nodes(); + + /** + * The meta object literal for the 'Exchanges' containment reference list feature. + * + * + * @generated + */ + EReference ASCOPE__EXCHANGES = eINSTANCE.getAScope_Exchanges(); + + /** + * The meta object literal for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANodeImpl ANode}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANodeImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getANode() + * @generated + */ + EClass ANODE = eINSTANCE.getANode(); + + /** + * The meta object literal for the 'Owning Scope' container reference feature. + * + * + * @generated + */ + EReference ANODE__OWNING_SCOPE = eINSTANCE.getANode_OwningScope(); + + /** + * The meta object literal for the 'Behaviors' containment reference list feature. + * + * + * @generated + */ + EReference ANODE__BEHAVIORS = eINSTANCE.getANode_Behaviors(); + + /** + * The meta object literal for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ABehaviorImpl ABehavior}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ABehaviorImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getABehavior() + * @generated + */ + EClass ABEHAVIOR = eINSTANCE.getABehavior(); + + /** + * The meta object literal for the 'Owning Node' container reference feature. + * + * + * @generated + */ + EReference ABEHAVIOR__OWNING_NODE = eINSTANCE.getABehavior_OwningNode(); + + /** + * The meta object literal for the 'Functions' containment reference list feature. + * + * + * @generated + */ + EReference ABEHAVIOR__FUNCTIONS = eINSTANCE.getABehavior_Functions(); + + /** + * The meta object literal for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AFunctionImpl AFunction}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AFunctionImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getAFunction() + * @generated + */ + EClass AFUNCTION = eINSTANCE.getAFunction(); + + /** + * The meta object literal for the 'Owning Behavior' container reference feature. + * + * + * @generated + */ + EReference AFUNCTION__OWNING_BEHAVIOR = eINSTANCE.getAFunction_OwningBehavior(); + + /** + * The meta object literal for the 'Incoming' reference list feature. + * + * + * @generated + */ + EReference AFUNCTION__INCOMING = eINSTANCE.getAFunction_Incoming(); + + /** + * The meta object literal for the 'Outgoing' reference list feature. + * + * + * @generated + */ + EReference AFUNCTION__OUTGOING = eINSTANCE.getAFunction_Outgoing(); + + /** + * The meta object literal for the '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AExchangeImpl AExchange}' class. + * + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AExchangeImpl + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ApaPackageImpl#getAExchange() + * @generated + */ + EClass AEXCHANGE = eINSTANCE.getAExchange(); + + /** + * The meta object literal for the 'Owning Scope' container reference feature. + * + * + * @generated + */ + EReference AEXCHANGE__OWNING_SCOPE = eINSTANCE.getAExchange_OwningScope(); + + /** + * The meta object literal for the 'Source' reference feature. + * + * + * @generated + */ + EReference AEXCHANGE__SOURCE = eINSTANCE.getAExchange_Source(); + + /** + * The meta object literal for the 'Target' reference feature. + * + * + * @generated + */ + EReference AEXCHANGE__TARGET = eINSTANCE.getAExchange_Target(); + + } + +} //ApaPackage diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ABehaviorImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ABehaviorImpl.java new file mode 100644 index 00000000..242783d4 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ABehaviorImpl.java @@ -0,0 +1,249 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.InternalEList; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * + * An implementation of the model object 'ABehavior'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ABehaviorImpl#getOwningNode Owning Node}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ABehaviorImpl#getFunctions Functions}
    • + *
    + * + * @generated + */ +public class ABehaviorImpl extends ANamedElementImpl implements ABehavior { + /** + * The cached value of the '{@link #getFunctions() Functions}' containment reference list. + * + * + * @see #getFunctions() + * @generated + * @ordered + */ + protected EList functions; + + /** + * + * + * @generated + */ + protected ABehaviorImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ApaPackage.Literals.ABEHAVIOR; + } + + /** + * + * + * @generated + */ + public ANode getOwningNode() { + if (eContainerFeatureID() != ApaPackage.ABEHAVIOR__OWNING_NODE) return null; + return (ANode)eInternalContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetOwningNode(ANode newOwningNode, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newOwningNode, ApaPackage.ABEHAVIOR__OWNING_NODE, msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setOwningNode(ANode newOwningNode) { + if (newOwningNode != eInternalContainer() || (eContainerFeatureID() != ApaPackage.ABEHAVIOR__OWNING_NODE && newOwningNode != null)) { + if (EcoreUtil.isAncestor(this, newOwningNode)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newOwningNode != null) + msgs = ((InternalEObject)newOwningNode).eInverseAdd(this, ApaPackage.ANODE__BEHAVIORS, ANode.class, msgs); + msgs = basicSetOwningNode(newOwningNode, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.ABEHAVIOR__OWNING_NODE, newOwningNode, newOwningNode)); + } + + /** + * + * + * @generated + */ + public EList getFunctions() { + if (functions == null) { + functions = new EObjectContainmentWithInverseEList(AFunction.class, this, ApaPackage.ABEHAVIOR__FUNCTIONS, ApaPackage.AFUNCTION__OWNING_BEHAVIOR); + } + return functions; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.ABEHAVIOR__OWNING_NODE: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetOwningNode((ANode)otherEnd, msgs); + case ApaPackage.ABEHAVIOR__FUNCTIONS: + return ((InternalEList)(InternalEList)getFunctions()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.ABEHAVIOR__OWNING_NODE: + return basicSetOwningNode(null, msgs); + case ApaPackage.ABEHAVIOR__FUNCTIONS: + return ((InternalEList)getFunctions()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case ApaPackage.ABEHAVIOR__OWNING_NODE: + return eInternalContainer().eInverseRemove(this, ApaPackage.ANODE__BEHAVIORS, ANode.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ApaPackage.ABEHAVIOR__OWNING_NODE: + return getOwningNode(); + case ApaPackage.ABEHAVIOR__FUNCTIONS: + return getFunctions(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ApaPackage.ABEHAVIOR__OWNING_NODE: + setOwningNode((ANode)newValue); + return; + case ApaPackage.ABEHAVIOR__FUNCTIONS: + getFunctions().clear(); + getFunctions().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ApaPackage.ABEHAVIOR__OWNING_NODE: + setOwningNode((ANode)null); + return; + case ApaPackage.ABEHAVIOR__FUNCTIONS: + getFunctions().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ApaPackage.ABEHAVIOR__OWNING_NODE: + return getOwningNode() != null; + case ApaPackage.ABEHAVIOR__FUNCTIONS: + return functions != null && !functions.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ABehaviorImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AExchangeImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AExchangeImpl.java new file mode 100644 index 00000000..87115dc7 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AExchangeImpl.java @@ -0,0 +1,379 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +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.EcoreUtil; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * + * An implementation of the model object 'AExchange'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AExchangeImpl#getOwningScope Owning Scope}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AExchangeImpl#getSource Source}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AExchangeImpl#getTarget Target}
    • + *
    + * + * @generated + */ +public class AExchangeImpl extends ANamedElementImpl implements AExchange { + /** + * The cached value of the '{@link #getSource() Source}' reference. + * + * + * @see #getSource() + * @generated + * @ordered + */ + protected AFunction source; + + /** + * The cached value of the '{@link #getTarget() Target}' reference. + * + * + * @see #getTarget() + * @generated + * @ordered + */ + protected AFunction target; + + /** + * + * + * @generated + */ + protected AExchangeImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ApaPackage.Literals.AEXCHANGE; + } + + /** + * + * + * @generated + */ + public AScope getOwningScope() { + if (eContainerFeatureID() != ApaPackage.AEXCHANGE__OWNING_SCOPE) return null; + return (AScope)eInternalContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetOwningScope(AScope newOwningScope, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newOwningScope, ApaPackage.AEXCHANGE__OWNING_SCOPE, msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setOwningScope(AScope newOwningScope) { + if (newOwningScope != eInternalContainer() || (eContainerFeatureID() != ApaPackage.AEXCHANGE__OWNING_SCOPE && newOwningScope != null)) { + if (EcoreUtil.isAncestor(this, newOwningScope)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newOwningScope != null) + msgs = ((InternalEObject)newOwningScope).eInverseAdd(this, ApaPackage.ASCOPE__EXCHANGES, AScope.class, msgs); + msgs = basicSetOwningScope(newOwningScope, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.AEXCHANGE__OWNING_SCOPE, newOwningScope, newOwningScope)); + } + + /** + * + * + * @generated + */ + public AFunction getSource() { + if (source != null && source.eIsProxy()) { + InternalEObject oldSource = (InternalEObject)source; + source = (AFunction)eResolveProxy(oldSource); + if (source != oldSource) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ApaPackage.AEXCHANGE__SOURCE, oldSource, source)); + } + } + return source; + } + + /** + * + * + * @generated + */ + public AFunction basicGetSource() { + return source; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetSource(AFunction newSource, NotificationChain msgs) { + AFunction oldSource = source; + source = newSource; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ApaPackage.AEXCHANGE__SOURCE, oldSource, newSource); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setSource(AFunction newSource) { + if (newSource != source) { + NotificationChain msgs = null; + if (source != null) + msgs = ((InternalEObject)source).eInverseRemove(this, ApaPackage.AFUNCTION__OUTGOING, AFunction.class, msgs); + if (newSource != null) + msgs = ((InternalEObject)newSource).eInverseAdd(this, ApaPackage.AFUNCTION__OUTGOING, AFunction.class, msgs); + msgs = basicSetSource(newSource, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.AEXCHANGE__SOURCE, newSource, newSource)); + } + + /** + * + * + * @generated + */ + public AFunction getTarget() { + if (target != null && target.eIsProxy()) { + InternalEObject oldTarget = (InternalEObject)target; + target = (AFunction)eResolveProxy(oldTarget); + if (target != oldTarget) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, ApaPackage.AEXCHANGE__TARGET, oldTarget, target)); + } + } + return target; + } + + /** + * + * + * @generated + */ + public AFunction basicGetTarget() { + return target; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetTarget(AFunction newTarget, NotificationChain msgs) { + AFunction oldTarget = target; + target = newTarget; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ApaPackage.AEXCHANGE__TARGET, oldTarget, newTarget); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setTarget(AFunction newTarget) { + if (newTarget != target) { + NotificationChain msgs = null; + if (target != null) + msgs = ((InternalEObject)target).eInverseRemove(this, ApaPackage.AFUNCTION__INCOMING, AFunction.class, msgs); + if (newTarget != null) + msgs = ((InternalEObject)newTarget).eInverseAdd(this, ApaPackage.AFUNCTION__INCOMING, AFunction.class, msgs); + msgs = basicSetTarget(newTarget, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.AEXCHANGE__TARGET, newTarget, newTarget)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.AEXCHANGE__OWNING_SCOPE: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetOwningScope((AScope)otherEnd, msgs); + case ApaPackage.AEXCHANGE__SOURCE: + if (source != null) + msgs = ((InternalEObject)source).eInverseRemove(this, ApaPackage.AFUNCTION__OUTGOING, AFunction.class, msgs); + return basicSetSource((AFunction)otherEnd, msgs); + case ApaPackage.AEXCHANGE__TARGET: + if (target != null) + msgs = ((InternalEObject)target).eInverseRemove(this, ApaPackage.AFUNCTION__INCOMING, AFunction.class, msgs); + return basicSetTarget((AFunction)otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.AEXCHANGE__OWNING_SCOPE: + return basicSetOwningScope(null, msgs); + case ApaPackage.AEXCHANGE__SOURCE: + return basicSetSource(null, msgs); + case ApaPackage.AEXCHANGE__TARGET: + return basicSetTarget(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case ApaPackage.AEXCHANGE__OWNING_SCOPE: + return eInternalContainer().eInverseRemove(this, ApaPackage.ASCOPE__EXCHANGES, AScope.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ApaPackage.AEXCHANGE__OWNING_SCOPE: + return getOwningScope(); + case ApaPackage.AEXCHANGE__SOURCE: + if (resolve) return getSource(); + return basicGetSource(); + case ApaPackage.AEXCHANGE__TARGET: + if (resolve) return getTarget(); + return basicGetTarget(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ApaPackage.AEXCHANGE__OWNING_SCOPE: + setOwningScope((AScope)newValue); + return; + case ApaPackage.AEXCHANGE__SOURCE: + setSource((AFunction)newValue); + return; + case ApaPackage.AEXCHANGE__TARGET: + setTarget((AFunction)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ApaPackage.AEXCHANGE__OWNING_SCOPE: + setOwningScope((AScope)null); + return; + case ApaPackage.AEXCHANGE__SOURCE: + setSource((AFunction)null); + return; + case ApaPackage.AEXCHANGE__TARGET: + setTarget((AFunction)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ApaPackage.AEXCHANGE__OWNING_SCOPE: + return getOwningScope() != null; + case ApaPackage.AEXCHANGE__SOURCE: + return source != null; + case ApaPackage.AEXCHANGE__TARGET: + return target != null; + } + return super.eIsSet(featureID); + } + +} //AExchangeImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AFunctionImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AFunctionImpl.java new file mode 100644 index 00000000..4819909f --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AFunctionImpl.java @@ -0,0 +1,287 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.EObjectWithInverseResolvingEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.InternalEList; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * + * An implementation of the model object 'AFunction'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AFunctionImpl#getOwningBehavior Owning Behavior}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AFunctionImpl#getIncoming Incoming}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AFunctionImpl#getOutgoing Outgoing}
    • + *
    + * + * @generated + */ +public class AFunctionImpl extends ANamedElementImpl implements AFunction { + /** + * The cached value of the '{@link #getIncoming() Incoming}' reference list. + * + * + * @see #getIncoming() + * @generated + * @ordered + */ + protected EList incoming; + + /** + * The cached value of the '{@link #getOutgoing() Outgoing}' reference list. + * + * + * @see #getOutgoing() + * @generated + * @ordered + */ + protected EList outgoing; + + /** + * + * + * @generated + */ + protected AFunctionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ApaPackage.Literals.AFUNCTION; + } + + /** + * + * + * @generated + */ + public ABehavior getOwningBehavior() { + if (eContainerFeatureID() != ApaPackage.AFUNCTION__OWNING_BEHAVIOR) return null; + return (ABehavior)eInternalContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetOwningBehavior(ABehavior newOwningBehavior, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newOwningBehavior, ApaPackage.AFUNCTION__OWNING_BEHAVIOR, msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setOwningBehavior(ABehavior newOwningBehavior) { + if (newOwningBehavior != eInternalContainer() || (eContainerFeatureID() != ApaPackage.AFUNCTION__OWNING_BEHAVIOR && newOwningBehavior != null)) { + if (EcoreUtil.isAncestor(this, newOwningBehavior)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newOwningBehavior != null) + msgs = ((InternalEObject)newOwningBehavior).eInverseAdd(this, ApaPackage.ABEHAVIOR__FUNCTIONS, ABehavior.class, msgs); + msgs = basicSetOwningBehavior(newOwningBehavior, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.AFUNCTION__OWNING_BEHAVIOR, newOwningBehavior, newOwningBehavior)); + } + + /** + * + * + * @generated + */ + public EList getIncoming() { + if (incoming == null) { + incoming = new EObjectWithInverseResolvingEList(AExchange.class, this, ApaPackage.AFUNCTION__INCOMING, ApaPackage.AEXCHANGE__TARGET); + } + return incoming; + } + + /** + * + * + * @generated + */ + public EList getOutgoing() { + if (outgoing == null) { + outgoing = new EObjectWithInverseResolvingEList(AExchange.class, this, ApaPackage.AFUNCTION__OUTGOING, ApaPackage.AEXCHANGE__SOURCE); + } + return outgoing; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.AFUNCTION__OWNING_BEHAVIOR: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetOwningBehavior((ABehavior)otherEnd, msgs); + case ApaPackage.AFUNCTION__INCOMING: + return ((InternalEList)(InternalEList)getIncoming()).basicAdd(otherEnd, msgs); + case ApaPackage.AFUNCTION__OUTGOING: + return ((InternalEList)(InternalEList)getOutgoing()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.AFUNCTION__OWNING_BEHAVIOR: + return basicSetOwningBehavior(null, msgs); + case ApaPackage.AFUNCTION__INCOMING: + return ((InternalEList)getIncoming()).basicRemove(otherEnd, msgs); + case ApaPackage.AFUNCTION__OUTGOING: + return ((InternalEList)getOutgoing()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case ApaPackage.AFUNCTION__OWNING_BEHAVIOR: + return eInternalContainer().eInverseRemove(this, ApaPackage.ABEHAVIOR__FUNCTIONS, ABehavior.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ApaPackage.AFUNCTION__OWNING_BEHAVIOR: + return getOwningBehavior(); + case ApaPackage.AFUNCTION__INCOMING: + return getIncoming(); + case ApaPackage.AFUNCTION__OUTGOING: + return getOutgoing(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ApaPackage.AFUNCTION__OWNING_BEHAVIOR: + setOwningBehavior((ABehavior)newValue); + return; + case ApaPackage.AFUNCTION__INCOMING: + getIncoming().clear(); + getIncoming().addAll((Collection)newValue); + return; + case ApaPackage.AFUNCTION__OUTGOING: + getOutgoing().clear(); + getOutgoing().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ApaPackage.AFUNCTION__OWNING_BEHAVIOR: + setOwningBehavior((ABehavior)null); + return; + case ApaPackage.AFUNCTION__INCOMING: + getIncoming().clear(); + return; + case ApaPackage.AFUNCTION__OUTGOING: + getOutgoing().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ApaPackage.AFUNCTION__OWNING_BEHAVIOR: + return getOwningBehavior() != null; + case ApaPackage.AFUNCTION__INCOMING: + return incoming != null && !incoming.isEmpty(); + case ApaPackage.AFUNCTION__OUTGOING: + return outgoing != null && !outgoing.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //AFunctionImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ANamedElementImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ANamedElementImpl.java new file mode 100644 index 00000000..409b1a76 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ANamedElementImpl.java @@ -0,0 +1,227 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.emf.ecore.impl.MinimalEObjectImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * + * An implementation of the model object 'ANamed Element'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANamedElementImpl#getId Id}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANamedElementImpl#getName Name}
    • + *
    + * + * @generated + */ +public abstract class ANamedElementImpl extends MinimalEObjectImpl.Container implements ANamedElement { + /** + * The default value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected static final String ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getId() Id}' attribute. + * + * + * @see #getId() + * @generated + * @ordered + */ + protected String id = ID_EDEFAULT; + + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * + * + * @generated NOT + */ + protected ANamedElementImpl() { + super(); + id = EcoreUtil.generateUUID(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ApaPackage.Literals.ANAMED_ELEMENT; + } + + /** + * + * + * @generated + */ + public String getId() { + return id; + } + + /** + * + * + * @generated + */ + public void setId(String newId) { + String oldId = id; + id = newId; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.ANAMED_ELEMENT__ID, oldId, id)); + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.ANAMED_ELEMENT__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ApaPackage.ANAMED_ELEMENT__ID: + return getId(); + case ApaPackage.ANAMED_ELEMENT__NAME: + return getName(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ApaPackage.ANAMED_ELEMENT__ID: + setId((String)newValue); + return; + case ApaPackage.ANAMED_ELEMENT__NAME: + setName((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ApaPackage.ANAMED_ELEMENT__ID: + setId(ID_EDEFAULT); + return; + case ApaPackage.ANAMED_ELEMENT__NAME: + setName(NAME_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ApaPackage.ANAMED_ELEMENT__ID: + return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); + case ApaPackage.ANAMED_ELEMENT__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (id: "); + result.append(id); + result.append(", name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //ANamedElementImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ANodeImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ANodeImpl.java new file mode 100644 index 00000000..15479510 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ANodeImpl.java @@ -0,0 +1,249 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.InternalEList; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * + * An implementation of the model object 'ANode'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANodeImpl#getOwningScope Owning Scope}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.ANodeImpl#getBehaviors Behaviors}
    • + *
    + * + * @generated + */ +public class ANodeImpl extends ANamedElementImpl implements ANode { + /** + * The cached value of the '{@link #getBehaviors() Behaviors}' containment reference list. + * + * + * @see #getBehaviors() + * @generated + * @ordered + */ + protected EList behaviors; + + /** + * + * + * @generated + */ + protected ANodeImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ApaPackage.Literals.ANODE; + } + + /** + * + * + * @generated + */ + public AScope getOwningScope() { + if (eContainerFeatureID() != ApaPackage.ANODE__OWNING_SCOPE) return null; + return (AScope)eInternalContainer(); + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetOwningScope(AScope newOwningScope, NotificationChain msgs) { + msgs = eBasicSetContainer((InternalEObject)newOwningScope, ApaPackage.ANODE__OWNING_SCOPE, msgs); + return msgs; + } + + /** + * + * + * @generated + */ + public void setOwningScope(AScope newOwningScope) { + if (newOwningScope != eInternalContainer() || (eContainerFeatureID() != ApaPackage.ANODE__OWNING_SCOPE && newOwningScope != null)) { + if (EcoreUtil.isAncestor(this, newOwningScope)) + throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); + NotificationChain msgs = null; + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + if (newOwningScope != null) + msgs = ((InternalEObject)newOwningScope).eInverseAdd(this, ApaPackage.ASCOPE__NODES, AScope.class, msgs); + msgs = basicSetOwningScope(newOwningScope, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, ApaPackage.ANODE__OWNING_SCOPE, newOwningScope, newOwningScope)); + } + + /** + * + * + * @generated + */ + public EList getBehaviors() { + if (behaviors == null) { + behaviors = new EObjectContainmentWithInverseEList(ABehavior.class, this, ApaPackage.ANODE__BEHAVIORS, ApaPackage.ABEHAVIOR__OWNING_NODE); + } + return behaviors; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.ANODE__OWNING_SCOPE: + if (eInternalContainer() != null) + msgs = eBasicRemoveFromContainer(msgs); + return basicSetOwningScope((AScope)otherEnd, msgs); + case ApaPackage.ANODE__BEHAVIORS: + return ((InternalEList)(InternalEList)getBehaviors()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.ANODE__OWNING_SCOPE: + return basicSetOwningScope(null, msgs); + case ApaPackage.ANODE__BEHAVIORS: + return ((InternalEList)getBehaviors()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { + switch (eContainerFeatureID()) { + case ApaPackage.ANODE__OWNING_SCOPE: + return eInternalContainer().eInverseRemove(this, ApaPackage.ASCOPE__NODES, AScope.class, msgs); + } + return super.eBasicRemoveFromContainerFeature(msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ApaPackage.ANODE__OWNING_SCOPE: + return getOwningScope(); + case ApaPackage.ANODE__BEHAVIORS: + return getBehaviors(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ApaPackage.ANODE__OWNING_SCOPE: + setOwningScope((AScope)newValue); + return; + case ApaPackage.ANODE__BEHAVIORS: + getBehaviors().clear(); + getBehaviors().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ApaPackage.ANODE__OWNING_SCOPE: + setOwningScope((AScope)null); + return; + case ApaPackage.ANODE__BEHAVIORS: + getBehaviors().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ApaPackage.ANODE__OWNING_SCOPE: + return getOwningScope() != null; + case ApaPackage.ANODE__BEHAVIORS: + return behaviors != null && !behaviors.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //ANodeImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AScopeImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AScopeImpl.java new file mode 100644 index 00000000..586c7bfb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/AScopeImpl.java @@ -0,0 +1,211 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.EObjectContainmentWithInverseEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * + * An implementation of the model object 'AScope'. + * + *

    + * The following features are implemented: + *

    + *
      + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AScopeImpl#getNodes Nodes}
    • + *
    • {@link org.polarsys.capella.diffmerge.bridge.examples.apa.impl.AScopeImpl#getExchanges Exchanges}
    • + *
    + * + * @generated + */ +public class AScopeImpl extends ANamedElementImpl implements AScope { + /** + * The cached value of the '{@link #getNodes() Nodes}' containment reference list. + * + * + * @see #getNodes() + * @generated + * @ordered + */ + protected EList nodes; + + /** + * The cached value of the '{@link #getExchanges() Exchanges}' containment reference list. + * + * + * @see #getExchanges() + * @generated + * @ordered + */ + protected EList exchanges; + + /** + * + * + * @generated + */ + protected AScopeImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return ApaPackage.Literals.ASCOPE; + } + + /** + * + * + * @generated + */ + public EList getNodes() { + if (nodes == null) { + nodes = new EObjectContainmentWithInverseEList(ANode.class, this, ApaPackage.ASCOPE__NODES, ApaPackage.ANODE__OWNING_SCOPE); + } + return nodes; + } + + /** + * + * + * @generated + */ + public EList getExchanges() { + if (exchanges == null) { + exchanges = new EObjectContainmentWithInverseEList(AExchange.class, this, ApaPackage.ASCOPE__EXCHANGES, ApaPackage.AEXCHANGE__OWNING_SCOPE); + } + return exchanges; + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.ASCOPE__NODES: + return ((InternalEList)(InternalEList)getNodes()).basicAdd(otherEnd, msgs); + case ApaPackage.ASCOPE__EXCHANGES: + return ((InternalEList)(InternalEList)getExchanges()).basicAdd(otherEnd, msgs); + } + return super.eInverseAdd(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case ApaPackage.ASCOPE__NODES: + return ((InternalEList)getNodes()).basicRemove(otherEnd, msgs); + case ApaPackage.ASCOPE__EXCHANGES: + return ((InternalEList)getExchanges()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case ApaPackage.ASCOPE__NODES: + return getNodes(); + case ApaPackage.ASCOPE__EXCHANGES: + return getExchanges(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case ApaPackage.ASCOPE__NODES: + getNodes().clear(); + getNodes().addAll((Collection)newValue); + return; + case ApaPackage.ASCOPE__EXCHANGES: + getExchanges().clear(); + getExchanges().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case ApaPackage.ASCOPE__NODES: + getNodes().clear(); + return; + case ApaPackage.ASCOPE__EXCHANGES: + getExchanges().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case ApaPackage.ASCOPE__NODES: + return nodes != null && !nodes.isEmpty(); + case ApaPackage.ASCOPE__EXCHANGES: + return exchanges != null && !exchanges.isEmpty(); + } + return super.eIsSet(featureID); + } + +} //AScopeImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ApaFactoryImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ApaFactoryImpl.java new file mode 100644 index 00000000..0f17a902 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ApaFactoryImpl.java @@ -0,0 +1,147 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.polarsys.capella.diffmerge.bridge.examples.apa.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class ApaFactoryImpl extends EFactoryImpl implements ApaFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static ApaFactory init() { + try { + ApaFactory theApaFactory = (ApaFactory)EPackage.Registry.INSTANCE.getEFactory(ApaPackage.eNS_URI); + if (theApaFactory != null) { + return theApaFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new ApaFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public ApaFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case ApaPackage.ASCOPE: return createAScope(); + case ApaPackage.ANODE: return createANode(); + case ApaPackage.ABEHAVIOR: return createABehavior(); + case ApaPackage.AFUNCTION: return createAFunction(); + case ApaPackage.AEXCHANGE: return createAExchange(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public AScope createAScope() { + AScopeImpl aScope = new AScopeImpl(); + return aScope; + } + + /** + * + * + * @generated + */ + public ANode createANode() { + ANodeImpl aNode = new ANodeImpl(); + return aNode; + } + + /** + * + * + * @generated + */ + public ABehavior createABehavior() { + ABehaviorImpl aBehavior = new ABehaviorImpl(); + return aBehavior; + } + + /** + * + * + * @generated + */ + public AFunction createAFunction() { + AFunctionImpl aFunction = new AFunctionImpl(); + return aFunction; + } + + /** + * + * + * @generated + */ + public AExchange createAExchange() { + AExchangeImpl aExchange = new AExchangeImpl(); + return aExchange; + } + + /** + * + * + * @generated + */ + public ApaPackage getApaPackage() { + return (ApaPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static ApaPackage getPackage() { + return ApaPackage.eINSTANCE; + } + +} //ApaFactoryImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ApaPackageImpl.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ApaPackageImpl.java new file mode 100644 index 00000000..e3f4b32f --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/impl/ApaPackageImpl.java @@ -0,0 +1,439 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class ApaPackageImpl extends EPackageImpl implements ApaPackage { + /** + * + * + * @generated + */ + private EClass aNamedElementEClass = null; + + /** + * + * + * @generated + */ + private EClass aScopeEClass = null; + + /** + * + * + * @generated + */ + private EClass aNodeEClass = null; + + /** + * + * + * @generated + */ + private EClass aBehaviorEClass = null; + + /** + * + * + * @generated + */ + private EClass aFunctionEClass = null; + + /** + * + * + * @generated + */ + private EClass aExchangeEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

    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. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage#eNS_URI + * @see #init() + * @generated + */ + private ApaPackageImpl() { + super(eNS_URI, ApaFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

    This method is used to initialize {@link ApaPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static ApaPackage init() { + if (isInited) return (ApaPackage)EPackage.Registry.INSTANCE.getEPackage(ApaPackage.eNS_URI); + + // Obtain or create and register package + ApaPackageImpl theApaPackage = (ApaPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ApaPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ApaPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theApaPackage.createPackageContents(); + + // Initialize created meta-data + theApaPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theApaPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(ApaPackage.eNS_URI, theApaPackage); + return theApaPackage; + } + + /** + * + * + * @generated + */ + public EClass getANamedElement() { + return aNamedElementEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getANamedElement_Id() { + return (EAttribute)aNamedElementEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getANamedElement_Name() { + return (EAttribute)aNamedElementEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getAScope() { + return aScopeEClass; + } + + /** + * + * + * @generated + */ + public EReference getAScope_Nodes() { + return (EReference)aScopeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getAScope_Exchanges() { + return (EReference)aScopeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getANode() { + return aNodeEClass; + } + + /** + * + * + * @generated + */ + public EReference getANode_OwningScope() { + return (EReference)aNodeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getANode_Behaviors() { + return (EReference)aNodeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getABehavior() { + return aBehaviorEClass; + } + + /** + * + * + * @generated + */ + public EReference getABehavior_OwningNode() { + return (EReference)aBehaviorEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getABehavior_Functions() { + return (EReference)aBehaviorEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getAFunction() { + return aFunctionEClass; + } + + /** + * + * + * @generated + */ + public EReference getAFunction_OwningBehavior() { + return (EReference)aFunctionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getAFunction_Incoming() { + return (EReference)aFunctionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getAFunction_Outgoing() { + return (EReference)aFunctionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getAExchange() { + return aExchangeEClass; + } + + /** + * + * + * @generated + */ + public EReference getAExchange_OwningScope() { + return (EReference)aExchangeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getAExchange_Source() { + return (EReference)aExchangeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getAExchange_Target() { + return (EReference)aExchangeEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public ApaFactory getApaFactory() { + return (ApaFactory)getEFactoryInstance(); + } + + /** + * + * + * @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. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + aNamedElementEClass = createEClass(ANAMED_ELEMENT); + createEAttribute(aNamedElementEClass, ANAMED_ELEMENT__ID); + createEAttribute(aNamedElementEClass, ANAMED_ELEMENT__NAME); + + aScopeEClass = createEClass(ASCOPE); + createEReference(aScopeEClass, ASCOPE__NODES); + createEReference(aScopeEClass, ASCOPE__EXCHANGES); + + aNodeEClass = createEClass(ANODE); + createEReference(aNodeEClass, ANODE__OWNING_SCOPE); + createEReference(aNodeEClass, ANODE__BEHAVIORS); + + aBehaviorEClass = createEClass(ABEHAVIOR); + createEReference(aBehaviorEClass, ABEHAVIOR__OWNING_NODE); + createEReference(aBehaviorEClass, ABEHAVIOR__FUNCTIONS); + + aFunctionEClass = createEClass(AFUNCTION); + createEReference(aFunctionEClass, AFUNCTION__OWNING_BEHAVIOR); + createEReference(aFunctionEClass, AFUNCTION__INCOMING); + createEReference(aFunctionEClass, AFUNCTION__OUTGOING); + + aExchangeEClass = createEClass(AEXCHANGE); + createEReference(aExchangeEClass, AEXCHANGE__OWNING_SCOPE); + createEReference(aExchangeEClass, AEXCHANGE__SOURCE); + createEReference(aExchangeEClass, AEXCHANGE__TARGET); + } + + /** + * + * + * @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. + * + * + * @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 + aScopeEClass.getESuperTypes().add(this.getANamedElement()); + aNodeEClass.getESuperTypes().add(this.getANamedElement()); + aBehaviorEClass.getESuperTypes().add(this.getANamedElement()); + aFunctionEClass.getESuperTypes().add(this.getANamedElement()); + aExchangeEClass.getESuperTypes().add(this.getANamedElement()); + + // Initialize classes, features, and operations; add parameters + initEClass(aNamedElementEClass, ANamedElement.class, "ANamedElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getANamedElement_Id(), ecorePackage.getEString(), "id", null, 1, 1, ANamedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getANamedElement_Name(), ecorePackage.getEString(), "name", null, 1, 1, ANamedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(aScopeEClass, AScope.class, "AScope", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getAScope_Nodes(), this.getANode(), this.getANode_OwningScope(), "nodes", null, 0, -1, AScope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAScope_Exchanges(), this.getAExchange(), this.getAExchange_OwningScope(), "exchanges", null, 0, -1, AScope.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(aNodeEClass, ANode.class, "ANode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getANode_OwningScope(), this.getAScope(), this.getAScope_Nodes(), "owningScope", null, 1, 1, ANode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getANode_Behaviors(), this.getABehavior(), this.getABehavior_OwningNode(), "behaviors", null, 0, -1, ANode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(aBehaviorEClass, ABehavior.class, "ABehavior", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getABehavior_OwningNode(), this.getANode(), this.getANode_Behaviors(), "owningNode", null, 1, 1, ABehavior.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getABehavior_Functions(), this.getAFunction(), this.getAFunction_OwningBehavior(), "functions", null, 0, -1, ABehavior.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(aFunctionEClass, AFunction.class, "AFunction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getAFunction_OwningBehavior(), this.getABehavior(), this.getABehavior_Functions(), "owningBehavior", null, 1, 1, AFunction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAFunction_Incoming(), this.getAExchange(), this.getAExchange_Target(), "incoming", null, 0, -1, AFunction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAFunction_Outgoing(), this.getAExchange(), this.getAExchange_Source(), "outgoing", null, 0, -1, AFunction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(aExchangeEClass, AExchange.class, "AExchange", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getAExchange_OwningScope(), this.getAScope(), this.getAScope_Exchanges(), "owningScope", null, 1, 1, AExchange.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAExchange_Source(), this.getAFunction(), this.getAFunction_Outgoing(), "source", null, 1, 1, AExchange.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAExchange_Target(), this.getAFunction(), this.getAFunction_Incoming(), "target", null, 1, 1, AExchange.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); + } + +} //ApaPackageImpl diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/util/ApaAdapterFactory.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/util/ApaAdapterFactory.java new file mode 100644 index 00000000..8541909a --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/util/ApaAdapterFactory.java @@ -0,0 +1,217 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.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.polarsys.capella.diffmerge.bridge.examples.apa.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage + * @generated + */ +public class ApaAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static ApaPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public ApaAdapterFactory() { + if (modelPackage == null) { + modelPackage = ApaPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @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 createXXX methods. + * + * + * @generated + */ + protected ApaSwitch modelSwitch = + new ApaSwitch() { + @Override + public Adapter caseANamedElement(ANamedElement object) { + return createANamedElementAdapter(); + } + @Override + public Adapter caseAScope(AScope object) { + return createAScopeAdapter(); + } + @Override + public Adapter caseANode(ANode object) { + return createANodeAdapter(); + } + @Override + public Adapter caseABehavior(ABehavior object) { + return createABehaviorAdapter(); + } + @Override + public Adapter caseAFunction(AFunction object) { + return createAFunctionAdapter(); + } + @Override + public Adapter caseAExchange(AExchange object) { + return createAExchangeAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement ANamed Element}'. + * + * 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. + * + * @return the new adapter. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANamedElement + * @generated + */ + public Adapter createANamedElementAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AScope AScope}'. + * + * 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. + * + * @return the new adapter. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AScope + * @generated + */ + public Adapter createAScopeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ANode ANode}'. + * + * 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. + * + * @return the new adapter. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ANode + * @generated + */ + public Adapter createANodeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior ABehavior}'. + * + * 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. + * + * @return the new adapter. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior + * @generated + */ + public Adapter createABehaviorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction AFunction}'. + * + * 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. + * + * @return the new adapter. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction + * @generated + */ + public Adapter createAFunctionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange AExchange}'. + * + * 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. + * + * @return the new adapter. + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange + * @generated + */ + public Adapter createAExchangeAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //ApaAdapterFactory diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/util/ApaSwitch.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/util/ApaSwitch.java new file mode 100644 index 00000000..7fd684d4 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.gen/src/org/polarsys/capella/diffmerge/bridge/examples/apa/util/ApaSwitch.java @@ -0,0 +1,230 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.util; + +import java.util.List; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.polarsys.capella.diffmerge.bridge.examples.apa.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX 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. + * + * @see org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage + * @generated + */ +public class ApaSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static ApaPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public ApaSwitch() { + if (modelPackage == null) { + modelPackage = ApaPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @param 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 caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case ApaPackage.ANAMED_ELEMENT: { + ANamedElement aNamedElement = (ANamedElement)theEObject; + T result = caseANamedElement(aNamedElement); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ApaPackage.ASCOPE: { + AScope aScope = (AScope)theEObject; + T result = caseAScope(aScope); + if (result == null) result = caseANamedElement(aScope); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ApaPackage.ANODE: { + ANode aNode = (ANode)theEObject; + T result = caseANode(aNode); + if (result == null) result = caseANamedElement(aNode); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ApaPackage.ABEHAVIOR: { + ABehavior aBehavior = (ABehavior)theEObject; + T result = caseABehavior(aBehavior); + if (result == null) result = caseANamedElement(aBehavior); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ApaPackage.AFUNCTION: { + AFunction aFunction = (AFunction)theEObject; + T result = caseAFunction(aFunction); + if (result == null) result = caseANamedElement(aFunction); + if (result == null) result = defaultCase(theEObject); + return result; + } + case ApaPackage.AEXCHANGE: { + AExchange aExchange = (AExchange)theEObject; + T result = caseAExchange(aExchange); + if (result == null) result = caseANamedElement(aExchange); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'ANamed Element'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'ANamed Element'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseANamedElement(ANamedElement object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'AScope'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'AScope'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAScope(AScope object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'ANode'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'ANode'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseANode(ANode object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'ABehavior'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'ABehavior'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseABehavior(ABehavior object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'AFunction'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'AFunction'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAFunction(AFunction object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'AExchange'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'AExchange'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAExchange(AExchange object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //ApaSwitch diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.classpath b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.project b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.project new file mode 100644 index 00000000..f2ac81c5 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.examples.apa + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.settings/org.eclipse.jdt.core.prefs b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..7adc0fb9 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.settings/org.eclipse.pde.prefs b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000..2c24bcab --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/.settings/org.eclipse.pde.prefs @@ -0,0 +1,34 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=2 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=2 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=2 +compilers.p.missing-version-require-bundle=2 +compilers.p.no-required-att=0 +compilers.p.no.automatic.module=1 +compilers.p.not-externalized-att=2 +compilers.p.service.component.without.lazyactivation=1 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/META-INF/MANIFEST.MF b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/META-INF/MANIFEST.MF new file mode 100644 index 00000000..ef48342b --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Bridge APA Example +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.examples.apa;singleton:=true +Bundle-Version: 0.14.1.qualifier +Bundle-Activator: org.polarsys.capella.diffmerge.bridge.examples.apa.APAExampleActivator +Bundle-Vendor: www.polarsys.org +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.gef, + org.eclipse.gmf.runtime.notation, + org.eclipse.sirius, + org.polarsys.capella.core.data.gen;bundle-version="1.4.0", + org.polarsys.capella.diffmerge.bridge.examples.apa.gen, + org.eclipse.emf.diffmerge.bridge.interactive, + org.eclipse.emf.diffmerge.bridge.mapping +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-ActivationPolicy: lazy +Automatic-Module-Name: org.polarsys.capella.diffmerge.bridge.examples.apa diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/about.html b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

    About This Content

    + +

    August 17, 2018

    +

    License

    +

    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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

    +

    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 http://www.eclipse.org.

    + + \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/build.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/build.properties new file mode 100644 index 00000000..786b1df9 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/plugin.xml b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/plugin.xml new file mode 100644 index 00000000..e23fe5fe --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/plugin.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/APAExampleActivator.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/APAExampleActivator.java new file mode 100644 index 00000000..d3b60cf6 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/APAExampleActivator.java @@ -0,0 +1,73 @@ +/********************************************************************* + * Copyright (c) 2014-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class APAExampleActivator extends AbstractUIPlugin { + + /** The shared instance */ + private static APAExampleActivator plugin; + + + /** + * The constructor + */ + public APAExampleActivator() { + } + + /** + * Returns the shared instance + */ + public static APAExampleActivator getDefault() { + return plugin; + } + + /** + * Return a default GUI label + * @return a non-null string + */ + public String getLabel() { + return Messages.APAExampleActivator_Label; + } + + /** + * Return the ID of this plug-in according to MANIFEST.MF + * @return a non-null string + */ + public String getPluginId() { + return getBundle().getSymbolicName(); + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/Messages.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/Messages.java new file mode 100644 index 00000000..cba13e60 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/Messages.java @@ -0,0 +1,30 @@ +/********************************************************************* + * Copyright (c) 2014-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa; + +import org.eclipse.osgi.util.NLS; + +@SuppressWarnings("javadoc") +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.polarsys.capella.diffmerge.bridge.examples.apa.messages"; //$NON-NLS-1$ + public static String APABridgeAction_IncorrectSelection; + public static String APABridgeJob_Log; + public static String APABridgeJob_Name; + public static String APAExampleActivator_Label; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/actions/APABridgeAction.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/actions/APABridgeAction.java new file mode 100644 index 00000000..feeb4f26 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/actions/APABridgeAction.java @@ -0,0 +1,119 @@ +/********************************************************************* + * Copyright (c) 2014-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.actions; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; +import org.polarsys.capella.core.data.pa.PhysicalArchitecture; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalComponentPkg; +import org.polarsys.capella.diffmerge.bridge.examples.apa.APAExampleActivator; +import org.polarsys.capella.diffmerge.bridge.examples.apa.Messages; +import org.polarsys.capella.diffmerge.bridge.examples.apa.operations.APABridgeJob; + + +/** + * An action for running the Capella2Apa operation from the GUI. + * @author Olivier Constant + */ +public class APABridgeAction implements IObjectActionDelegate { + + /** The current, potentially null selection */ + private IStructuredSelection _selection; + + /** The current, potentially null workbench part where the action is being used */ + private IWorkbenchPart _workbenchPart; + + + /** + * Constructor + */ + public APABridgeAction() { + _selection = null; + _workbenchPart = null; + } + + /** + * Return the context element for the current selection, if any. + * The context element is the one on which the action is applicable. + * @return a potentially null object + */ + protected PhysicalArchitecture getContext() { + PhysicalArchitecture result = null; + if (_selection != null && !_selection.isEmpty()) { + Object selected = _selection.getFirstElement(); + if (selected instanceof EditPart) + selected = ((EditPart)selected).getModel(); + if (selected instanceof View) + selected = ((View)selected).getElement(); + if (selected instanceof DSemanticDecorator) + selected = ((DSemanticDecorator)selected).getTarget(); + if (selected instanceof PhysicalComponent) + while (selected instanceof PhysicalComponent) + selected = ((PhysicalComponent)selected).eContainer(); + if (selected instanceof PhysicalComponentPkg) + selected = ((EObject) selected).eContainer(); + if (selected instanceof PhysicalArchitecture) + result = (PhysicalArchitecture)selected; + } + return result; + } + + /** + * Return whether the action is applicable given the current context + */ + protected boolean isApplicable() { + return _selection != null && !_selection.isEmpty() && _workbenchPart != null; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + public void run(IAction action_p) { + PhysicalArchitecture context = getContext(); + if (context != null) { + new APABridgeJob(context).schedule(); + } else { + MessageDialog.openError( + _workbenchPart.getSite().getShell(), + APAExampleActivator.getDefault().getLabel(), + Messages.APABridgeAction_IncorrectSelection); + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IAction action_p, ISelection selection_p) { + if (selection_p instanceof IStructuredSelection) + _selection = (IStructuredSelection)selection_p; + else + _selection = null; + action_p.setEnabled(isApplicable()); + } + + /** + * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) + */ + public void setActivePart(IAction action_p, IWorkbenchPart targetPart_p) { + _workbenchPart = targetPart_p; + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/messages.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/messages.properties new file mode 100644 index 00000000..3937b5d3 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/messages.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +APABridgeAction_IncorrectSelection=Incorrect selection. +APABridgeJob_Log=Log bridge execution? +APABridgeJob_Name=Capella2APA +APAExampleActivator_Label=APA Bridge Example diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/operations/APABridgeJob.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/operations/APABridgeJob.java new file mode 100644 index 00000000..9cf546b1 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa/src/org/polarsys/capella/diffmerge/bridge/examples/apa/operations/APABridgeJob.java @@ -0,0 +1,302 @@ +/********************************************************************* + * Copyright (c) 2014-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.operations; + +import java.util.Collection; +import java.util.List; + +import org.apache.log4j.Level; +import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; +import org.eclipse.emf.diffmerge.bridge.api.IBridge; +import org.eclipse.emf.diffmerge.bridge.impl.AbstractBridge; +import org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob; +import org.eclipse.emf.diffmerge.bridge.interactive.EMFInteractiveBridge; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.CommonRule; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Query; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Rule; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.emf.EMFMappingBridge; +import org.eclipse.emf.diffmerge.impl.policies.ConfigurableDiffPolicy; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.polarsys.capella.core.data.capellacore.Type; +import org.polarsys.capella.core.data.cs.DeployableElement; +import org.polarsys.capella.core.data.cs.Part; +import org.polarsys.capella.core.data.fa.AbstractFunction; +import org.polarsys.capella.core.data.fa.ComponentFunctionalAllocation; +import org.polarsys.capella.core.data.fa.FunctionalExchange; +import org.polarsys.capella.core.data.pa.PhysicalArchitecture; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalComponentNature; +import org.polarsys.capella.core.data.pa.deployment.PartDeploymentLink; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; +import org.polarsys.capella.diffmerge.bridge.examples.apa.Messages; + + +/** + * A job that turns certain types of Capella physical architectures into models of a simplified metamodel. + * @author Olivier Constant + */ +public class APABridgeJob extends BridgeJob { + + /** + * Constructor + * @param context_p a non-null physical architecture + */ + public APABridgeJob(PhysicalArchitecture context_p) { + super(Messages.APABridgeJob_Name, context_p, + context_p.eResource().getURI().trimFileExtension().appendFileExtension(ApaPackage.eNAME)); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob#getBridge() + */ + @Override + protected EMFInteractiveBridge getBridge() { + // Bridge + final int PAUSE = getPauseDuration(); + pause(PAUSE); + final EMFMappingBridge mapping = + new EMFMappingBridge(); + //******** QUERIES ******** + // Main component query + final Query mainPCQuery = + new Query(mapping) { + public Iterable evaluate( + PhysicalArchitecture source_p, IQueryExecution environment_p) { + pause(PAUSE); + return newIterable((PhysicalComponent)source_p.getSystem()); + } + }; + // Nodes query + final IQuery nodesQuery = + new Query(mainPCQuery) { + public Iterable evaluate( + PhysicalComponent source_p, IQueryExecution environment_p) { + pause(PAUSE); + Collection result = newIterable(); + for (Part partition : source_p.getContainedParts()) { + Type type = partition.getType(); + if (type instanceof PhysicalComponent && + ((PhysicalComponent)type).getNature() == + PhysicalComponentNature.NODE) + result.add(partition); + } + return result; + } + }; + // Deployments query + final IQuery deploymentsQuery = + new Query(nodesQuery) { + @SuppressWarnings({ "unchecked", "rawtypes" }) + public Iterable evaluate( + Part source_p, IQueryExecution environment_p) { + pause(PAUSE); + return ((Collection)source_p.getOwnedDeploymentLinks()); + } + }; + // Allocated Functions query + final IQuery allocationsQuery = + new Query(deploymentsQuery) { + public Iterable evaluate( + PartDeploymentLink source_p, IQueryExecution environment_p) { + pause(PAUSE); + List result = newIterable(); + DeployableElement deployed = source_p.getDeployedElement(); + if (deployed instanceof Part) { + Type type = ((Part)deployed).getType(); + if (type instanceof PhysicalComponent) { + for (ComponentFunctionalAllocation allocation : + ((PhysicalComponent)type).getOwnedFunctionalAllocation()) { + result.add(allocation.getFunction()); + } + } + } + return result; + } + }; + // Functional Exchanges query + final IQuery exchangesQuery = + new Query(allocationsQuery) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + public Iterable evaluate( + AbstractFunction source_p, IQueryExecution environment_p) { + pause(PAUSE); + return (Collection)source_p.getOutgoing(); + } + }; + //******** RULES ******** + // Rule: main PhysicalComponent -> AScope + final Rule mainRule = + new Rule(mainPCQuery, "PC2AScope") { //$NON-NLS-1$ + public void defineTarget(PhysicalComponent source_p, + AScope target_p, IQueryExecution queryEnv_p, + IMappingExecution ruleEnv_p) { + pause(PAUSE); + // Attachment to target scope + ((IEditableModelScope)ruleEnv_p.getTargetDataSet()).add(target_p); + // Name + target_p.setName(source_p.getName()); + } + public AScope createTarget(PhysicalComponent source_p, IQueryExecution queryExecution_p) { + return ApaFactory.eINSTANCE.createAScope(); + } + }; + // Rule: Node Part -> ANode + final Rule nodeRule = new Rule(nodesQuery, "Part2ANode") { //$NON-NLS-1$ + public void defineTarget(Part source_p, + ANode target_p, IQueryExecution queryEnv_p, + IMappingExecution ruleEnv_p) { + pause(PAUSE); + // Name + target_p.setName(source_p.getName()); + // Container + AScope container = ruleEnv_p.get( + (PhysicalComponent)source_p.eContainer(), mainRule); + target_p.setOwningScope(container); + } + public ANode createTarget(Part source_p, IQueryExecution queryExecution_p) { + return ApaFactory.eINSTANCE.createANode(); + } + }; + // Rule: Behavior PartDeploymentLink -> ABehavior, trace on the deployed PhysicalComponent + final CommonRule behaviorRule = + new CommonRule( + deploymentsQuery, "DeploymentLink2ABehavior") { //$NON-NLS-1$ + public void defineTarget(PartDeploymentLink source_p, + ABehavior target_p, IQueryExecution queryEnv_p, + IMappingExecution ruleEnv_p) { + pause(PAUSE); + // Name + PhysicalComponent tracedSource = traceSource(source_p); + target_p.setName(tracedSource.getName()); + // Container + Part part = queryEnv_p.get(nodesQuery); + ANode container = ruleEnv_p.get(part, nodeRule); + target_p.setOwningNode(container); + } + public PhysicalComponent traceSource(PartDeploymentLink source_p) { + return (PhysicalComponent)((Part)source_p.getDeployedElement()).getType(); + } + public ABehavior createTarget(PartDeploymentLink source_p, IQueryExecution queryExecution_p) { + return ApaFactory.eINSTANCE.createABehavior(); + } + }; + // Rule: AbstractFunction -> AFunction + final Rule functionRule = + new Rule(allocationsQuery, "Function2AFunction") { //$NON-NLS-1$ + public void defineTarget(AbstractFunction source_p, + AFunction target_p, IQueryExecution queryEnv_p, + IMappingExecution ruleEnv_p) { + pause(PAUSE); + // Name + target_p.setName(source_p.getName()); + // Container + PartDeploymentLink dLink = queryEnv_p.get(deploymentsQuery); + ABehavior container = ruleEnv_p.get(behaviorRule.traceSource(dLink), behaviorRule); + target_p.setOwningBehavior(container); + } + public AFunction createTarget(AbstractFunction source_p, IQueryExecution queryExecution_p) { + return ApaFactory.eINSTANCE.createAFunction(); + } + }; + // Rule: FunctionalExchange -> AExchange + new Rule(exchangesQuery, "Exchange2AExchange") { //$NON-NLS-1$ + public void defineTarget(FunctionalExchange source_p, + AExchange target_p, IQueryExecution queryEnv_p, + IMappingExecution ruleEnv_p) { + pause(PAUSE); + // Name + target_p.setName(source_p.getName()); + // Container + PhysicalComponent mainComponent = queryEnv_p.get(mainPCQuery); + AScope container = ruleEnv_p.get(mainComponent, mainRule); + target_p.setOwningScope(container); + // Source + EObject sourceNode = source_p.getSource().eContainer(); + AFunction sourceAFunction = ruleEnv_p.get((AbstractFunction)sourceNode, functionRule); + if (sourceAFunction != null) + target_p.setSource(sourceAFunction); + // Target + EObject targetNode = source_p.getTarget().eContainer(); + AFunction targetAFunction = ruleEnv_p.get((AbstractFunction)targetNode, functionRule); + if (targetAFunction != null) + target_p.setTarget(targetAFunction); + } + public AExchange createTarget(FunctionalExchange source_p, IQueryExecution queryExecution_p) { + return ApaFactory.eINSTANCE.createAExchange(); + } + }; + ConfigurableDiffPolicy diffPolicy = new ConfigurableDiffPolicy(); + diffPolicy.setIgnoreOrders(true); + EMFInteractiveBridge result = + new EMFInteractiveBridge( + mapping, diffPolicy, null, null); + setupLog(result); + return result; + } + + /** + * Return the duration for pauses + * @return a positive int or 0 + */ + protected int getPauseDuration() { + return 0; + } + + /** + * Pause for the given duration, for testing purposes + * @param duration_p a positive int + */ + protected void pause(int duration_p) { + try { + Thread.sleep(duration_p); + } catch (InterruptedException e) { + // Proceed + } + } + + /** + * Set up the log system of the given bridge if applicable + * @param bridge_p a non-null bridge + */ + protected void setupLog(IBridge bridge_p) { + if (bridge_p instanceof AbstractBridge) { + AbstractBridge bridge = (AbstractBridge)bridge_p; + final boolean[] isLog = new boolean[1]; + Display.getDefault().syncExec(new Runnable() { + /** + * @see java.lang.Runnable#run() + */ + public void run() { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + isLog[0] = MessageDialog.openQuestion( + shell, Messages.APABridgeJob_Name, Messages.APABridgeJob_Log); + } + }); + Level logLevel = isLog[0]? Level.DEBUG: Level.OFF; + bridge.getLogger().setLevel(logLevel); + } + } + +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.classpath b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.project b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.project new file mode 100644 index 00000000..77d0db7f --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.examples.apa2capella + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.settings/org.eclipse.jdt.core.prefs b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..7adc0fb9 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/META-INF/MANIFEST.MF b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/META-INF/MANIFEST.MF new file mode 100644 index 00000000..e820ca1d --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.examples.apa2capella;singleton:=true +Bundle-Version: 0.8.0.qualifier +Bundle-Activator: org.polarsys.capella.diffmerge.bridge.examples.apa2capella.internal.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.emf.ecore, + org.polarsys.capella.common.ef, + org.polarsys.capella.core.data.gen;bundle-version="1.4.0", + org.polarsys.capella.core.model.handler;bundle-version="1.4.0", + org.polarsys.capella.core.compare;bundle-version="1.4.0", + org.eclipse.emf.diffmerge.bridge, + org.eclipse.emf.diffmerge.bridge.interactive, + org.eclipse.emf.diffmerge.bridge.mapping, + org.polarsys.capella.diffmerge.bridge.examples.apa.gen, + org.polarsys.capella.diffmerge.bridge.integration +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-ActivationPolicy: lazy +Export-Package: org.polarsys.capella.diffmerge.bridge.examples.apa2capella, + org.polarsys.capella.diffmerge.bridge.examples.apa2capella.util +Bundle-Vendor: %providerName +Automatic-Module-Name: org.polarsys.capella.diffmerge.bridge.examples.apa2capella diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/about.html b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

    About This Content

    + +

    August 17, 2018

    +

    License

    +

    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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

    +

    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 http://www.eclipse.org.

    + + \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/build.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/build.properties new file mode 100644 index 00000000..86df376e --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/build.properties @@ -0,0 +1,15 @@ +############################################################################### +# Copyright (c) 2015-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html,\ + plugin.properties diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/plugin.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/plugin.properties new file mode 100644 index 00000000..df9aecfd --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/plugin.properties @@ -0,0 +1,10 @@ +############################################################################### +# Copyright (c) 2015-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +pluginName = APA-to-Capella Bridge Example +providerName = www.polarsys.org diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/plugin.xml b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/plugin.xml new file mode 100644 index 00000000..a6541679 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/plugin.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridge.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridge.java new file mode 100644 index 00000000..dc477bfe --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridge.java @@ -0,0 +1,60 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella; + +import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.emf.EMFMappingBridge; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries.ABehaviorQuery; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries.AExchangeQuery; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries.AFunctionQuery; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries.ANodeQuery; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries.AScopeQuery; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules.ABehaviour2PhysicalComponentRule; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules.AExchange2FunctionalExchangeRule; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules.AFunction2PhysicalFunctionRule; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules.ANode2PhysicalComponentRule; + +/** + * The APA to Capella transformation bridge. + * + * @author Amine Lajmi + * + */ +public class Apa2CapellaBridge extends EMFMappingBridge { + + /** + * Default constructor. + */ + @SuppressWarnings("unused") + public Apa2CapellaBridge() { + + // AScope -> PhysicalSystem (PhysicalComponent | nature = UNSET) + AScopeQuery scopeQuery = new AScopeQuery(this); + + // ANode -> PhysicalComponent (PhysicalComponent | nature = NODE) + ANodeQuery nodeQuery = new ANodeQuery(scopeQuery); + ANode2PhysicalComponentRule nodeRule = new ANode2PhysicalComponentRule(nodeQuery); + + // ABehavior -> PhysicalComponent (PhysicalComponent | nature = BEHAVIOR) + ABehaviorQuery behaviorQuery = new ABehaviorQuery(nodeQuery); + ABehaviour2PhysicalComponentRule behaviorRule = new ABehaviour2PhysicalComponentRule(behaviorQuery); + + // AFunction -> PhysicalFunction + AFunctionQuery functionQuery = new AFunctionQuery(behaviorQuery); + AFunction2PhysicalFunctionRule functionRule = new AFunction2PhysicalFunctionRule(functionQuery); + + // AExchange -> FunctionalExchange + AExchangeQuery exchangeQuery = new AExchangeQuery(scopeQuery); + AExchange2FunctionalExchangeRule exchangeRule = new AExchange2FunctionalExchangeRule(exchangeQuery); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridgeHandler.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridgeHandler.java new file mode 100644 index 00000000..b030a5d0 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridgeHandler.java @@ -0,0 +1,111 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; +import org.polarsys.capella.common.ef.ExecutionManager; +import org.polarsys.capella.common.ef.ExecutionManagerRegistry; +import org.polarsys.capella.core.model.handler.command.CapellaResourceHelper; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.messages.Messages; + +/** + * The incremental bridge command handler. This command handler is invoked when + * the user right clicks from the Project Explorer on an APA model and selects + * APA-to-Capella Bridge from the contextual menu. An APA model is a resource + * with the extension "apa". + * + * @author Amine Lajmi + * + */ +public class Apa2CapellaBridgeHandler extends AbstractHandler { + + /** + * + * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event_p) throws ExecutionException { + IFile file = unwrap(event_p, IFile.class); + if (file != null) { + IPath sourcePath = file.getFullPath(); + + // load source resource + ExecutionManager manager = ExecutionManagerRegistry.getInstance().addNewManager(); + TransactionalEditingDomain domain = manager.getEditingDomain(); + ResourceSet resourceSet = domain.getResourceSet(); + URI sourceURI = URI.createPlatformResourceURI(sourcePath.toString(), false); + Resource resource = resourceSet.getResource(sourceURI, true); + + AScope context = (AScope) resource.getContents().get(0); + if (context != null) { + IPath targetPath = sourcePath.removeFileExtension().addFileExtension(CapellaResourceHelper.CAPELLA_MODEL_FILE_EXTENSION); + if (EcorePlugin.getWorkspaceRoot().exists(targetPath)) { + IPath rootLocationPath = EcorePlugin.getWorkspaceRoot().getLocation(); + IPath workspaceRelativePath = targetPath.makeRelativeTo(rootLocationPath); + URI targetURI = URI.createPlatformResourceURI(workspaceRelativePath.toString(), false); + Apa2CapellaBridgeJob apa2CapellaBridgeJob = new Apa2CapellaBridgeJob(context, targetURI); + apa2CapellaBridgeJob.schedule(); + } else { + Display display = Display.getCurrent(); + if (display!=null) { + Shell shell = display.getActiveShell(); + MessageDialog.openError(shell, Messages.Apa2CapellaBridgeCommandHandler_BridgeDialogTitle, Messages.Apa2CapellaBridgeCommandHandler_TargetResourceNotFound); + } + } + } else { + throw new ExecutionException( + Messages.Apa2CapellaBridgeCommandHandler_ExecutionContextNotFound); + } + } + return null; + } + + /** + * Unwraps the object given the type given as input + * + * @param the return type + * @param object_p (non-null) the object to unwrap + * @param type_p (non-null) the type to cast + * @return the (possibly null) unwrapped object + */ + T unwrap(Object object_p, Class type_p) { + Object current = object_p; + if (current instanceof ExecutionEvent) { + current = HandlerUtil.getCurrentSelection((ExecutionEvent) current); + } + if (current instanceof IStructuredSelection) { + current = ((IStructuredSelection) current).getFirstElement(); + } + if (current instanceof IAdaptable) { + current = ((IAdaptable) current).getAdapter(type_p); + } + if (type_p.isInstance(current)) { + return type_p.cast(current); + } + return null; + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridgeJob.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridgeJob.java new file mode 100644 index 00000000..5a71148f --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/Apa2CapellaBridgeJob.java @@ -0,0 +1,46 @@ +/********************************************************************* + * Copyright (c) 2014-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingBridge; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa2capella.messages.Messages; +import org.polarsys.capella.diffmerge.bridge.integration.CapellaBridgeJob; + +/** + * A specialized bridge job for the APA to Capella incremental transformation. + * + * @author Amine Lajmi + * + */ +public class Apa2CapellaBridgeJob extends CapellaBridgeJob { + + /** + * Constructor with explicit target uri + * + * @param context_p the (non-null) source model scope + * @param targetURI_p the (non-null) target uri + */ + public Apa2CapellaBridgeJob(AScope context_p, URI targetURI_p) { + super(Messages.Apa2CapellaBridgeJob_JobLabel, context_p, targetURI_p); + } + + /** + * @see org.polarsys.capella.diffmerge.bridge.integration.CapellaBridgeJob#createMappingBridge() + */ + @Override + protected IMappingBridge createMappingBridge() { + return new Apa2CapellaBridge(); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/IApa2CapellaBridgeConstants.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/IApa2CapellaBridgeConstants.java new file mode 100644 index 00000000..dd66d3a4 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/IApa2CapellaBridgeConstants.java @@ -0,0 +1,25 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella; + +/** + * The APA-to-Capella bridge constants definitions + * + * @author Amine Lajmi + * + */ +public interface IApa2CapellaBridgeConstants { + /** + * The bridge job name. + */ + public static final String APA_BRIDGE_JOB_NAME = "APA-to-Capella Bridge Job"; //$NON-NLS-1$ +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/internal/Activator.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/internal/Activator.java new file mode 100644 index 00000000..046e9c4f --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/internal/Activator.java @@ -0,0 +1,64 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.internal; + +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.emf.diffmerge.bridge.examples.apa2capella"; //$NON-NLS-1$ + + /** + * The shared instance + */ + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/messages/Messages.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/messages/Messages.java new file mode 100644 index 00000000..2c4dbed3 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/messages/Messages.java @@ -0,0 +1,32 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.messages; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.emf.diffmerge.bridge.examples.apa2capella.messages.messages"; //$NON-NLS-1$ + + public static String Apa2CapellaBridgeCommandHandler_BridgeDialogTitle; + public static String Apa2CapellaBridgeCommandHandler_ExecutionContextNotFound; + public static String Apa2CapellaBridgeCommandHandler_TargetResourceNotFound; + public static String Apa2CapellaBridgeJob_JobLabel; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/messages/messages.properties b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/messages/messages.properties new file mode 100644 index 00000000..91e7664d --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/messages/messages.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2015-2019 Thales Global Services S.A.S and others. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +Apa2CapellaBridgeCommandHandler_BridgeDialogTitle=APA-to-Capella Bridge +Apa2CapellaBridgeCommandHandler_ExecutionContextNotFound=Could not retrieve the execution context +Apa2CapellaBridgeCommandHandler_TargetResourceNotFound=The target resource cannot be found. The assumption is: the source and target files should have the same name excluding the file extension. +Apa2CapellaBridgeJob_JobLabel=APA-to-Capella Bridge Job \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/ABehaviorQuery.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/ABehaviorQuery.java new file mode 100644 index 00000000..8bd044e9 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/ABehaviorQuery.java @@ -0,0 +1,40 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryHolder; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Query; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; + + +/** + * @author Amine Lajmi + * + */ +public class ABehaviorQuery extends Query{ + + /** + * @param parent_p (non-null) + */ + public ABehaviorQuery(IQueryHolder parent_p) { + super(parent_p); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery#evaluate(java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Iterable evaluate(ANode input_p, IQueryExecution environment_p) { + return input_p.getBehaviors(); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AExchangeQuery.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AExchangeQuery.java new file mode 100644 index 00000000..2e03e207 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AExchangeQuery.java @@ -0,0 +1,40 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryHolder; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Query; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; + + +/** + * @author Amine Lajmi + * + */ +public class AExchangeQuery extends Query{ + + /** + * @param parent_p (non-null) + */ + public AExchangeQuery(IQueryHolder parent_p) { + super(parent_p); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery#evaluate(java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Iterable evaluate(AScope input_p, IQueryExecution environment_p) { + return input_p.getExchanges(); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AFunctionQuery.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AFunctionQuery.java new file mode 100644 index 00000000..6fa3dddc --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AFunctionQuery.java @@ -0,0 +1,41 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryHolder; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Query; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; + + +/** + * @author Amine Lajmi + * + */ +public class AFunctionQuery extends Query{ + + /** + * @param parent_p (non-null) + */ + public AFunctionQuery(IQueryHolder parent_p) { + super(parent_p); + } + + /** + * + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery#evaluate(java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Iterable evaluate(ABehavior input_p, IQueryExecution environment_p) { + return input_p.getFunctions(); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/ANodeQuery.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/ANodeQuery.java new file mode 100644 index 00000000..1a5f13bb --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/ANodeQuery.java @@ -0,0 +1,40 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryHolder; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Query; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; + + +/** + * @author Amine Lajmi + * + */ +public class ANodeQuery extends Query { + + /** + * @param parent_p (non-null) + */ + public ANodeQuery(IQueryHolder parent_p) { + super(parent_p); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery#evaluate(java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Iterable evaluate(AScope input_p, IQueryExecution environment_p) { + return input_p.getNodes(); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AScopeQuery.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AScopeQuery.java new file mode 100644 index 00000000..9b2c90d3 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/queries/AScopeQuery.java @@ -0,0 +1,39 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.queries; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryHolder; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Query; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; + + +/** + * @author Amine Lajmi + * + */ +public class AScopeQuery extends Query{ + + /** + * @param parent_p (non-null) + */ + public AScopeQuery(IQueryHolder parent_p) { + super(parent_p); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery#evaluate(java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Iterable evaluate(AScope input_p, IQueryExecution environment_p) { + return newIterable(input_p); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/ABehaviour2PhysicalComponentRule.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/ABehaviour2PhysicalComponentRule.java new file mode 100644 index 00000000..d426fbcf --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/ABehaviour2PhysicalComponentRule.java @@ -0,0 +1,105 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Rule; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.RuleIdentifier; +import org.eclipse.emf.diffmerge.bridge.util.structures.Tuple2; +import org.eclipse.emf.diffmerge.bridge.util.structures.Tuple3; +import org.polarsys.capella.core.data.cs.CsFactory; +import org.polarsys.capella.core.data.cs.Part; +import org.polarsys.capella.core.data.information.AggregationKind; +import org.polarsys.capella.core.data.pa.PaFactory; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalComponentNature; +import org.polarsys.capella.core.data.pa.deployment.DeploymentFactory; +import org.polarsys.capella.core.data.pa.deployment.PartDeploymentLink; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.integration.scopes.CapellaUpdateScope; +import org.polarsys.capella.diffmerge.bridge.integration.util.CapellaUtil; + +/** + * @author Amine Lajmi + * + */ +public class ABehaviour2PhysicalComponentRule extends Rule> { + + /** + * The rule identifier + */ + public static final RuleIdentifier> ID = new RuleIdentifier>( + "ABehaviour2PhysicalComponentRule"); //$NON-NLS-1$ + + /** + * @param provider_p (non-null) + */ + public ABehaviour2PhysicalComponentRule(IQuery provider_p) { + super(provider_p, ID); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#createTarget(java.lang.Object, + * org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Tuple3 createTarget(ABehavior source_p, + IQueryExecution queryExecution_p) { + PhysicalComponent pc = PaFactory.eINSTANCE.createPhysicalComponent(); + Part pt = CsFactory.eINSTANCE.createPart(); + PartDeploymentLink dl = DeploymentFactory.eINSTANCE.createPartDeploymentLink(); + + // workaround to force Capella id creation + pc.getId(); + pt.getId(); + dl.getId(); + return new Tuple3(pc, pt, dl); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#defineTarget(java.lang.Object, java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution, org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution) + */ + public void defineTarget(final ABehavior source_p, + final Tuple3 target_p, IQueryExecution queryExecution_p, + IMappingExecution mappingExecution_p) { + + // The parent + final Tuple2 parent = mappingExecution_p.get((ANode) source_p.eContainer(), + ANode2PhysicalComponentRule.ID); + + // Physical Component + PhysicalComponent behaviourComponent = target_p.get1(); + behaviourComponent.setName(source_p.getName()); + behaviourComponent.setNature(PhysicalComponentNature.BEHAVIOR); + + // Part + Part behaviourPart = target_p.get2(); + behaviourPart.setName(source_p.getName()); + behaviourPart.setAggregationKind(AggregationKind.UNSET); + behaviourPart.setAbstractType(behaviourComponent); + + // Deployment link + Part parentPart = parent.get2(); + PartDeploymentLink deploymentLink = target_p.get3(); + deploymentLink.setLocation(parentPart); + deploymentLink.setDeployedElement(behaviourPart); + parentPart.getOwnedDeploymentLinks().add(deploymentLink); + + // Storage + CapellaUpdateScope targetScope = mappingExecution_p.getTargetDataSet(); + PhysicalComponent rootPhysicalSystem = CapellaUtil.getPhysicalSystemRoot(targetScope.getProject()); + rootPhysicalSystem.getOwnedPhysicalComponents().add(behaviourComponent); + rootPhysicalSystem.getOwnedFeatures().add(behaviourPart); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/AExchange2FunctionalExchangeRule.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/AExchange2FunctionalExchangeRule.java new file mode 100644 index 00000000..22edfbdf --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/AExchange2FunctionalExchangeRule.java @@ -0,0 +1,104 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Rule; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.RuleIdentifier; +import org.eclipse.emf.diffmerge.bridge.util.structures.Tuple2; +import org.eclipse.emf.diffmerge.bridge.util.structures.Tuple3; +import org.polarsys.capella.core.data.capellamodeller.Project; +import org.polarsys.capella.core.data.fa.ComponentFunctionalAllocation; +import org.polarsys.capella.core.data.fa.FaFactory; +import org.polarsys.capella.core.data.fa.FunctionInputPort; +import org.polarsys.capella.core.data.fa.FunctionOutputPort; +import org.polarsys.capella.core.data.fa.FunctionalExchange; +import org.polarsys.capella.core.data.pa.PhysicalFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.integration.scopes.CapellaUpdateScope; +import org.polarsys.capella.diffmerge.bridge.integration.util.CapellaUtil; +/** + * @author Amine Lajmi + * + */ +public class AExchange2FunctionalExchangeRule +extends Rule> { + + /** + * The rule identifier + */ + public static final RuleIdentifier> ID = new RuleIdentifier>( + "AExchange2FunctionalExchangeRule"); //$NON-NLS-1$ + + /** + * @param provider_p (non-null) + */ + public AExchange2FunctionalExchangeRule(IQuery provider_p) { + super(provider_p, ID); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#createTarget(java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Tuple3 createTarget(AExchange source_p, IQueryExecution queryExecution_p) { + FunctionalExchange functionalExchange = FaFactory.eINSTANCE.createFunctionalExchange(); + FunctionInputPort inputPort = FaFactory.eINSTANCE.createFunctionInputPort(); + FunctionOutputPort outputPort = FaFactory.eINSTANCE.createFunctionOutputPort(); + //workaround to force Capella Id creation + functionalExchange.getId(); + inputPort.getId(); + outputPort.getId(); + return new Tuple3(functionalExchange, inputPort, outputPort); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#defineTarget(java.lang.Object, java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution, org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution) + */ + public void defineTarget(final AExchange source_p, final Tuple3 target_p, IQueryExecution queryExecution_p, IMappingExecution mappingExecution_p) { + + //source function + AFunction sourceFunction = source_p.getSource(); + + //target function + AFunction targetFunction = source_p.getTarget(); + + FunctionalExchange functionalExchange = target_p.get1(); + FunctionInputPort inputPort = target_p.get2(); + FunctionOutputPort outputPort = target_p.get3(); + + //functional exchange source and target + functionalExchange.setSource(outputPort); + functionalExchange.setTarget(inputPort); + + //source physical function + Tuple2 tupleSource = + mappingExecution_p.get(sourceFunction, AFunction2PhysicalFunctionRule.ID); + PhysicalFunction sourcePhysicalFunction = tupleSource.get1(); + sourcePhysicalFunction.getOutputs().add(outputPort); + + //target physical function + Tuple2 tupleTarget = + mappingExecution_p.get(targetFunction, AFunction2PhysicalFunctionRule.ID); + PhysicalFunction targetPhysicalFunction = tupleTarget.get1(); + targetPhysicalFunction.getInputs().add(inputPort); + + //glue to the topmost elements + CapellaUpdateScope targetScope = mappingExecution_p.getTargetDataSet(); + Project project = targetScope.getProject(); + PhysicalFunction physicalFunction = CapellaUtil.getPhysicalFunctionRoot(project); + physicalFunction.getOwnedFunctionalExchanges().add(functionalExchange); + } + +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/AFunction2PhysicalFunctionRule.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/AFunction2PhysicalFunctionRule.java new file mode 100644 index 00000000..bb86b968 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/AFunction2PhysicalFunctionRule.java @@ -0,0 +1,96 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules; + +import java.util.List; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Rule; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.RuleIdentifier; +import org.eclipse.emf.diffmerge.bridge.util.structures.Tuple2; +import org.polarsys.capella.core.data.cs.Part; +import org.polarsys.capella.core.data.fa.ComponentFunctionalAllocation; +import org.polarsys.capella.core.data.fa.FaFactory; +import org.polarsys.capella.core.data.pa.PaFactory; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalFunction; +import org.polarsys.capella.core.data.pa.PhysicalFunctionPkg; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.integration.scopes.CapellaUpdateScope; +import org.polarsys.capella.diffmerge.bridge.integration.util.CapellaUtil; + +/** + * @author Amine Lajmi + * + */ +public class AFunction2PhysicalFunctionRule extends Rule> { + + /** + * The rule identifier + */ + public static final RuleIdentifier> ID = new RuleIdentifier>( + "AFunction2PhysicalFunctionRule"); //$NON-NLS-1$ + + /** + * @param provider_p (non-null) + */ + public AFunction2PhysicalFunctionRule(IQuery provider_p) { + super(provider_p, ID); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#createTarget(java.lang.Object, + * org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Tuple2 createTarget(AFunction source_p, IQueryExecution queryExecution_p) { + PhysicalFunction pf = PaFactory.eINSTANCE.createPhysicalFunction(); + ComponentFunctionalAllocation allocation = FaFactory.eINSTANCE.createComponentFunctionalAllocation(); + // workaround to force Capella Id creation + pf.getId(); + allocation.getId(); + return new Tuple2(pf, allocation); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#defineTarget(java.lang.Object, java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution, org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution) + */ + public void defineTarget(final AFunction source_p, final Tuple2 target_p, + IQueryExecution queryExecution_p, IMappingExecution mappingExecution_p) { + + // Container + final Tuple2 container = mappingExecution_p.get( + (ABehavior) source_p.eContainer(), ABehaviour2PhysicalComponentRule.ID); + + // Store the function + PhysicalFunction function = target_p.get1(); + function.setName(source_p.getName()); + CapellaUpdateScope targetScope = mappingExecution_p.getTargetDataSet(); + PhysicalFunctionPkg physicalFunctionPkg = CapellaUtil.getPhysicalFunctionPackage(targetScope.getProject()); + List rootFunctions = physicalFunctionPkg.getOwnedPhysicalFunctions(); + if (rootFunctions.isEmpty()) + physicalFunctionPkg.getOwnedPhysicalFunctions().add(function); + else + rootFunctions.get(0).getOwnedFunctions().add(function); + + // set it as owned by the behavior component + ComponentFunctionalAllocation allocation = target_p.get2(); + PhysicalComponent behaviourComponent = container.get1(); + behaviourComponent.getOwnedFunctionalAllocation().add(allocation); + + // set source and target of allocation + allocation.setSourceElement(behaviourComponent); + allocation.setTargetElement(function); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/ANode2PhysicalComponentRule.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/ANode2PhysicalComponentRule.java new file mode 100644 index 00000000..a9d4bcfc --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/rules/ANode2PhysicalComponentRule.java @@ -0,0 +1,85 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.rules; + +import org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQuery; +import org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.Rule; +import org.eclipse.emf.diffmerge.bridge.mapping.impl.RuleIdentifier; +import org.eclipse.emf.diffmerge.bridge.util.structures.Tuple2; +import org.polarsys.capella.core.data.cs.CsFactory; +import org.polarsys.capella.core.data.cs.Part; +import org.polarsys.capella.core.data.information.AggregationKind; +import org.polarsys.capella.core.data.pa.PaFactory; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalComponentNature; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.integration.scopes.CapellaUpdateScope; +import org.polarsys.capella.diffmerge.bridge.integration.util.CapellaUtil; + +/** + * @author Amine Lajmi + * + */ +public class ANode2PhysicalComponentRule extends Rule> { + + /** + * The rule identifier + */ + public static final RuleIdentifier> ID = new RuleIdentifier>( + "ANode2PhysicalComponentRule"); //$NON-NLS-1$ + + /** + * @param provider_p (non-null) + */ + public ANode2PhysicalComponentRule(IQuery provider_p) { + super(provider_p, ID); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#createTarget(java.lang.Object, + * org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution) + */ + public Tuple2 createTarget(ANode source_p, + IQueryExecution queryExecution_p) { + PhysicalComponent pc = PaFactory.eINSTANCE.createPhysicalComponent(); + Part pt = CsFactory.eINSTANCE.createPart(); + + // workaround to force Capella Id creation + pc.getId(); + pt.getId(); + return new Tuple2(pc, pt); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.mapping.api.IRule#defineTarget(java.lang.Object, java.lang.Object, org.eclipse.emf.diffmerge.bridge.mapping.api.IQueryExecution, org.eclipse.emf.diffmerge.bridge.mapping.api.IMappingExecution) + */ + public void defineTarget(final ANode source_p, + final Tuple2 target_p, + IQueryExecution queryExecution_p, IMappingExecution mappingExecution_p) { + // Physical Component + PhysicalComponent physicalComponent = target_p.get1(); + physicalComponent.setName(source_p.getName()); + physicalComponent.setNature(PhysicalComponentNature.NODE); + // Part + Part physicalPart = target_p.get2(); + physicalPart.setName(source_p.getName()); + physicalPart.setAggregationKind(AggregationKind.UNSET); + physicalPart.setAbstractType(physicalComponent); + // Storage + CapellaUpdateScope targetScope = mappingExecution_p.getTargetDataSet(); + PhysicalComponent rootPhysicalSystem = CapellaUtil.getPhysicalSystemRoot(targetScope.getProject()); + rootPhysicalSystem.getOwnedPhysicalComponents().add(physicalComponent); + rootPhysicalSystem.getOwnedFeatures().add(physicalPart); + } +} \ No newline at end of file diff --git a/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/util/CapellaUtil.java b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/util/CapellaUtil.java new file mode 100644 index 00000000..f0bb7339 --- /dev/null +++ b/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa2capella/src/org/polarsys/capella/diffmerge/bridge/examples/apa2capella/util/CapellaUtil.java @@ -0,0 +1,136 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa2capella.util; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.polarsys.capella.core.data.capellamodeller.ModelRoot; +import org.polarsys.capella.core.data.capellamodeller.Project; +import org.polarsys.capella.core.data.capellamodeller.SystemEngineering; +import org.polarsys.capella.core.data.fa.FunctionPkg; +import org.polarsys.capella.core.data.pa.PhysicalArchitecture; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalFunction; +import org.polarsys.capella.core.data.pa.PhysicalFunctionPkg; +import org.polarsys.capella.core.model.handler.command.CapellaResourceHelper; + +/** + * A utility helper to retrieve parts of a Capella model + * + * @author Amine Lajmi + * + */ +public class CapellaUtil { + + /** + * Returns the root physical component of the Capella physical architecture given a semantic object + * + * @param source_p + * a (non-null) Capella semantic object + * @return the (possibly null) physical system root + */ + public static PhysicalComponent getPhysicalSystemRoot(EObject source_p) { + ResourceSet resourceSet = source_p.eResource().getResourceSet(); + URI semanticResourceURI = source_p.eResource().getURI().trimFileExtension() + .appendFileExtension(CapellaResourceHelper.CAPELLA_MODEL_FILE_EXTENSION); + Resource semanticResource = resourceSet.getResource(semanticResourceURI, false); + if (semanticResource != null) { + EObject root = semanticResource.getContents().get(0); + if (root instanceof Project) { + EList ownedModelRoots = ((Project) root) + .getOwnedModelRoots(); + for (ModelRoot modelRoot : ownedModelRoots) { + if (modelRoot instanceof SystemEngineering) { + EList containedPhysicalArchitectures = ((SystemEngineering) modelRoot) + .getContainedPhysicalArchitectures(); + for (PhysicalArchitecture arch : containedPhysicalArchitectures) { + return (PhysicalComponent)arch.getSystem(); + } + } + } + } + } + return null; + } + + /** + * Returns the root physical component of the Capella physical architecture + * + * @param resource_p + * (non-null) Capella semantic resource + * @return the physical system root given a resource. + */ + public static PhysicalComponent getPhysicalSystemRoot(Resource resource_p) { + return getPhysicalSystemRoot(resource_p.getContents().get(0)); + } + + /** + * Returns the physical function package of a Capella model + * + * @param source_p + * a (non-null) Capella semantic object + * @return the physical function package. + */ + public static PhysicalFunctionPkg getPhysicalFunctionPackage(EObject source_p) { + ResourceSet resourceSet = source_p.eResource().getResourceSet(); + URI semanticResourceURI = source_p.eResource().getURI().trimFileExtension() + .appendFileExtension(CapellaResourceHelper.CAPELLA_MODEL_FILE_EXTENSION); + Resource semanticResource = resourceSet.getResource(semanticResourceURI, false); + PhysicalFunctionPkg physicalFunctionPkgTmp = null; + if (semanticResource != null) { + EObject root = semanticResource.getContents().get(0); + if (root instanceof Project) { + EList ownedModelRoots = ((Project) root).getOwnedModelRoots(); + for (ModelRoot modelRoot : ownedModelRoots) { + if (modelRoot instanceof SystemEngineering) { + EList containedPhysicalArchitectures = ((SystemEngineering) modelRoot) + .getContainedPhysicalArchitectures(); + for (PhysicalArchitecture arch : containedPhysicalArchitectures) { + FunctionPkg ownedFunctionPkg = arch.getOwnedFunctionPkg(); + if (ownedFunctionPkg instanceof PhysicalFunctionPkg) { + physicalFunctionPkgTmp = (PhysicalFunctionPkg) ownedFunctionPkg; + break; + } + } + } + } + } + } + return physicalFunctionPkgTmp; + } + + /** + * Returns the physical function root of a Capella model + * + * @param source_p + * a (non-null) Capella semantic object + * @return the physical function root given an eObject. + */ + public static PhysicalFunction getPhysicalFunctionRoot(EObject source_p) { + PhysicalFunctionPkg functionPackage = getPhysicalFunctionPackage(source_p); + return functionPackage.getOwnedPhysicalFunctions().get(0); + } + + /** + * Returns the physical function root of a Capella model + * + * @param resource_p the (non-null) semantic resource + * @return the physical function root given a resource. + */ + public static PhysicalFunction getPhysicalFunctionRoot(Resource resource_p) { + PhysicalFunctionPkg functionPackage = getPhysicalFunctionPackage(resource_p.getContents().get(0)); + return functionPackage.getOwnedPhysicalFunctions().get(0); + } +} diff --git a/examples/apa/pom.xml b/examples/apa/pom.xml new file mode 100644 index 00000000..2867e67f --- /dev/null +++ b/examples/apa/pom.xml @@ -0,0 +1,31 @@ + + + + + 4.0.0 + + org.polarsys.capella.diffmerge.coevolution.core.examples.apa + + pom + + + org.polarsys.capella + org.polarsys.capella.studio + 6.1.0-SNAPSHOT + ../../releng/plugins/org.polarsys.capella.studio.releng.parent + + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.classpath b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.project b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.project new file mode 100644 index 00000000..e0132431 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.settings/org.eclipse.jdt.core.prefs b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..7adc0fb9 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.settings/org.eclipse.pde.prefs b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000..2c24bcab --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/.settings/org.eclipse.pde.prefs @@ -0,0 +1,34 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=2 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=2 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=2 +compilers.p.missing-version-require-bundle=2 +compilers.p.no-required-att=0 +compilers.p.no.automatic.module=1 +compilers.p.not-externalized-att=2 +compilers.p.service.component.without.lazyactivation=1 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/META-INF/MANIFEST.MF b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/META-INF/MANIFEST.MF new file mode 100644 index 00000000..e2e69dfe --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Transposer Integration Example Plug-In (Incubation) +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated;singleton:=true +Bundle-Version: 0.14.1.qualifier +Bundle-Activator: org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated.TransposerIntegrationApaPlugin +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.gef, + org.eclipse.gmf.runtime.notation, + org.polarsys.capella.diffmerge.bridge.examples.apa.transposer, + org.polarsys.kitalpha.diffmerge.bridge.integration.transposer, + org.eclipse.emf.diffmerge.bridge.interactive +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-ActivationPolicy: lazy +Export-Package: org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated +Automatic-Module-Name: org.eclipse.emf.diffmerge.bridge.examples.apa.transposer.integrated diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/about.html b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

    About This Content

    + +

    August 17, 2018

    +

    License

    +

    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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

    +

    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 http://www.eclipse.org.

    + + \ No newline at end of file diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/build.properties b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/build.properties new file mode 100644 index 00000000..6d7a3840 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/build.properties @@ -0,0 +1,14 @@ +############################################################################### +# Copyright (c) 2015-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/plugin.xml b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/plugin.xml new file mode 100644 index 00000000..dbb6c8dc --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/plugin.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerAPABridgeAction.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerAPABridgeAction.java new file mode 100644 index 00000000..17d93c7c --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerAPABridgeAction.java @@ -0,0 +1,112 @@ +/********************************************************************* + * Copyright (c) 2014-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated; + +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.ui.IObjectActionDelegate; +import org.eclipse.ui.IWorkbenchPart; +import org.polarsys.capella.core.data.pa.PhysicalArchitecture; +import org.polarsys.capella.core.data.pa.PhysicalComponent; + + +/** + * An action for running the Capella2Apa operation from the GUI. + * @author O. CONSTANT + */ +public class TransposerAPABridgeAction implements IObjectActionDelegate { + + /** The current, potentially null selection */ + private IStructuredSelection _selection; + + /** The current, potentially null workbench part where the action is being used */ + private IWorkbenchPart _workbenchPart; + + + /** + * Constructor + */ + public TransposerAPABridgeAction() { + _selection = null; + _workbenchPart = null; + } + + /** + * Return the context element for the current selection, if any. + * The context element is the one on which the action is applicable. + * @return a potentially null object + */ + protected PhysicalArchitecture getContext() { + PhysicalArchitecture result = null; + if (_selection != null && !_selection.isEmpty()) { + Object selected = _selection.getFirstElement(); + if (selected instanceof EditPart) + selected = ((EditPart)selected).getModel(); + if (selected instanceof View) + selected = ((View)selected).getElement(); + if (selected instanceof DSemanticDecorator) + selected = ((DSemanticDecorator)selected).getTarget(); + if (selected instanceof PhysicalComponent) + while (selected instanceof PhysicalComponent) + selected = ((PhysicalComponent)selected).eContainer(); + if (selected instanceof PhysicalArchitecture) + result = (PhysicalArchitecture)selected; + } + return result; + } + + /** + * Return whether the action is applicable given the current context + */ + protected boolean isApplicable() { + return _selection != null && !_selection.isEmpty() && _workbenchPart != null; + } + + /** + * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) + */ + public void run(IAction action_p) { + PhysicalArchitecture context = getContext(); + if (context != null) { + new TransposerAPABridgeJob(context).schedule(); + } else { + MessageDialog.openError( + _workbenchPart.getSite().getShell(), + TransposerIntegrationApaPlugin.getDefault().getPluginId(), + "APA Transposer Bridge Example"); //$NON-NLS-1$ + } + } + + /** + * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IAction action_p, ISelection selection_p) { + if (selection_p instanceof IStructuredSelection) + _selection = (IStructuredSelection)selection_p; + else + _selection = null; + action_p.setEnabled(isApplicable()); + } + + /** + * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) + */ + public void setActivePart(IAction action_p, IWorkbenchPart targetPart_p) { + _workbenchPart = targetPart_p; + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerAPABridgeJob.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerAPABridgeJob.java new file mode 100644 index 00000000..caae436a --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerAPABridgeJob.java @@ -0,0 +1,55 @@ +/********************************************************************* + * Copyright (c) 2014-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated; + +import org.eclipse.emf.diffmerge.api.scopes.IEditableModelScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaPackage; +import org.polarsys.kitalpha.diffmerge.bridge.integration.transposer.TransposerBridge; +import org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob; +import org.eclipse.emf.diffmerge.bridge.interactive.EMFInteractiveBridge; +import org.eclipse.emf.diffmerge.impl.policies.ConfigurableDiffPolicy; +import org.polarsys.capella.core.data.pa.PhysicalArchitecture; + + +/** + * A variant of TransposerAPABridgeJob based on a Transposer mapping. + * @author Olivier Constant + */ +public class TransposerAPABridgeJob extends BridgeJob { + + /** + * Constructor + * @param context_p a non-null physical architecture + */ + public TransposerAPABridgeJob(PhysicalArchitecture context_p) { + super("Capella2APA", context_p, //$NON-NLS-1$ + context_p.eResource().getURI().trimFileExtension().appendFileExtension(ApaPackage.eNAME)); + } + + /** + * @see org.eclipse.emf.diffmerge.bridge.interactive.BridgeJob#getBridge() + */ + @Override + protected EMFInteractiveBridge getBridge() { + final TransposerBridge mapping = + new TransposerBridge( + "org.eclipse.emf.diffmerge.bridge.examples.apa.transposer.purpose", //$NON-NLS-1$ + "org.eclipse.emf.diffmerge.bridge.examples.apa.transposer.mapping"); //$NON-NLS-1$ + ConfigurableDiffPolicy diffPolicy = new ConfigurableDiffPolicy(); + diffPolicy.setIgnoreOrders(true); // Ignore orders because of Transposer's non-determinism + EMFInteractiveBridge result = + new EMFInteractiveBridge( + mapping, diffPolicy, null, null); + return result; + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerIntegrationApaPlugin.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerIntegrationApaPlugin.java new file mode 100644 index 00000000..1be78d59 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/integrated/TransposerIntegrationApaPlugin.java @@ -0,0 +1,69 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.integrated; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + + +/** + * The activator for this plug-in. + * @author Olivier Constant + */ +public class TransposerIntegrationApaPlugin extends AbstractUIPlugin { + + /** The shared instance */ + private static TransposerIntegrationApaPlugin __plugin; + + + /** + * Constructor + */ + public TransposerIntegrationApaPlugin() { + // Nothing needed + } + + /** + * Return the shared instance + * @return a non-null instance of this class + */ + public static TransposerIntegrationApaPlugin getDefault() { + return __plugin; + } + + /** + * Return the ID of this plug-in according to MANIFEST.MF + * @return a non-null string + */ + public String getPluginId() { + return getBundle().getSymbolicName(); + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context_p) throws Exception { + super.start(context_p); + __plugin = this; + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context_p) throws Exception { + __plugin = null; + super.stop(context_p); + } + +} \ No newline at end of file diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.classpath b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.classpath new file mode 100644 index 00000000..e801ebfb --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.project b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.project new file mode 100644 index 00000000..05d41fc5 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.project @@ -0,0 +1,28 @@ + + + org.polarsys.capella.diffmerge.bridge.examples.apa.transposer + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.settings/org.eclipse.jdt.core.prefs b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..7adc0fb9 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,10 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/Launcher/Capella2ApaTransposer.launch b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/Launcher/Capella2ApaTransposer.launch new file mode 100644 index 00000000..bf3f746a --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/Launcher/Capella2ApaTransposer.launch @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/META-INF/MANIFEST.MF b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/META-INF/MANIFEST.MF new file mode 100644 index 00000000..a416ce7b --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Transposer Example Plug-In (Incubation) +Bundle-SymbolicName: org.polarsys.capella.diffmerge.bridge.examples.apa.transposer;singleton:=true +Bundle-Version: 0.14.1.qualifier +Bundle-Activator: org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.TransposerApaPlugin +Bundle-Vendor: www.polarsys.org +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.polarsys.capella.core.data.gen;bundle-version="1.4.0";visibility:=reexport, + org.polarsys.capella.diffmerge.bridge.examples.apa.gen;visibility:=reexport, + org.polarsys.kitalpha.transposer.transformation.emf, + org.polarsys.kitalpha.transposer.emf.toolbox +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Bundle-ActivationPolicy: lazy +Automatic-Module-Name: org.polarsys.capella.diffmerge.bridge.examples.apa.transposer diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/about.html b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/about.html new file mode 100644 index 00000000..720a1d06 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/about.html @@ -0,0 +1,25 @@ + + + + +About + + +

    About This Content

    + +

    August 17, 2018

    +

    License

    +

    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 2.0 ("EPL"). A copy of the EPL is available +at https://www.eclipse.org/legal/epl-2.0. +For purposes of the EPL, "Program" will mean the Content.

    +

    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 http://www.eclipse.org.

    + + \ No newline at end of file diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/build.properties b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/build.properties new file mode 100644 index 00000000..d547e59a --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/build.properties @@ -0,0 +1,15 @@ +############################################################################### +# Copyright (c) 2014-2019 Thales Global Services S.A.S. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + Launcher/,\ + about.html diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/plugin.xml b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/plugin.xml new file mode 100644 index 00000000..7596a25e --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/plugin.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The loading and initialization of a Capella model. + + + + + diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/TransposerApaPlugin.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/TransposerApaPlugin.java new file mode 100644 index 00000000..bf0493ce --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/TransposerApaPlugin.java @@ -0,0 +1,69 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + + +/** + * The activator for this plug-in. + * @author Olivier Constant + */ +public class TransposerApaPlugin extends AbstractUIPlugin { + + /** The shared instance */ + private static TransposerApaPlugin __plugin; + + + /** + * Constructor + */ + public TransposerApaPlugin() { + // Nothing needed + } + + /** + * Return the shared instance + * @return a non-null instance of this class + */ + public static TransposerApaPlugin getDefault() { + return __plugin; + } + + /** + * Return the ID of this plug-in according to MANIFEST.MF + * @return a non-null string + */ + public String getPluginId() { + return getBundle().getSymbolicName(); + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context_p) throws Exception { + super.start(context_p); + __plugin = this; + } + + /** + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context_p) throws Exception { + __plugin = null; + super.stop(context_p); + } + +} \ No newline at end of file diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/init/CapellaDomainHelper.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/init/CapellaDomainHelper.java new file mode 100644 index 00000000..98ab4554 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/init/CapellaDomainHelper.java @@ -0,0 +1,109 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.init; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Set; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.polarsys.capella.core.data.capellacore.CapellaElement; +import org.polarsys.capella.core.data.fa.FaPackage; +import org.polarsys.capella.core.data.pa.PaPackage; +import org.polarsys.kitalpha.transposer.transformation.emf.TransposerEMFPlugin; +import org.polarsys.kitalpha.transposer.transformation.emf.util.EmfDomainHelper; + + +/** + * A domain helper dedicated to the Capella2Apa bridge. + * @author Olivier Constant + */ +public class CapellaDomainHelper extends EmfDomainHelper { + + /** The file extension for Capella models */ + public static final String CAPELLA_FILE_EXT = "melodymodeller"; //$NON-NLS-1$ + + /** + * @see org.polarsys.kitalpha.transposer.transformation.emf.util.EmfDomainHelper#isDomainFor(java.lang.Object) + */ + @Override + public boolean isDomainFor(Object object_p) { + boolean isDomain = false ; + if (object_p instanceof IFile) { + IFile file = (IFile) object_p; + isDomain = CAPELLA_FILE_EXT.equals(file.getFileExtension()); + } + + if(object_p instanceof CapellaElement){ + isDomain = true; + } + return isDomain; + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.emf.util.EmfDomainHelper#getEPackages() + */ + @Override + protected Set getEPackages() { + Set eAllPackages = new LinkedHashSet(); + eAllPackages.add(PaPackage.eINSTANCE); + eAllPackages.add(FaPackage.eINSTANCE); + return eAllPackages; + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.emf.util.EmfDomainHelper#isHotSpot(java.lang.Object) + */ + @Override + public boolean isHotSpot(Object object_p) { + return object_p instanceof CapellaElement; + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.emf.util.EmfDomainHelper#getAnalysisSources(java.util.Collection) + */ + @Override + public Collection getAnalysisSources(Collection selection_p) { + Collection sources = new ArrayList(); + for (Object sel : selection_p) { + if (sel instanceof CapellaElement) { + Iterator it = ((CapellaElement) sel).eAllContents(); + while (it.hasNext()) + sources.add(it.next()); + } + + } + return sources; + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.emf.util.EmfDomainHelper#getDomainMetaclass(java.lang.String) + */ + @Override + public java.lang.Class getDomainMetaclass(String name_p) { + try { + return java.lang.Class.forName(name_p); + } catch (ClassNotFoundException e) { + TransposerEMFPlugin.getDefault().getLog().log( + new Status(IStatus.ERROR, TransposerEMFPlugin.PLUGIN_ID, + "No Domain Class called : " + name_p, e)); //$NON-NLS-1$ + } + return null; + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/init/CapellaModelInitializer.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/init/CapellaModelInitializer.java new file mode 100644 index 00000000..658f5834 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/init/CapellaModelInitializer.java @@ -0,0 +1,110 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.init; + +import java.util.Collection; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.polarsys.capella.common.platform.sirius.ted.SemanticEditingDomainFactory; +import org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.TransposerApaPlugin; +import org.polarsys.kitalpha.cadence.core.api.parameter.ActivityParameters; +import org.polarsys.kitalpha.transposer.emf.toolbox.activities.ModelInitializer; +import org.polarsys.kitalpha.transposer.emf.toolbox.api.TransposerUtil; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; +import org.polarsys.kitalpha.transposer.transformation.emf.resource.ResourceUtil; + + +/** + * A ModelInitializer activity that can handle Capella models. + */ +public class CapellaModelInitializer extends ModelInitializer { + + /** + * Create and return a resource set for loading the given file + * @param file_p a non-null file + * @return a non-null resource set + */ + protected ResourceSet createSourceResourceSet(IFile file_p) { + ResourceSet result; + if (isCapellaFile(file_p)) + result = new SemanticEditingDomainFactory().createEditingDomain().getResourceSet(); + else + result = new ResourceSetImpl(); + return result; + } + + /** + * Return whether the given selection refers to a Capella model + * @param file_p a potentially null object + */ + protected boolean isCapellaFile(IFile file_p) { + return CapellaDomainHelper.CAPELLA_FILE_EXT.equals(file_p.getFileExtension()); + } + + /** + * Copied from ModelInitializer. + * @see ModelInitializer#run(ActivityParameters) + * @see org.polarsys.kitalpha.transposer.emf.toolbox.activities.ModelInitializer#run(org.polarsys.kitalpha.cadence.core.api.parameter.ActivityParameters) + */ + @Override + @SuppressWarnings("unchecked") + public IStatus run(ActivityParameters activityParams_p) { + // Selection + Collection selection = (Collection) activityParams_p.getParameter(TRANSPOSER_SELECTION).getValue(); + if (selection == null || selection.isEmpty()) { + return new Status(IStatus.ERROR, TransposerApaPlugin.getDefault().getPluginId(), + "the selection is empty or null");//$NON-NLS-1$ + } + Object selectedElement = selection.iterator().next(); + // Source model + if (selectedElement instanceof IFile) { + IFile file = (IFile)selectedElement; + URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true); + ResourceSet sourceRS = createSourceResourceSet(file); + Resource resource = sourceRS.getResource(fileURI, true); + if (resource.getContents() != null && !resource.getContents().isEmpty()) { + EObject project = (EObject) resource.getContents().get(0); // get the root container + selectedElement = project; + selection.clear(); + selection.add(project); + } + } + // Target root element + final String nsUri = (String) activityParams_p.getParameter(NSURI).getValue(); + final String rootS = (String) activityParams_p.getParameter(ROOT_ELEMENT).getValue(); + final EObject root = TransposerUtil.createObject(nsUri, rootS); + IContext context = (IContext) activityParams_p.getParameter(TRANSPOSER_CONTEXT).getValue(); + // Target resource + String modelPath = new String(); + if (selectedElement instanceof EObject && ((EObject) selectedElement).eResource() != null) { + Resource res = ((EObject) selectedElement).eResource(); + String path = res.getURI().toPlatformString(true); + final String extension = root.eClass().getEPackage().getName().toLowerCase(); + modelPath = res.getURI().toPlatformString(true). + substring(0,path.length() - res.getURI().fileExtension().length()) + + extension; + } + final ResourceSet resourceSet = new ResourceSetImpl(); + ResourceUtil.createResource(resourceSet, modelPath, null, false); + resourceSet.getResources().get(0).setTrackingModification(true); + context.put(ResourceUtil.TRANSPOSER_RESOURCE_SET, resourceSet); + return Status.OK_STATUS; + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/FE2AExchange.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/FE2AExchange.java new file mode 100644 index 00000000..da5780d7 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/FE2AExchange.java @@ -0,0 +1,106 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.rules; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.polarsys.capella.core.data.fa.FunctionalExchange; +import org.polarsys.capella.core.data.pa.PhysicalArchitecture; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AExchange; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IPremise; +import org.polarsys.kitalpha.transposer.transformation.context.ContextHelper; +import org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule; + + +/** + * Rule: FunctionalExchange -> AExchange + * @author Olivier Constant + */ +public class FE2AExchange extends AbstractTransformationRule { + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#create(java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected Object create(FunctionalExchange element_p, IContext context_p) + throws Exception { + AExchange result = ApaFactory.eINSTANCE.createAExchange(); + // Name + result.setName(element_p.getName()); + // Container + PhysicalArchitecture archi = getOwningPhysicalArchitecture(element_p); // Should not be null because of premises + PhysicalComponent mainComponent = (PhysicalComponent)archi.getSystem(); + AScope container = (AScope)ContextHelper.getMainTarget(context_p, mainComponent); + result.setOwningScope(container); + // Source + EObject sourceElement = element_p.getSource().eContainer(); + AFunction sourceAFunction = (AFunction)ContextHelper.getMainTarget(context_p, sourceElement); + if (sourceAFunction != null) + result.setSource(sourceAFunction); + // Target + EObject targetElement = element_p.getTarget().eContainer(); + AFunction targetAFunction = (AFunction)ContextHelper.getMainTarget(context_p, targetElement); + if (targetAFunction != null) + result.setTarget(targetAFunction); + return result; + } + + /** + * Return the physical architecture that contains the given element, if any + * @param element_p a non-null element + * @return a potentially null object + */ + protected PhysicalArchitecture getOwningPhysicalArchitecture(EObject element_p) { + PhysicalArchitecture result = null; + EObject container = element_p.eContainer(); + while (!(container instanceof PhysicalArchitecture) && container != null) { + container = container.eContainer(); + } + if (container instanceof PhysicalArchitecture) + result = (PhysicalArchitecture)container; + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#isApplicableOn(java.lang.Object) + */ + public boolean isApplicableOn(FunctionalExchange element_p) { + return true; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#getPremises(java.lang.Object) + */ + public List getPremises(FunctionalExchange element_p) { + List result = new ArrayList(); + result.add(createPrecedencePremise(element_p.getSource().eContainer(), "exchangeSource")); //$NON-NLS-1$ + result.add(createPrecedencePremise(element_p.getTarget().eContainer(), "exchangeTarget")); //$NON-NLS-1$ + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#update(java.lang.Object, java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected void update(Object object_p, FunctionalExchange element_p, + IContext context_p) throws Exception { + // No update + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/Function2AFunction.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/Function2AFunction.java new file mode 100644 index 00000000..1213120c --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/Function2AFunction.java @@ -0,0 +1,100 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.rules; + +import java.util.ArrayList; +import java.util.List; + +import org.polarsys.capella.common.data.modellingcore.AbstractTypedElement; +import org.polarsys.capella.core.data.cs.AbstractDeploymentLink; +import org.polarsys.capella.core.data.cs.Part; +import org.polarsys.capella.core.data.fa.AbstractFunction; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.deployment.PartDeploymentLink; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AFunction; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IPremise; +import org.polarsys.kitalpha.transposer.transformation.context.ContextHelper; +import org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule; + + +/** + * Rule: AbstractFunction -> AFunction + * @author Olivier Constant + */ +public class Function2AFunction extends AbstractTransformationRule { + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#create(java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected Object create(AbstractFunction element_p, IContext context_p) + throws Exception { + AFunction result = ApaFactory.eINSTANCE.createAFunction(); + // Name + result.setName(element_p.getName()); + // Container + PhysicalComponent allocationComponent = + (PhysicalComponent)element_p.getAllocationBlocks().get(0); + Part allocationPart = (Part) allocationComponent.getTypedElements().get(0); // Monopart assumed + PartDeploymentLink dLink = (PartDeploymentLink)allocationPart.getDeployingLinks().iterator().next(); + ABehavior container = (ABehavior)ContextHelper.getMainTarget(context_p, dLink); + result.setOwningBehavior(container); + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#isApplicableOn(java.lang.Object) + */ + public boolean isApplicableOn(AbstractFunction element_p) { + boolean result = false; + if (element_p.getAllocationBlocks().size() == 1 && + element_p.getAllocationBlocks().get(0) instanceof PhysicalComponent) { + PhysicalComponent pc = (PhysicalComponent)element_p.getAllocationBlocks().get(0); + if (pc.getAbstractTypedElements().size() == 1) { + AbstractTypedElement typedElement = pc.getAbstractTypedElements().iterator().next(); + if (typedElement instanceof Part) { + Part part = (Part)typedElement; + if (part.getDeployingLinks().size() == 1) { + AbstractDeploymentLink dLink = part.getDeployingLinks().iterator().next(); + result = dLink instanceof PartDeploymentLink; + } + } + } + } + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#getPremises(java.lang.Object) + */ + public List getPremises(AbstractFunction element_p) { + List result = new ArrayList(); + PhysicalComponent pc = (PhysicalComponent)element_p.getAllocationBlocks().get(0); + AbstractTypedElement typedElement = pc.getAbstractTypedElements().iterator().next(); + PartDeploymentLink dLink = (PartDeploymentLink)((Part)typedElement).getDeployingLinks().iterator().next(); + result.add(createPrecedencePremise(dLink, "allocationTarget")); //$NON-NLS-1$ + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#update(java.lang.Object, java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected void update(Object object_p, AbstractFunction element_p, + IContext context_p) throws Exception { + // No update + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/PC2AScope.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/PC2AScope.java new file mode 100644 index 00000000..9ec093e5 --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/PC2AScope.java @@ -0,0 +1,85 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.rules; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.polarsys.capella.core.data.cs.CsPackage; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IPremise; +import org.polarsys.kitalpha.transposer.transformation.emf.resource.ResourceUtil; +import org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule; + + +/** + * Rule: PC -> AScope + * @author Olivier Constant + */ +public class PC2AScope extends AbstractTransformationRule { + + /** + * Attach the given element to the target model as root + * @param element_p a non-null element + * @param context_p a non-null context + */ + protected void attach(EObject element_p, IContext context_p) { + ResourceSet rs = (ResourceSet) context_p.get(ResourceUtil.TRANSPOSER_RESOURCE_SET); + if (rs != null && !rs.getResources().isEmpty()) { + Resource resource = rs.getResources().get(0); + resource.getContents().add(element_p); + } + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#create(java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected Object create(PhysicalComponent element_p, IContext context_p) + throws Exception { + AScope result = ApaFactory.eINSTANCE.createAScope(); + result.setName(element_p.getName()); + attach(result, context_p); + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#isApplicableOn(java.lang.Object) + */ + public boolean isApplicableOn(PhysicalComponent element_p) { + return CsPackage.eINSTANCE.getBlockArchitecture_System() == + element_p.eContainingFeature(); + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#getPremises(java.lang.Object) + */ + public List getPremises(PhysicalComponent element_p) { + return Collections.emptyList(); + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#update(java.lang.Object, java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected void update(Object object_p, PhysicalComponent element_p, + IContext context_p) throws Exception { + // No update + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/PDL2ABehavior.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/PDL2ABehavior.java new file mode 100644 index 00000000..06f4dcaf --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/PDL2ABehavior.java @@ -0,0 +1,79 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.rules; + +import java.util.Collections; +import java.util.List; + +import org.polarsys.capella.core.data.capellacore.Type; +import org.polarsys.capella.core.data.cs.DeployableElement; +import org.polarsys.capella.core.data.cs.DeploymentTarget; +import org.polarsys.capella.core.data.cs.Part; +import org.polarsys.capella.core.data.pa.deployment.PartDeploymentLink; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ABehavior; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IPremise; +import org.polarsys.kitalpha.transposer.transformation.context.ContextHelper; +import org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule; + + +/** + * Rule: PartDeploymentLink -> ABehavior + * @author Olivier Constant + */ +public class PDL2ABehavior extends AbstractTransformationRule { + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#create(java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected Object create(PartDeploymentLink element_p, IContext context_p) + throws Exception { + ABehavior result = ApaFactory.eINSTANCE.createABehavior(); + // Attributes + DeployableElement deployed = element_p.getDeployedElement(); + Type deployedType = ((Part)deployed).getType(); + result.setName(deployedType.getName()); + // Container + DeploymentTarget deploymentTarget = element_p.getLocation(); + ANode container = (ANode)ContextHelper.getMainTarget(context_p, deploymentTarget); + result.setOwningNode(container); + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#isApplicableOn(java.lang.Object) + */ + public boolean isApplicableOn(PartDeploymentLink element_p) { + return true; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#getPremises(java.lang.Object) + */ + public List getPremises(PartDeploymentLink element_p) { + return Collections.singletonList( + createPrecedencePremise(element_p.getLocation(), "location")); //$NON-NLS-1$ + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#update(java.lang.Object, java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected void update(Object object_p, PartDeploymentLink element_p, + IContext context_p) throws Exception { + // No update + } + +} diff --git a/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/Part2ANode.java b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/Part2ANode.java new file mode 100644 index 00000000..9b8c642e --- /dev/null +++ b/integrations/transposer/examples/apa/org.polarsys.capella.diffmerge.bridge.examples.apa.transposer/src/org/polarsys/capella/diffmerge/bridge/examples/apa/transposer/rules/Part2ANode.java @@ -0,0 +1,79 @@ +/********************************************************************* + * Copyright (c) 2015-2019 Thales Global Services S.A.S. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Thales Global Services S.A.S. - initial API and implementation + **********************************************************************/ +package org.polarsys.capella.diffmerge.bridge.examples.apa.transposer.rules; + +import java.util.Collections; +import java.util.List; + +import org.polarsys.capella.core.data.capellacore.Type; +import org.polarsys.capella.core.data.cs.Part; +import org.polarsys.capella.core.data.pa.PhysicalComponent; +import org.polarsys.capella.core.data.pa.PhysicalComponentNature; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ANode; +import org.polarsys.capella.diffmerge.bridge.examples.apa.AScope; +import org.polarsys.capella.diffmerge.bridge.examples.apa.ApaFactory; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext; +import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IPremise; +import org.polarsys.kitalpha.transposer.transformation.context.ContextHelper; +import org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule; + + +/** + * Rule: Part -> ANode + * @author Olivier Constant + */ +public class Part2ANode extends AbstractTransformationRule { + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#create(java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected Object create(Part element_p, IContext context_p) + throws Exception { + ANode result = ApaFactory.eINSTANCE.createANode(); + result.setName(element_p.getName()); + AScope container = (AScope)ContextHelper.getMainTarget(context_p, element_p.eContainer()); + result.setOwningScope(container); + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#isApplicableOn(java.lang.Object) + */ + public boolean isApplicableOn(Part element_p) { + boolean result = false; + Type type = element_p.getType(); + if (type instanceof PhysicalComponent) { + PhysicalComponent pc = (PhysicalComponent)type; + result = pc.getNature() == PhysicalComponentNature.NODE; + } + return result; + } + + /** + * @see org.polarsys.kitalpha.transposer.rules.handler.rules.api.IRule#getPremises(java.lang.Object) + */ + public List getPremises(Part element_p) { + return Collections.singletonList( + createPrecedencePremise(element_p.eContainer(), "container")); //$NON-NLS-1$ + } + + /** + * @see org.polarsys.kitalpha.transposer.transformation.rule.AbstractTransformationRule#update(java.lang.Object, java.lang.Object, org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext) + */ + @Override + protected void update(Object object_p, Part element_p, + IContext context_p) throws Exception { + // No update + } + +} diff --git a/integrations/transposer/examples/apa/pom.xml b/integrations/transposer/examples/apa/pom.xml new file mode 100644 index 00000000..f44a1b73 --- /dev/null +++ b/integrations/transposer/examples/apa/pom.xml @@ -0,0 +1,31 @@ + + + + + 4.0.0 + + org.polarsys.capella.diffmerge.coevolution.integrations.transposer.examples.apa + + pom + + + org.polarsys.capella + org.polarsys.capella.studio + 6.1.0-SNAPSHOT + ../../../../releng/plugins/org.polarsys.capella.studio.releng.parent + + + diff --git a/releng/plugins/org.polarsys.capella.studio.releng.targets/capellastudio.target b/releng/plugins/org.polarsys.capella.studio.releng.targets/capellastudio.target new file mode 100644 index 00000000..6d7a5c16 --- /dev/null +++ b/releng/plugins/org.polarsys.capella.studio.releng.targets/capellastudio.target @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plugins/org.polarsys.capella.studio.test/model/org.polarsys.capella.vp.qualityassessment.vpdsl/build.xml b/tests/plugins/org.polarsys.capella.studio.test/model/org.polarsys.capella.vp.qualityassessment.vpdsl/build.xml new file mode 100644 index 00000000..6c7ec6b9 --- /dev/null +++ b/tests/plugins/org.polarsys.capella.studio.test/model/org.polarsys.capella.vp.qualityassessment.vpdsl/build.xml @@ -0,0 +1,335 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plugins/org.polarsys.capella.studio.test/model/org.polarsys.capella.vp.qualityassessment.vpdsl/javaCompiler...args b/tests/plugins/org.polarsys.capella.studio.test/model/org.polarsys.capella.vp.qualityassessment.vpdsl/javaCompiler...args new file mode 100644 index 00000000..c614ddf4 --- /dev/null +++ b/tests/plugins/org.polarsys.capella.studio.test/model/org.polarsys.capella.vp.qualityassessment.vpdsl/javaCompiler...args @@ -0,0 +1,65 @@ +#ADAPTER#ACCESS#kitalpha/resource reuse/plugins/org.polarsys.kitalpha.resourcereuse/bin[+org/polarsys/kitalpha/resourcereuse/*;+org/polarsys/kitalpha/resourcereuse/helper/*;+org/polarsys/kitalpha/resourcereuse/model/*;?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.runtime_3.22.0.v20210506-1025.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.osgi_3.16.300.v20210525-1715.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.osgi.compatibility.state_1.2.400.v20210401-1438.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.common_3.15.0.v20210518-0604.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.jobs_3.11.0.v20210420-1453.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.registry_3.10.200.v20210503-1606.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.preferences_3.8.200.v20210212-1143.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.contenttype_3.7.1000.v20210409-1722.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.app_1.5.100.v20210212-1143.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.osgi.services_3.10.100.v20210324-0936.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.osgi.util_3.6.0.v20210212-1137.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/jakarta.servlet-api_4.0.0.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.pde.core_3.14.300.v20210515-0638.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.e4.core.contexts_1.8.400.v20191217-1710.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/javax.inject_1.0.0.v20091030.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.e4.core.di_1.7.800.v20210526-1618.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.e4.core.di.annotations_1.6.600.v20191216-2352.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/javax.annotation_1.3.5.v20200909-1856.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.e4.core.services_2.2.600.v20210110-1654.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jdt.core_3.26.0.v20210609-0549.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jdt.compiler.apt_1.3.1300.v20210419-1022.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jdt.compiler.tool_1.2.1200.v20210521-0550.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.resources_3.15.0.v20210521-0722.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.resources.win32.x86_64_3.5.400.v20190812-0909.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.ant.core_3.6.0.v20210415-1314.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.variables_3.5.0.v20210510-1945.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.expressions_3.7.100.v20210203-1000.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.filesystem_1.9.0.v20210419-1155.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.filesystem.win32.x86_64_1.4.200.v20190812-0909.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.text_3.12.0.v20210512-1644.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.commands_3.10.0.v20210401-0744.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.team.core_3.9.0.v20210510-1748.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.compare.core_3.6.1000.v20201020-1107.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jdt.launching_3.19.200.v20210326-1452.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.debug.core_3.18.100.v20210511-0446.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.jdt.debug_3.17.200.v20210513-1223/jdimodel.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.core.filebuffers_3.7.0.v20210512-1543.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.pde.build_3.11.0.v20210429-0618/pdebuild.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.frameworkadmin_2.2.0.v20210315-2042.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.core_2.7.0.v20210315-2042.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.engine_2.7.0.v20210328-0514.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.metadata_2.6.0.v20210331-1610.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.metadata.repository_1.4.0.v20210315-2228.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.repository_2.5.100.v20210329-1206.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.security_1.3.600.v20210126-1005.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.security.win32.x86_64_1.1.200.v20190812-0919.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.tukaani.xz_1.8.0.v20180207-1613.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.2.0.v20210315-2228.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.frameworkadmin.equinox_1.2.0.v20210315-2042.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.simpleconfigurator_1.4.0.v20210315-2228.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.updatesite_1.2.0.v20210322-0909.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.artifact.repository_1.4.100.v20210418-1636.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.bouncycastle.bcpg_1.65.0.v20200527-1955.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.bouncycastle.bcprov_1.65.1.v20200529-1514.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.jarprocessor_1.2.0.v20210507-0825.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.publisher.eclipse_1.4.0.v20210421-1159.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.publisher_1.6.0.v20210322-0909.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.repository.tools_2.3.0.v20210325-0750.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.director_2.5.0.v20210325-0750.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.sat4j.core_2.3.5.v201308161310.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.sat4j.pb_2.3.5.v201404071733.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.director.app_1.2.0.v20210315-2042.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.garbagecollector_1.2.0.v20210316-1209.jar[?**/*] +#ADAPTER#ACCESS#Workspaces/Eclipse/2022-12/ws-capella-studio-kitalpha/.metadata/.plugins/org.eclipse.pde.core/.bundle_pool/plugins/org.eclipse.equinox.p2.touchpoint.eclipse_2.3.0.v20210315-2228.jar[?**/*]