diff options
author | rsuen | 2008-12-22 14:06:33 +0000 |
---|---|---|
committer | rsuen | 2008-12-22 14:06:33 +0000 |
commit | 77f79776d2e2dff51c26d247c0deb02de3931a9b (patch) | |
tree | 1b58c44d2f2985edcb5605347610f6603e81a341 /framework/bundles/org.eclipse.team.ecf.core | |
parent | 22ce10a636c5304ae171a55d4e74627884584968 (diff) | |
download | org.eclipse.ecf-77f79776d2e2dff51c26d247c0deb02de3931a9b.tar.gz org.eclipse.ecf-77f79776d2e2dff51c26d247c0deb02de3931a9b.tar.xz org.eclipse.ecf-77f79776d2e2dff51c26d247c0deb02de3931a9b.zip |
FIXED - bug 257017 Implement the datashare APIs on top of the Team API to allow two peers to synchronize their resources
Diffstat (limited to 'framework/bundles/org.eclipse.team.ecf.core')
22 files changed, 1691 insertions, 0 deletions
diff --git a/framework/bundles/org.eclipse.team.ecf.core/.classpath b/framework/bundles/org.eclipse.team.ecf.core/.classpath new file mode 100644 index 000000000..2fbb7a23e --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/framework/bundles/org.eclipse.team.ecf.core/.project b/framework/bundles/org.eclipse.team.ecf.core/.project new file mode 100644 index 000000000..78213ea5c --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.team.ecf.core</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/framework/bundles/org.eclipse.team.ecf.core/.settings/org.eclipse.jdt.core.prefs b/framework/bundles/org.eclipse.team.ecf.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..d30c2b496 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,346 @@ +#Mon Dec 22 08:48:25 EST 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +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.maxProblemPerUnit=1000 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +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=enabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.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=false +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=false +org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +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.format_guardian_clause_on_one_line=false +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=true +org.eclipse.jdt.core.formatter.indentation.size=4 +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=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_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=do not 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_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not 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_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=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=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_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_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_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.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=800 +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=false +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/framework/bundles/org.eclipse.team.ecf.core/.settings/org.eclipse.jdt.ui.prefs b/framework/bundles/org.eclipse.team.ecf.core/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..9bb86c1d3 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,57 @@ +#Wed Oct 10 22:18:36 EDT 2007 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_core +formatter_settings_version=11 +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=; +org.eclipse.jdt.ui.ondemandthreshold=3 +org.eclipse.jdt.ui.staticondemandthreshold=99 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/framework/bundles/org.eclipse.team.ecf.core/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.team.ecf.core/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b569d5f7f --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Team Plug-in +Bundle-SymbolicName: org.eclipse.team.ecf.core;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Activator: org.eclipse.team.internal.ecf.core.TeamSynchronization +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.team.core, + org.eclipse.ecf, + org.eclipse.ecf.datashare, + org.eclipse.compare.core, + org.eclipse.ecf.presence +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Export-Package: org.eclipse.team.internal.ecf.core;x-friends:="org.eclipse.team.ecf.core", + org.eclipse.team.internal.ecf.core.messages;x-friends:="org.eclipse.team.ecf.core", + org.eclipse.team.internal.ecf.core.variants;x-friends:="org.eclipse.team.ecf.core" diff --git a/framework/bundles/org.eclipse.team.ecf.core/build.properties b/framework/bundles/org.eclipse.team.ecf.core/build.properties new file mode 100644 index 000000000..e7d143d4c --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml +
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.team.ecf.core/plugin.xml b/framework/bundles/org.eclipse.team.ecf.core/plugin.xml new file mode 100644 index 000000000..b26047318 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/plugin.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + <extension + point="org.eclipse.ecf.start"> + <run class="org.eclipse.team.internal.ecf.core.ECFStart"/> + </extension> +</plugin> diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/ECFStart.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/ECFStart.java new file mode 100644 index 000000000..0d12ae4e0 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/ECFStart.java @@ -0,0 +1,113 @@ +/****************************************************************************
+ * Copyright (c) 2007, 2008 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.team.internal.ecf.core;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ecf.core.ContainerFactory;
+import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.core.IContainerListener;
+import org.eclipse.ecf.core.IContainerManager;
+import org.eclipse.ecf.core.IContainerManagerListener;
+import org.eclipse.ecf.core.events.IContainerConnectedEvent;
+import org.eclipse.ecf.core.events.IContainerDisconnectedEvent;
+import org.eclipse.ecf.core.events.IContainerDisposeEvent;
+import org.eclipse.ecf.core.events.IContainerEvent;
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.start.IECFStart;
+import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.datashare.IChannelContainerAdapter;
+
+public class ECFStart implements IECFStart {
+
+ IContainerListener containerListener = new IContainerListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.core.IContainerListener#handleEvent(org.eclipse.ecf
+ * .core.events.IContainerEvent)
+ */
+ public void handleEvent(IContainerEvent event) {
+ final IContainerManager containerManager = (IContainerManager) ContainerFactory.getDefault();
+ if (containerManager == null)
+ return;
+ IContainer container = containerManager.getContainer(event.getLocalContainerID());
+ if (container == null)
+ return;
+ if (event instanceof IContainerConnectedEvent || event instanceof IContainerDisconnectedEvent) {
+ // connected
+ IChannelContainerAdapter cca = (IChannelContainerAdapter) container.getAdapter(IChannelContainerAdapter.class);
+ if (cca == null)
+ return;
+ ID containerID = container.getID();
+ if (event instanceof IContainerConnectedEvent) {
+ try {
+ TeamSynchronization.addShare(containerID, cca);
+ } catch (ECFException e) {
+ TeamSynchronization.log("RemoteShare could not be added or created", e); //$NON-NLS-1$
+ }
+ } else if (event instanceof IContainerDisconnectedEvent) {
+ // disconnected
+ TeamSynchronization.removeShare(containerID);
+ }
+ } else if (event instanceof IContainerDisposeEvent) {
+ containerManager.removeListener(containerManagerListener);
+ container.removeListener(containerListener);
+ }
+ }
+
+ };
+
+ IContainerManagerListener containerManagerListener = new IContainerManagerListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.core.IContainerManagerListener#containerAdded(org
+ * .eclipse.ecf.core.IContainer)
+ */
+ public void containerAdded(IContainer container) {
+ IChannelContainerAdapter cca = (IChannelContainerAdapter) container.getAdapter(IChannelContainerAdapter.class);
+ if (cca == null)
+ return;
+ container.addListener(containerListener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.core.IContainerManagerListener#containerRemoved(org
+ * .eclipse.ecf.core.IContainer)
+ */
+ public void containerRemoved(IContainer container) {
+ container.removeListener(containerListener);
+ }
+ };
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.ecf.core.start.IECFStart#run(org.eclipse.core.runtime.
+ * IProgressMonitor)
+ */
+ public IStatus run(IProgressMonitor monitor) {
+ final IContainerManager containerManager = (IContainerManager) ContainerFactory.getDefault();
+ containerManager.addListener(containerManagerListener);
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/RemoteShare.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/RemoteShare.java new file mode 100644 index 000000000..78fff36f1 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/RemoteShare.java @@ -0,0 +1,310 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Path; +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.util.ECFException; +import org.eclipse.ecf.datashare.AbstractShare; +import org.eclipse.ecf.datashare.IChannelContainerAdapter; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.internal.ecf.core.messages.FetchResponse; +import org.eclipse.team.internal.ecf.core.messages.FetchVariantRequest; +import org.eclipse.team.internal.ecf.core.messages.FetchVariantsRequest; +import org.eclipse.team.internal.ecf.core.messages.IResponse; +import org.eclipse.team.internal.ecf.core.messages.ShareRequest; +import org.eclipse.team.internal.ecf.core.messages.ShareResponse; +import org.eclipse.team.internal.ecf.core.variants.RemoteResourceVariant; + +public class RemoteShare extends AbstractShare { + + private Map participants = new HashMap(); + + private Object returnValue; + + RemoteShare(IChannelContainerAdapter adapter) throws ECFException { + super(adapter); + } + + public synchronized boolean sendShareRequest(ID localId, ID remoteId, IResource[] resources, IProgressMonitor monitor) throws ECFException, InterruptedException { + Assert.isNotNull(localId); + Assert.isNotNull(remoteId); + Assert.isNotNull(resources); + + sendMessage(remoteId, serialize(new ShareRequest(localId, resources))); + + while (returnValue == null) { + Thread.sleep(100); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } + + Object tmpValue = returnValue; + returnValue = null; + return ((Boolean) tmpValue).booleanValue(); + } + + public synchronized IResourceVariant[] fetchMembers(ID ownId, ID remoteId, IResourceVariant variant, IProgressMonitor monitor) throws TeamException { + RemoteResourceVariant remoteVariant = (RemoteResourceVariant) variant; + if (!remoteVariant.hasMembers()) { + // we've predetermined that this resource will not have any valid + // members, just return an empty array + return new IResourceVariant[0]; + } + + monitor.subTask("Fetching " + variant.getName()); + + sendMessage(remoteId, new FetchVariantsRequest(ownId, remoteVariant.getPath(), remoteVariant.getType())); + + while (returnValue == null) { + try { + Thread.sleep(100); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } catch (InterruptedException e) { + // TODO: do we want to handle this differently...? + Thread.interrupted(); + throw new TeamException("Interrupted whilst fetching members"); + } + } + monitor.done(); + + Object tmpValue = returnValue; + returnValue = null; + return (IResourceVariant[]) tmpValue; + } + + public synchronized IResourceVariant fetchVariant(ID ownId, ID remoteId, IResource resource, IProgressMonitor monitor) throws TeamException { + monitor.subTask("Fetching " + resource.getFullPath().toString().substring(1)); + + sendMessage(remoteId, new FetchVariantRequest(ownId, resource.getFullPath().toString(), resource.getType())); + + while (returnValue == null) { + try { + Thread.sleep(100); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } catch (InterruptedException e) { + // TODO: do we want to handle this differently...? + Thread.interrupted(); + throw new TeamException("Interrupted whilst fetching variant"); //$NON-NLS-1$ + } + } + monitor.done(); + + Object tmpValue = returnValue; + returnValue = null; + return ((IResourceVariant[]) tmpValue)[0]; + } + + public synchronized IResourceVariant getResourceVariant(ID ownId, ID remoteId, IResource resource) throws TeamException { + sendMessage(remoteId, new FetchVariantRequest(ownId, resource.getFullPath().toString(), resource.getType())); + + // FIXME: no progress monitor is available for this method, a timeout + // needs to be implemented at the preferences layer + while (returnValue == null) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // TODO: do we want to handle this differently...? + Thread.interrupted(); + throw new TeamException("Interrupted whilst getting variant"); //$NON-NLS-1$ + } + } + + Object tmpValue = returnValue; + returnValue = null; + return ((IResourceVariant[]) tmpValue)[0]; + } + + private void sendMessage(ID id, Serializable serializable) { + try { + sendMessage(id, serialize(serializable)); + } catch (ECFException e) { + TeamSynchronization.log("Could not send message to peer " + id, e); //$NON-NLS-1$ + } + } + + protected void handleMessage(ID fromContainerId, byte[] data) { + Object message = deserialize(data); + if (message instanceof FetchVariantsRequest) { + FetchVariantRequest msg = (FetchVariantRequest) message; + String path = msg.getPath(); + IContainer container = null; + + switch (msg.getType()) { + case IResource.FILE : + // this shouldn't happen as the fetch request should not have + // been sent for files in the first place + TeamSynchronization.log("Files should not have any variants to request for"); //$NON-NLS-1$ + break; + case IResource.PROJECT : + container = ResourcesPlugin.getWorkspace().getRoot().getProject(new Path(path).lastSegment()); + break; + case IResource.FOLDER : + container = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(path)); + break; + default : + TeamSynchronization.log("Unsupported resource type specified: " //$NON-NLS-1$ + + msg.getType()); + break; + } + + sendFetchVariantsResponse(msg.getFromId(), container); + } else if (message instanceof FetchVariantRequest) { + FetchVariantRequest msg = (FetchVariantRequest) message; + + IResource resource = null; + + IPath path = new Path(msg.getPath()); + switch (msg.getType()) { + case IResource.PROJECT : + resource = ResourcesPlugin.getWorkspace().getRoot().getProject(path.lastSegment()); + break; + case IResource.FOLDER : + resource = ResourcesPlugin.getWorkspace().getRoot().getFolder(path); + break; + case IResource.FILE : + resource = ResourcesPlugin.getWorkspace().getRoot().getFile(path); + break; + default : + TeamSynchronization.log("Unsupported resource type specified: " //$NON-NLS-1$ + + msg.getType()); + break; + } + + sendFetchVariantResponse(msg.getFromId(), resource); + } else if (message instanceof ShareRequest) { + ShareRequest request = (ShareRequest) message; + String[] paths = request.getPaths(); + int[] types = request.getTypes(); + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + boolean response = false; + + resourceLoop: for (int i = 0; i < paths.length; i++) { + switch (types[i]) { + case IResource.PROJECT : + if (workspaceRoot.getProject(new Path(paths[i]).lastSegment()).exists()) { + response = true; + break resourceLoop; + } + break; + case IResource.FOLDER : + if (workspaceRoot.getFolder(new Path(paths[i])).exists()) { + response = true; + break resourceLoop; + } + break; + case IResource.FILE : + if (workspaceRoot.getFile(new Path(paths[i])).exists()) { + response = true; + break resourceLoop; + } + break; + } + } + + sendMessage(request.getFromId(), new ShareResponse(response)); + } else if (message instanceof IResponse) { + returnValue = ((IResponse) message).getResponse(); + } + } + + private void sendFetchVariantsResponse(ID fromId, IContainer container) { + // the container will be null if an invalid resource type was provided + if (container == null) { + sendMessage(fromId, new FetchResponse()); + return; + } + + try { + IResource[] members = container.members(); + List variants = new ArrayList(); + + for (int i = 0; i < members.length; i++) { + if (!members[i].isDerived()) { + variants.add(new RemoteResourceVariant(members[i])); + } + } + IResourceVariant[] variantsArray = (IResourceVariant[]) variants.toArray(new IResourceVariant[variants.size()]); + sendMessage(fromId, new FetchResponse(variantsArray)); + } catch (CoreException e) { + TeamSynchronization.log("Could not retrieve container members: " //$NON-NLS-1$ + + container.getFullPath(), e); + } + } + + private void sendFetchVariantResponse(ID fromId, IResource resource) { + // resource will be null if an invalid resource type was provided + if (resource != null && resource.exists()) { + sendMessage(fromId, new FetchResponse(new RemoteResourceVariant(resource))); + } else { + sendMessage(fromId, new FetchResponse((IResourceVariant) null)); + } + } + + public synchronized void dispose() { + participants.clear(); + super.dispose(); + } + + private static Object deserialize(byte[] data) { + try { + ByteArrayInputStream bais = new ByteArrayInputStream(data); + ObjectInputStream inputStream = new ObjectInputStream(bais); + return inputStream.readObject(); + } catch (IOException e) { + TeamSynchronization.log("Could not read deserialize data", e); //$NON-NLS-1$ + return null; + } catch (ClassNotFoundException e) { + TeamSynchronization.log("Could not find class for deserialization", //$NON-NLS-1$ + e); + return null; + } + } + + private static byte[] serialize(Serializable serializable) { + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream outputStream = new ObjectOutputStream(baos); + outputStream.writeObject(serializable); + return baos.toByteArray(); + } catch (IOException e) { + TeamSynchronization.log("Could not read serialize object", e); //$NON-NLS-1$ + return null; + } + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/RemoteSyncInfo.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/RemoteSyncInfo.java new file mode 100644 index 000000000..e081ee74c --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/RemoteSyncInfo.java @@ -0,0 +1,51 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core; + +import org.eclipse.core.resources.IResource; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.synchronize.SyncInfo; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.core.variants.IResourceVariantComparator; + +public final class RemoteSyncInfo extends SyncInfo { + + private final IResource local; + private final IResourceVariant remote; + + public RemoteSyncInfo(IResource local, IResourceVariant remote, IResourceVariantComparator comparator) { + super(local, null, remote, comparator); + this.local = local; + this.remote = remote; + } + + protected int calculateKind() throws TeamException { + if (remote == null && !local.exists()) { + // this fails in super.calculateKind(), caused after a resource that + // exists locally but not remotely has been synchronized (as in, + // deleted locally), the key probably lies in the tree's + // isSupervised(IResource) implementation + return IN_SYNC; + } + + int kind = super.calculateKind(); + switch (kind) { + case ADDITION : + kind |= (kind & ~DIRECTION_MASK) | INCOMING; + break; + case DELETION : + kind |= (kind & ~DIRECTION_MASK) | OUTGOING; + break; + } + return kind; + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/TeamSynchronization.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/TeamSynchronization.java new file mode 100644 index 000000000..617b2aa7c --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/TeamSynchronization.java @@ -0,0 +1,116 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.ecf.core.util.ECFException; +import org.eclipse.ecf.datashare.IChannelContainerAdapter; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class TeamSynchronization extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.ecf.sync.team"; //$NON-NLS-1$ + + // The shared instance + private static TeamSynchronization plugin; + + private static Map channels = new HashMap(); + + public static void addShare(ID containerId, IChannelContainerAdapter channelContainer) throws ECFException { + if (!channels.containsKey(containerId)) { + channels.put(containerId, new RemoteShare(channelContainer)); + } + } + + public static RemoteShare getShare(ID containerId) { + return (RemoteShare) channels.get(containerId); + } + + public static void removeShare(ID containerId) { + channels.remove(containerId); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static TeamSynchronization getDefault() { + return plugin; + } + + public static byte[] readFile(IFile file) { + try { + if (file.exists()) { + InputStream contents = file.getContents(); + byte[] bytes = new byte[contents.available()]; + contents.read(bytes); + return bytes; + } + } catch (IOException e) { + TeamSynchronization.log("Could not read file content: " //$NON-NLS-1$ + + file.getFullPath(), e); + } catch (CoreException e) { + TeamSynchronization.log("Could not retrieve file content: " //$NON-NLS-1$ + + file.getFullPath(), e); + } + return null; + } + + public static void log(String message) { + log(message, null); + } + + public static void log(String message, Throwable throwable) { + log(new Status(IStatus.ERROR, PLUGIN_ID, message, throwable)); + } + + public static void log(IStatus status) { + getDefault().getLog().log(status); + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchResponse.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchResponse.java new file mode 100644 index 000000000..11eb8204f --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchResponse.java @@ -0,0 +1,37 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.messages; + +import org.eclipse.team.core.variants.IResourceVariant; + +public final class FetchResponse implements IResponse { + + private static final long serialVersionUID = -3291936095528478752L; + + private final IResourceVariant[] variants; + + public FetchResponse() { + this(new IResourceVariant[0]); + } + + public FetchResponse(IResourceVariant variant) { + this(new IResourceVariant[] {variant}); + } + + public FetchResponse(IResourceVariant[] variants) { + this.variants = variants; + } + + public Object getResponse() { + return variants; + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchVariantRequest.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchVariantRequest.java new file mode 100644 index 000000000..e1bbc6515 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchVariantRequest.java @@ -0,0 +1,55 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.messages; + +import java.io.Serializable; + +import org.eclipse.ecf.core.identity.ID; + +public class FetchVariantRequest implements Serializable { + + private static final long serialVersionUID = -1617853402478189227L; + + private final ID fromId; + + private final String path; + + private final int type; + + public FetchVariantRequest(ID fromId, String path, int type) { + this.fromId = fromId; + this.path = path; + this.type = type; + } + + public ID getFromId() { + return fromId; + } + + public int getType() { + return type; + } + + public String getPath() { + return path; + } + + public String toString() { + StringBuffer buffer = new StringBuffer("FetchVariantRequest["); //$NON-NLS-1$ + synchronized (buffer) { + buffer.append("id=").append(fromId); //$NON-NLS-1$ + buffer.append(";path=").append(path); //$NON-NLS-1$ + buffer.append(";type=").append(type).append(']'); //$NON-NLS-1$ + return buffer.toString(); + } + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchVariantsRequest.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchVariantsRequest.java new file mode 100644 index 000000000..21996f356 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/FetchVariantsRequest.java @@ -0,0 +1,23 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.messages; + +import org.eclipse.ecf.core.identity.ID; + +public class FetchVariantsRequest extends FetchVariantRequest { + + private static final long serialVersionUID = -5776703885952265394L; + + public FetchVariantsRequest(ID fromId, String path, int type) { + super(fromId, path, type); + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/IResponse.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/IResponse.java new file mode 100644 index 000000000..0ce9c5da5 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/IResponse.java @@ -0,0 +1,19 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.messages; + +import java.io.Serializable; + +public interface IResponse extends Serializable { + + public Object getResponse(); + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/ShareRequest.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/ShareRequest.java new file mode 100644 index 000000000..b32aff3ae --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/ShareRequest.java @@ -0,0 +1,52 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.messages; + +import java.io.Serializable; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.Assert; +import org.eclipse.ecf.core.identity.ID; + +public class ShareRequest implements Serializable { + + private static final long serialVersionUID = 1260108598712425345L; + + private final ID fromId; + private final String[] paths; + private final int[] types; + + public ShareRequest(ID fromId, IResource[] resources) { + this.fromId = fromId; + + paths = new String[resources.length]; + types = new int[resources.length]; + + for (int i = 0; i < resources.length; i++) { + Assert.isNotNull(resources[i]); + paths[i] = resources[i].getFullPath().toString(); + types[i] = resources[i].getType(); + } + } + + public ID getFromId() { + return fromId; + } + + public String[] getPaths() { + return paths; + } + + public int[] getTypes() { + return types; + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/ShareResponse.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/ShareResponse.java new file mode 100644 index 000000000..644a1db97 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/messages/ShareResponse.java @@ -0,0 +1,31 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.messages; + +public class ShareResponse implements IResponse { + + private static final long serialVersionUID = -7783203563333880201L; + + private final boolean ok; + + public ShareResponse(boolean ok) { + this.ok = ok; + } + + public Object getResponse() { + return ok ? Boolean.TRUE : Boolean.FALSE; + } + + public String toString() { + return "ShareResponse[ok=" + ok + ']'; //$NON-NLS-1$ + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariant.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariant.java new file mode 100644 index 000000000..7fcc125ef --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariant.java @@ -0,0 +1,121 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.variants; + +import java.io.Serializable; +import java.util.Date; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IStorage; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.internal.ecf.core.TeamSynchronization; + +public class RemoteResourceVariant implements IResourceVariant, Serializable { + + private static final long serialVersionUID = 2103652156613434181L; + + private final String name; + private final String path; + private final int type; + private final long timeStamp; + private final boolean hasMembers; + private byte[] bytes; + private IStorage storage; + + public RemoteResourceVariant(IResource resource) { + name = resource.getName(); + path = resource.getFullPath().toString(); + type = resource.getType(); + timeStamp = resource.getLocalTimeStamp(); + + Assert.isLegal(type == IResource.FILE || type == IResource.FOLDER || type == IResource.PROJECT, "Invalid resource type specified: " + type); //$NON-NLS-1$ + + if (type == IResource.FILE) { + hasMembers = false; + IFile file = (IFile) resource; + + bytes = TeamSynchronization.readFile(file); + if (bytes != null) { + try { + storage = new RemoteStorage(path, file.getCharset(), bytes); + } catch (CoreException e) { + TeamSynchronization.log("Could not retrieve file charset", //$NON-NLS-1$ + e); + } + } + } else { + boolean temp = false; + try { + if (resource.exists()) { + IResource[] members = ((IContainer) resource).members(); + // we are only interested in members that are not derived + for (int i = 0; i < members.length; i++) { + if (!members[i].isDerived()) { + temp = true; + break; + } + } + } + } catch (CoreException e) { + // ignored as this shouldn't happen + } + + hasMembers = temp; + } + + if (bytes == null) { + bytes = getContentIdentifier().getBytes(); + } + } + + public byte[] asBytes() { + return bytes; + } + + public String getContentIdentifier() { + return new Date(timeStamp).toString(); + } + + public String getName() { + return name; + } + + public String getPath() { + return path; + } + + public IStorage getStorage(IProgressMonitor monitor) throws TeamException { + return storage; + } + + public boolean isContainer() { + return type != IResource.FILE; + } + + public boolean hasMembers() { + return hasMembers; + } + + public int getType() { + return type; + } + + public String toString() { + return path; + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantComparator.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantComparator.java new file mode 100644 index 000000000..4568b4174 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantComparator.java @@ -0,0 +1,57 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.variants; + +import java.util.Arrays; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.core.variants.IResourceVariantComparator; +import org.eclipse.team.internal.ecf.core.TeamSynchronization; + +class RemoteResourceVariantComparator implements IResourceVariantComparator { + + public boolean compare(IResource local, IResourceVariant remote) { + RemoteResourceVariant remoteVariant = (RemoteResourceVariant) remote; + int localType = local.getType(); + int remoteType = remoteVariant.getType(); + if (localType != remoteType) { + return false; + } + + if (localType != IResource.FILE && remoteType != IResource.FILE) { + return local.getFullPath().toString().equals(remoteVariant.getPath()); + } + + if (localType == IResource.FILE && remote.isContainer()) { + return false; + } + + if (local instanceof IFile) { + IFile file = (IFile) local; + byte[] localBytes = TeamSynchronization.readFile(file); + byte[] remoteBytes = remote.asBytes(); + + return Arrays.equals(localBytes, remoteBytes); + } + return false; + } + + public boolean compare(IResourceVariant base, IResourceVariant remote) { + return true; + } + + public boolean isThreeWay() { + return false; + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantTree.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantTree.java new file mode 100644 index 000000000..f96554360 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantTree.java @@ -0,0 +1,91 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.variants; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.variants.AbstractResourceVariantTree; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.internal.ecf.core.RemoteShare; + +final class RemoteResourceVariantTree extends AbstractResourceVariantTree { + + private final RemoteShare share; + private final ID ownId; + private final ID remoteId; + + private IResource[] roots; + + public RemoteResourceVariantTree(RemoteShare share, ID ownId, ID remoteId) { + this.share = share; + this.ownId = ownId; + this.remoteId = remoteId; + } + + public void setResources(IResource[] roots) { + this.roots = roots; + } + + protected IResourceVariant[] fetchMembers(IResourceVariant variant, IProgressMonitor monitor) throws TeamException { + return share.fetchMembers(ownId, remoteId, variant, monitor); + } + + protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { + return share.fetchVariant(ownId, remoteId, resource, monitor); + } + + protected boolean setVariant(IResource local, IResourceVariant remote) throws TeamException { + return true; + } + + public void flushVariants(IResource resource, int depth) throws TeamException { + // does not appear to be called by the Team APIs + } + + public IResourceVariant getResourceVariant(IResource resource) throws TeamException { + return share.getResourceVariant(ownId, remoteId, resource); + } + + public boolean hasResourceVariant(IResource resource) throws TeamException { + return true; + } + + public IResource[] members(IResource resource) throws TeamException { + if (resource.getType() == IResource.FILE || !resource.exists()) { + return new IResource[0]; + } else { + try { + IResource[] members = ((IContainer) resource).members(); + List nonDerivedMembers = new ArrayList(members.length); + for (int i = 0; i < members.length; i++) { + if (!members[i].isDerived()) { + nonDerivedMembers.add(members[i]); + } + } + return (IResource[]) nonDerivedMembers.toArray(new IResource[nonDerivedMembers.size()]); + } catch (CoreException e) { + throw new TeamException(e.getStatus()); + } + } + } + + public IResource[] roots() { + return roots == null ? new IResource[0] : roots; + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantTreeSubscriber.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantTreeSubscriber.java new file mode 100644 index 000000000..520b196d3 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteResourceVariantTreeSubscriber.java @@ -0,0 +1,80 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.variants; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.ecf.core.identity.ID; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.core.synchronize.SyncInfo; +import org.eclipse.team.core.variants.IResourceVariant; +import org.eclipse.team.core.variants.IResourceVariantComparator; +import org.eclipse.team.core.variants.IResourceVariantTree; +import org.eclipse.team.core.variants.ResourceVariantTreeSubscriber; +import org.eclipse.team.internal.ecf.core.RemoteShare; +import org.eclipse.team.internal.ecf.core.RemoteSyncInfo; + +public class RemoteResourceVariantTreeSubscriber extends ResourceVariantTreeSubscriber { + + private RemoteResourceVariantTree remoteTree; + + private IResource[] resources; + + private RemoteResourceVariantComparator comparator = new RemoteResourceVariantComparator(); + + public RemoteResourceVariantTreeSubscriber(RemoteShare share, ID ownId, ID remoteId) { + remoteTree = new RemoteResourceVariantTree(share, ownId, remoteId); + } + + public void setResources(IResource[] resources) { + this.resources = resources; + + remoteTree.setResources(resources); + } + + protected IResourceVariantTree getBaseTree() { + // no base + return null; + } + + protected IResourceVariantTree getRemoteTree() { + return remoteTree; + } + + public String getName() { + //FIXME: return a proper name :) + return "getName();"; + } + + public IResourceVariantComparator getResourceComparator() { + return comparator; + } + + public SyncInfo getSyncInfo(IResource local, IProgressMonitor monitor) throws TeamException { + IResourceVariant remote = remoteTree.fetchVariant(local, IResource.DEPTH_ZERO, monitor); + return getSyncInfo(local, null, remote); + } + + protected SyncInfo getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote) throws TeamException { + SyncInfo info = new RemoteSyncInfo(local, remote, comparator); + info.init(); + return info; + } + + public boolean isSupervised(IResource resource) throws TeamException { + return true; + } + + public IResource[] roots() { + return resources == null ? new IResource[0] : resources; + } + +} diff --git a/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteStorage.java b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteStorage.java new file mode 100644 index 000000000..6b4e4f893 --- /dev/null +++ b/framework/bundles/org.eclipse.team.ecf.core/src/org/eclipse/team/internal/ecf/core/variants/RemoteStorage.java @@ -0,0 +1,65 @@ +/****************************************************************************** + * Copyright (c) 2008 Versant Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Remy Chi Jian Suen (Versant Corporation) - initial API and implementation + ******************************************************************************/ +package org.eclipse.team.internal.ecf.core.variants; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.Serializable; + +import org.eclipse.core.resources.IEncodedStorage; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; + +final class RemoteStorage implements IEncodedStorage, Serializable { + + private static final long serialVersionUID = -4773139009062649259L; + + private final String path; + private final String charset; + private final byte[] bytes; + + RemoteStorage(String path, String charset, byte[] bytes) { + this.path = path; + this.charset = charset; + this.bytes = bytes; + } + + public String getCharset() throws CoreException { + return charset; + } + + public InputStream getContents() { + return new ByteArrayInputStream(bytes); + } + + public IPath getFullPath() { + return new Path(path); + } + + public String getName() { + return new Path(path).lastSegment(); + } + + public boolean isReadOnly() { + return true; + } + + public Object getAdapter(Class adapter) { + return Platform.getAdapterManager().getAdapter(this, adapter); + } + + public String toString() { + return "RemoteStorage[path=" + path + ']'; //$NON-NLS-1$ + } + +} |