diff options
author | Markus Schorn | 2015-04-24 08:32:56 +0000 |
---|---|---|
committer | Uwe Stieber | 2015-04-27 06:19:48 +0000 |
commit | d0afe3bdb9d7f85bcc9b2bd55288b749fb1cb4a0 (patch) | |
tree | 662a05dc51ecad30df22cd1cbf3dd46c10fd9f11 | |
parent | cfa8c3b4d3b6f0815b4e8dc73d16dfbbafc10e28 (diff) | |
download | org.eclipse.tcf-1.3_WR_20150508_4.1.0_bugfix.tar.gz org.eclipse.tcf-1.3_WR_20150508_4.1.0_bugfix.tar.xz org.eclipse.tcf-1.3_WR_20150508_4.1.0_bugfix.zip |
Bug 465093 - Replace incomplete dnd with a 'Download' action.1.3_WR_20150508_4.1.01.3_WR_20150508_4.1.0_bugfix
Change-Id: I345d5559f8492271a60dec064f626d03cb0a67ad
Signed-off-by: Markus Schorn <markus.schorn@windriver.com>
45 files changed, 1680 insertions, 1190 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java index 63c5c30d3..81e450bf1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.launch.ui/src/org/eclipse/tcf/te/launch/ui/internal/properties/FileTransferPropertiesSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2012, 2015 Wind River Systems, 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 @@ -63,7 +63,7 @@ public class FileTransferPropertiesSection extends BaseTitledSection { return (((IFileTransferItem)element).getDirection() == IFileTransferItem.TARGET_TO_HOST ? Messages.FileTransferSection_toHost_text : Messages.FileTransferSection_toTarget_text); case 2: - return ((IFileTransferItem)element).getTargetPath().toPortableString(); + return ((IFileTransferItem)element).getTargetPathString(); case 3: return ((IFileTransferItem)element).getOptions(); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/.settings/org.eclipse.jdt.core.prefs index 938113232..6af9f5dc9 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/.settings/org.eclipse.jdt.core.prefs +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/.settings/org.eclipse.jdt.core.prefs @@ -1,362 +1,379 @@ -#Fri Oct 07 16:13:47 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.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=enabled
-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=warning
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-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=enabled
-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=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-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.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
-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.specialParameterHidingField=disabled
-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.syntheticAccessEmulation=warning
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-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=ignore
-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=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=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-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=true
-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=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=100
-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=4
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=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=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=100
-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=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+eclipse.preferences.version=1 +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=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.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=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +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=warning +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=enabled +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=error +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=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +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=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +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.specialParameterHidingField=disabled +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=disabled +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.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=ignore +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=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=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0 +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=true +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=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +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=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=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=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true +org.eclipse.jdt.core.formatter.lineSplit=100 +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=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java index 918978d12..ae015645d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/filetransfer/FileTransferItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2012, 2015 Wind River Systems, 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 @@ -35,12 +35,32 @@ public class FileTransferItem extends PropertiesContainer implements IFileTransf setProperty(PROPERTY_ENABLED, enabled); } - public FileTransferItem(IPath fromHost, IPath toTarget) { + /** + * @deprecated use {@link FileTransferItem#FileTransferItem(IPath, String)}, instead. + */ + @Deprecated + public FileTransferItem(IPath fromHost, IPath toTarget) { this(); if (fromHost != null) setProperty(PROPERTY_HOST, fromHost.toPortableString()); - if (toTarget != null) + if (toTarget != null) { setProperty(PROPERTY_TARGET, toTarget.toPortableString()); + setProperty(PROPERTY_TARGET_STRING, toTarget.toString()); + } + } + + public FileTransferItem(IPath fromHost, String toTarget) { + this(); + if (fromHost != null) + setProperty(PROPERTY_HOST, fromHost.toPortableString()); + if (toTarget != null) { + // Replace multiple slashes with a single slash + toTarget = toTarget.replaceAll("/+", "/"); //$NON-NLS-1$ //$NON-NLS-2$ + // Remove trailing slash + if (toTarget.endsWith("/") && toTarget.length() > 1) //$NON-NLS-1$ + toTarget = toTarget.substring(0, toTarget.length()-1); + setProperty(PROPERTY_TARGET_STRING, toTarget); + } } /* (non-Javadoc) @@ -62,9 +82,21 @@ public class FileTransferItem extends PropertiesContainer implements IFileTransf /* (non-Javadoc) * @see org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IFileTransferItem#getTargetPath() */ - @Override + @Deprecated + @Override public IPath getTargetPath() { - return getStringProperty(PROPERTY_TARGET) != null ? new Path(getStringProperty(PROPERTY_TARGET)) : null; + if (getStringProperty(PROPERTY_TARGET) != null) { + return new Path(getStringProperty(PROPERTY_TARGET)); + } + if (getStringProperty(PROPERTY_TARGET_STRING) != null) { + return new Path(getStringProperty(PROPERTY_TARGET_STRING)); + } + return null; + } + + @Override + public String getTargetPathString() { + return getStringProperty(PROPERTY_TARGET_STRING); } /* (non-Javadoc) @@ -90,7 +122,7 @@ public class FileTransferItem extends PropertiesContainer implements IFileTransf @Override public int hashCode() { int hc = getHostPath() != null ? getHostPath().hashCode() : 0; - hc = hc << 8 + (getTargetPath() != null ? getTargetPath().hashCode() : 0); + hc = hc << 8 + (getTargetPathString() != null ? getTargetPathString().hashCode() : 0); hc = hc << 8 + getDirection(); return hc; } @@ -103,7 +135,7 @@ public class FileTransferItem extends PropertiesContainer implements IFileTransf boolean equals = super.equals(obj); if (!equals && obj instanceof IFileTransferItem) { boolean hostPathEqual = getHostPath() != null ? getHostPath().equals(((IFileTransferItem)obj).getHostPath()) : ((IFileTransferItem)obj).getHostPath() == null; - boolean targetPathEqual = getTargetPath() != null ? getTargetPath().equals(((IFileTransferItem)obj).getTargetPath()) : ((IFileTransferItem)obj).getTargetPath() == null; + boolean targetPathEqual = getTargetPathString() != null ? getTargetPathString().equals(((IFileTransferItem)obj).getTargetPathString()) : ((IFileTransferItem)obj).getTargetPathString() == null; boolean directionEqual = getDirection() == ((IFileTransferItem)obj).getDirection(); return hostPathEqual && targetPathEqual && directionEqual; } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/filetransfer/IFileTransferItem.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/filetransfer/IFileTransferItem.java index 57717935b..83cfb17d2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/filetransfer/IFileTransferItem.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.services/src/org/eclipse/tcf/te/runtime/services/interfaces/filetransfer/IFileTransferItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2012, 2015 Wind River Systems, 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 @@ -21,7 +21,12 @@ public interface IFileTransferItem extends IPropertiesContainer { public static final String PROPERTY_ENABLED = "enabled"; //$NON-NLS-1$ public static final String PROPERTY_DIRECTION = "direction"; //$NON-NLS-1$ public static final String PROPERTY_HOST = "host"; //$NON-NLS-1$ - public static final String PROPERTY_TARGET = "target"; //$NON-NLS-1$ + /** + * @deprecated use {@value #PROPERTY_TARGET_STRING}, instead + */ + @Deprecated + public static final String PROPERTY_TARGET = "target"; //$NON-NLS-1$ + public static final String PROPERTY_TARGET_STRING = "target-string"; //$NON-NLS-1$ public static final String PROPERTY_OPTIONS = "options"; //$NON-NLS-1$ public static final int HOST_TO_TARGET = 1; @@ -40,13 +45,18 @@ public interface IFileTransferItem extends IPropertiesContainer { public IPath getHostPath(); /** - * Return the target (remote) path. Must not be <code>null</code>. - * The target path needs to be a file for transfer from target to host. - * For a transfer from host to target, the path can be a file or directory. + * @deprecated use {@link #getTargetPathString()}, instead */ + @Deprecated public IPath getTargetPath(); /** + * Returns the target path. Cannot use IPath, because the target path may use ':' for + * the first segment. E.g.: '/sd0:1/file.txt + */ + public String getTargetPathString(); + + /** * Return the transfer direction. */ public int getDirection(); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/CallbackMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/CallbackMonitor.java index d59b11d75..9484f447e 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/CallbackMonitor.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/CallbackMonitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2011, 2015 Wind River Systems, 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 @@ -27,9 +27,9 @@ import org.eclipse.tcf.te.tcf.core.nls.Messages; /** * A helper class used to synchronize multiple threads. It is used * to join multiple threads which collaborate to create the pre-condition - * of the callback code. + * of the callback code. * <p> - * A callback monitor maintains a map containing a set of locks. + * A callback monitor maintains a map containing a set of locks. * The collaborating threads should unlock one of its own lock in * it and wake up the callback if all the locks in the map is opened. * <p> @@ -84,8 +84,8 @@ import org.eclipse.tcf.te.tcf.core.nls.Messages; * in the method will be invoked and do the thing which requires to be done * after the end of these threads. * <p> - * <b>Note:</b><em>The threads which require collaboration on the callback - * monitor should be started only after all the locks corresponding to them + * <b>Note:</b><em>The threads which require collaboration on the callback + * monitor should be started only after all the locks corresponding to them * are added. </em> * <p> * For example, the above threads are started after the monitor locks all the threads: @@ -103,20 +103,20 @@ public class CallbackMonitor { private ICallback callback; // The lock map containing the keys and the corresponding running results. private Map<Object, IStatus> locks; - + /** * Create a callback monitor with the specified callback with a default timeout. - * + * * @param callback The callback to be invoked after all the locks being unlocked. */ public CallbackMonitor(ICallback callback) { this(callback, DEFAULT_TIMEOUT); } - + /** * Create a callback monitor with the specified callback with a timeout. If * the timeout is zero, then it will block forever until all locks are released. - * + * * @param callback The callback to be invoked after all the locks being unlocked. * @param timeout The timeout value. */ @@ -128,23 +128,22 @@ public class CallbackMonitor { new Timer().schedule(new MonitorTask(callback, timeout), timeout, timeout); } } - + /** * Create a callback monitor with the specified callback and the keys with a default * timeout. - * + * * @param callback The callback to be invoked after all the locks being unlocked. * @param keys The keys to lock and unlock the locks. - * @param timeout The timeout value. */ public CallbackMonitor(ICallback callback, Object...keys) { this(callback, DEFAULT_TIMEOUT, keys); } - + /** * Create a callback monitor with the specified callback and the keys and a timeout. If * the timeout is zero, then it will block forever until all locks are released. - * + * * @param callback The callback to be invoked after all the locks being unlocked. * @param keys The keys to lock and unlock the locks. * @param timeout The timeout value. @@ -161,7 +160,7 @@ public class CallbackMonitor { /** * Add multiple locks with the specified keys. - * + * * @param keys The keys whose locks are added. */ public void lock(Object... keys) { @@ -170,10 +169,10 @@ public class CallbackMonitor { this.locks.put(key, null); } } - + /** * Add a lock with the specified key. - * + * * @param key The key whose lock is added. */ public void lock(Object key) { @@ -182,10 +181,10 @@ public class CallbackMonitor { } /** - * Unlock the lock with the specified key and status - * check if all the locks have been unlocked. If all the + * Unlock the lock with the specified key and status + * check if all the locks have been unlocked. If all the * locks have been unlocked, then invoke the callback. - * + * * @param key The key to unlock its lock. */ public void unlock(Object key, IStatus status) { @@ -202,7 +201,7 @@ public class CallbackMonitor { /** * Check if all the locks are unlocked and return a running status. - * + * * @return a MultiStatus object describing running result or null if not completed yet. */ private synchronized IStatus getCurrentStatus() { @@ -214,7 +213,7 @@ public class CallbackMonitor { list.add(status); } } - IStatus[] children = list.toArray(new IStatus[list.size()]); + IStatus[] children = list.toArray(new IStatus[list.size()]); return new MultiStatus(CoreBundleActivator.getUniqueIdentifier(), 0, children, Messages.CallbackMonitor_AllTasksFinished, null); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/Rendezvous.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/Rendezvous.java index 6f7981714..be8e33eeb 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/Rendezvous.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/Rendezvous.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2011, 2015 Wind River Systems, 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 @@ -19,14 +19,14 @@ import java.util.concurrent.TimeoutException; * <p> * The following is an example: * <p> - * + * * <pre> - * final Rendezvous rendezvous = new Rendezvous(); - * service.open(path, IFileSystem.TCF_O_READ, null, new DoneOpen() { + * final Rendezvous rendezvous = new Rendezvous(); + * service.open(path, IFileSystem.TCF_O_READ, null, new DoneOpen() { * public void doneOpen(IToken token, FileSystemException error, IFileHandle hdl) { * ... - * rendezvous.arrive(); - * } + * rendezvous.arrive(); + * } * }); * try{ * renderzvous.waiting(1000); //Waiting for 1 second. @@ -35,20 +35,20 @@ import java.util.concurrent.TimeoutException; * ... * } * </pre> - * + * * The call renderzvous.waiting(1000) won't return until renderzvous.arrive() is * called in the doneOpen(), or the waiting has timed out. * <p> * A rendezvous can be reused once it is reset: * <p> - * + * * <pre> - * renderzvous.reset(); - * service.open(path, IFileSystem.TCF_O_READ, null, new DoneOpen() { + * renderzvous.reset(); + * service.open(path, IFileSystem.TCF_O_READ, null, new DoneOpen() { * public void doneOpen(IToken token, FileSystemException error, IFileHandle hdl) { * ... - * rendezvous.arrive(); - * } + * rendezvous.arrive(); + * } * }); * try{ * renderzvous.waiting(2000); //Waiting for 2 seconds. @@ -57,7 +57,7 @@ import java.util.concurrent.TimeoutException; * ... * } * </pre> - * + * */ public class Rendezvous { // Flag indicating if the other thread has arrived. @@ -74,7 +74,7 @@ public class Rendezvous { /** * Called to block the current thread until it is woken up by * another thread or until it is timed out. - * + * * @param timeout The timeout time. * @throws TimeoutException The waiting has timed out. */ @@ -89,12 +89,10 @@ public class Rendezvous { if (!arrived) throw new TimeoutException(); } - + /** - * Called to block the current thread until it is woken up by another - * thread. - * - * @throws InterruptedException The waiting has timed out. + * Called to block the current thread until it is woken up by another + * thread. */ public synchronized void waiting() throws TimeoutException { waiting(0); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/TCFOperationMonitor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/TCFOperationMonitor.java new file mode 100644 index 000000000..4be3efc09 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/concurrent/TCFOperationMonitor.java @@ -0,0 +1,193 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Markus Schorn - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.core.concurrent; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator; + +/** + * Utility class that governs the execution of an asynchronous operation. The class is agnostic on how + * the operation is actually carried out. + */ +public class TCFOperationMonitor<T> { + private static final long UNRESPONSIVE_TIMEOUT = 60*1000; + + private IStatus fStatus; + private T fValue; + private long fCheckedTime; + private boolean fPropagateCancel; + + private List<IProgressMonitor> fProgressMonitors = new ArrayList<IProgressMonitor>(); + + /** + * Create a new operation monitor. + */ + public TCFOperationMonitor() { + this(true); + } + + /** + * @param propagateProgressMonitorCancel whether to cancel the operation when all the progress monitors + * of the waiting callers are canceled. + * @see #waitDone(IProgressMonitor) + * @see #waitDone(IProgressMonitor, long) + * @see #waitDone(IProgressMonitor, long, long) + */ + public TCFOperationMonitor(boolean propagateProgressMonitorCancel) { + fPropagateCancel = propagateProgressMonitorCancel; + fCheckedTime = System.currentTimeMillis(); + } + + /** + * Wait for the operation to finish, using default timeouts. + */ + public IStatus waitDone(IProgressMonitor monitor) { + return waitDone(monitor, Long.MAX_VALUE, UNRESPONSIVE_TIMEOUT); + } + + /** + * Wait for the operation to finish, using the specified timeout. + * @param timeoutms maximum time to wait for the result to be set. When this timeout expires + * {@link Status#CANCEL_STATUS} is returned. + */ + public IStatus waitDone(IProgressMonitor monitor, long timeoutms) { + return waitDone(monitor, timeoutms, UNRESPONSIVE_TIMEOUT); + } + + /** + * Wait for the operation to finish, using the specified timeouts. + * @param timeoutms maximum time to wait for the result to be set. When this timeout expires + * {@link Status#CANCEL_STATUS} is returned. + * @param unresponsiveTimeoutms maximum time the executing task is allowed not to check for + * cancellation. When this timeout expires {@link Status#CANCEL_STATUS} is returned. + */ + public synchronized IStatus waitDone(IProgressMonitor monitor, long timeoutms, long unresponsiveTimeoutms) { + if (monitor == null) + monitor = new NullProgressMonitor(); + + fProgressMonitors.add(monitor); + try { + long startTime = System.currentTimeMillis(); + while (true) { + if (fStatus != null) { + return fStatus; + } + + if (monitor.isCanceled()) { + return cancelWait(monitor); + } + + long time = System.currentTimeMillis(); + if (time - startTime > timeoutms || time - fCheckedTime > unresponsiveTimeoutms) { + return cancelWait(monitor); + } + + try { + wait(100); + } catch (InterruptedException e) { + return cancelWait(monitor); + } + } + } finally { + fProgressMonitors.remove(monitor); + } + } + + private IStatus cancelWait(IProgressMonitor monitor) { + if (fPropagateCancel && fProgressMonitors.size() == 1) { + fStatus = Status.CANCEL_STATUS; + } + + return Status.CANCEL_STATUS; + } + + /** + * Returns the status of the operation, or <code>null</code> when the operation is still in progress. + */ + public IStatus getStatus() { + return fStatus; + } + + /** + * Returns the value of this result object, or <code>null</code> when it was not set. + */ + public T getValue() { + return fValue; + } + + /** + * Return whether a thread is waiting for the completion of the operation. + */ + public synchronized boolean hasWaiters() { + return !fProgressMonitors.isEmpty(); + } + + /** + * Method for reporting the completion of the operation. + */ + public synchronized IStatus setDone(IStatus status, T result) { + if (fStatus == null) { + fStatus = status; + fValue = result; + notifyAll(); + } + return fStatus; + } + + /** + * Method for reporting the successful completion of the operation. + */ + public IStatus setDone(T result) { + return setDone(Status.OK_STATUS, result); + } + + /** + * Method for reporting the completion of the operation with an error. + */ + public IStatus setError(String msg, Throwable th) { + return setDone(createStatus(msg, th), null); + } + + private IStatus createStatus(String msg, Throwable th) { + if (th != null) { + String msg2= th.getLocalizedMessage(); + if (msg2 != null) { + msg = msg == null ? msg2 : msg + ": " + msg2; //$NON-NLS-1$ + } + } + return new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), msg, th); + } + + /** + * Method for reporting cancellation of the operation. + */ + public IStatus setCancelled() { + return setDone(Status.CANCEL_STATUS, null); + } + + /** + * Method for checking whether the operation has been cancelled. Calling this method indicates + * that the operation is still responsive. + */ + public synchronized boolean checkCancelled() { + if (fStatus != null) { + return true; + } + fCheckedTime = System.currentTimeMillis(); + return false; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/.settings/org.eclipse.jdt.core.prefs index 43aff52a3..b7c2a608c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/.settings/org.eclipse.jdt.core.prefs +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/.settings/org.eclipse.jdt.core.prefs @@ -1,95 +1,95 @@ -eclipse.preferences.version=1
-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=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-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.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.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-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=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=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.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=warning
-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.specialParameterHidingField=disabled
-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=disabled
-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.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-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=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
+eclipse.preferences.version=1 +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=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +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.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.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +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=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +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=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.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +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.specialParameterHidingField=disabled +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=disabled +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.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=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IFSTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IFSTreeNode.java index fdd01d1a6..38092e0a3 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IFSTreeNode.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IFSTreeNode.java @@ -41,6 +41,11 @@ public interface IFSTreeNode extends IFSTreeNodeBase, IAdaptable { IFSTreeNode getParent(); /** + * Returns the child with the given name, or <code>null</code>. + */ + IFSTreeNode findChild(String name); + + /** * Returns the children of this node, may be <code>null</code> in case the children * have not been queried. */ @@ -125,6 +130,12 @@ public interface IFSTreeNode extends IFSTreeNodeBase, IAdaptable { IOperation operationDownload(OutputStream output); /** + * Returns an operation for downloading the remote file or directory to the local file system. + * @param destinationFolder folder where to store the downloaded files and folders. + */ + IOperation operationDownload(File destinationFolder, IConfirmCallback confirmCallback); + + /** * Returns an operation for uploading the given files into this remote directory */ IOperation operationDropFiles(List<String> files, IConfirmCallback confirmCallback); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java index ad93b6418..1b7efcea1 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/interfaces/runtime/IRuntimeModel.java @@ -9,8 +9,13 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime; +import java.io.File; +import java.util.List; + import org.eclipse.tcf.protocol.IChannel; import org.eclipse.tcf.te.tcf.core.model.interfaces.IModel; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IResultOperation; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNodeProvider; @@ -34,4 +39,9 @@ public interface IRuntimeModel extends IModel, IPeerNodeProvider { * Returns an operation for restoring nodes from a path */ public IResultOperation<IFSTreeNode> operationRestoreFromPath(String path); + + /** + * Returns an operation for downloading multiple nodes to a destination + */ + public IOperation operationDownload(List<IFSTreeNode> nodes, File destination, IConfirmCallback confirmCallback); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java index 62310a511..911873245 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/FSTreeNode.java @@ -42,6 +42,7 @@ import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IResultOperation; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNodeWorkingCopy; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopy; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopyLocal; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFile; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCreateFolder; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDelete; @@ -69,7 +70,7 @@ import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; * event dispatch thread. */ @SuppressWarnings("deprecation") -public final class FSTreeNode extends FSTreeNodeBase implements IFilterable, IFSTreeNode, org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode { +public final class FSTreeNode extends FSTreeNodeBase implements IFilterable, org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode { private static final QualifiedName EDITOR_KEY = new QualifiedName("org.eclipse.ui.internal.registry.ResourceEditorRegistry", "EditorProperty");//$NON-NLS-2$//$NON-NLS-1$ static final String KEY_WIN32_ATTRS = "Win32Attrs"; //$NON-NLS-1$ private static final Comparator<FSTreeNode> CMP_WIN = new Comparator<FSTreeNode>() { @@ -477,6 +478,11 @@ public final class FSTreeNode extends FSTreeNodeBase implements IFilterable, IFS } @Override + public IOperation operationDownload(File destinationFolder, IConfirmCallback confirmCallback) { + return new OpCopyLocal(singletonList(this), destinationFolder, confirmCallback); + } + + @Override public IOperation operationDropFiles(List<String> files, IConfirmCallback confirmCallback) { OpUpload upload = new OpUpload(confirmCallback); for (String file : files) { @@ -514,6 +520,7 @@ public final class FSTreeNode extends FSTreeNodeBase implements IFilterable, IFS fName = newName; } + @Override public FSTreeNode findChild(String name) { return binarySearch(fChildren, name); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/AbstractOperation.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/AbstractOperation.java index 8493a47e3..2db5529e2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/AbstractOperation.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/AbstractOperation.java @@ -34,6 +34,7 @@ import org.eclipse.tcf.services.IFileSystem.DoneReadDir; import org.eclipse.tcf.services.IFileSystem.FileSystemException; import org.eclipse.tcf.services.IFileSystem.IFileHandle; import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; @@ -41,6 +42,8 @@ import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; public abstract class AbstractOperation implements IOperation { + protected static final FSTreeNode[] NO_CHILDREN = {}; + public interface IReadDirDone { void error(FileSystemException error); @@ -136,7 +139,7 @@ public abstract class AbstractOperation implements IOperation { } - protected int confirmCallback(final FSTreeNode node, IConfirmCallback confirmCallback) { + protected int confirmCallback(final Object node, IConfirmCallback confirmCallback) { if (confirmCallback == null) return IConfirmCallback.YES; @@ -183,6 +186,17 @@ public abstract class AbstractOperation implements IOperation { } + protected void handleFSError(final FSTreeNode node, String msg, FileSystemException error, final TCFOperationMonitor<?> result) { + int status = error.getStatus(); + if (status == IFileSystem.STATUS_NO_SUCH_FILE) { + node.getParent().removeNode(node, true); + result.setDone(null); + } else { + node.setContent(NO_CHILDREN, false); + result.setError(msg, error); + } + } + protected void tcfReadDir(final IFileSystem fs, String path, final IReadDirDone callback) { fs.opendir(path, new DoneOpen() { private IFileHandle fHandle; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java index 0009ffc25..f41c3c81c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCommitAttr.java @@ -16,6 +16,7 @@ import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.services.IFileSystem; import org.eclipse.tcf.services.IFileSystem.DoneSetStat; import org.eclipse.tcf.services.IFileSystem.FileSystemException; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; @@ -36,7 +37,7 @@ public class OpCommitAttr extends AbstractOperation { public IStatus doRun(IProgressMonitor monitor) { monitor.beginTask(getName(), IProgressMonitor.UNKNOWN); - final TCFResult<?> result = new TCFResult<Object>(); + final TCFOperationMonitor<?> result = new TCFOperationMonitor<Object>(); final IFileSystem fileSystem = fNode.getRuntimeModel().getFileSystem(); if (fileSystem == null) { return result.setCancelled(); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java index 76c486811..e25eba432 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopy.java @@ -11,12 +11,10 @@ package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations; import static java.text.MessageFormat.format; -import java.util.LinkedList; import java.util.List; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; import org.eclipse.osgi.util.NLS; import org.eclipse.tcf.protocol.IToken; import org.eclipse.tcf.protocol.Protocol; @@ -26,150 +24,58 @@ import org.eclipse.tcf.services.IFileSystem.DoneMkDir; import org.eclipse.tcf.services.IFileSystem.DoneStat; import org.eclipse.tcf.services.IFileSystem.FileAttrs; import org.eclipse.tcf.services.IFileSystem.FileSystemException; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; -import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StatusHelper; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; /** * The operation class that copies selected FSTreeNodes to a specify destination folder. */ -public class OpCopy extends AbstractOperation { - private static class WorkItem { - final boolean fTop; - final FSTreeNode fDestination; - final FSTreeNode[] fSources; - WorkItem(FSTreeNode[] sources, FSTreeNode destination, boolean top) { - fSources = sources; - fDestination = destination; - fTop = top; - } - } - - IConfirmCallback fConfirmCallback; - boolean fCopyPermissions; - boolean fCopyOwnership; - - LinkedList<WorkItem> fWork = new LinkedList<WorkItem>(); - private long fStartTime; +public class OpCopy extends OpCopyBase<FSTreeNode> { + private final boolean fCopyPermissions; + private final boolean fCopyOwnership; - /** - * Create a copy operation using the specified nodes and destination folder, - * using the specified flags of copying permissions and ownership and a callback - * to confirm to overwrite existing files. - * - * @param nodes The file/folder nodes to be copied. - * @param dest The destination folder to be copied to. - */ public OpCopy(List<? extends IFSTreeNode> nodes, FSTreeNode dest, boolean cpPerm, boolean cpOwn, IConfirmCallback confirmCallback) { - super(); + super(nodes, dest, confirmCallback); fCopyOwnership = cpOwn; fCopyPermissions = cpPerm; - fConfirmCallback = confirmCallback; - nodes = dropNestedNodes(nodes); - fWork.add(new WorkItem(nodes.toArray(new FSTreeNode[nodes.size()]), dest, true)); } @Override - public IStatus doRun(IProgressMonitor monitor) { - fStartTime = System.currentTimeMillis(); - monitor.beginTask(getName(), IProgressMonitor.UNKNOWN); - WorkItem lastTop = null; - while (!fWork.isEmpty()) { - WorkItem item = fWork.remove(); - if (item.fTop) { - if (lastTop != null) - lastTop.fDestination.notifyChange(); - lastTop = item; - } - IStatus s = runWorkItem(item, monitor); - if (!s.isOK()) { - lastTop.fDestination.notifyChange(); - return s; - } - } - if (lastTop != null) - lastTop.fDestination.notifyChange(); - return Status.OK_STATUS; + protected FSTreeNode findChild(FSTreeNode destination, String name) { + return destination.findChild(name); } - protected IStatus runWorkItem(final WorkItem item, IProgressMonitor monitor) { - final FSTreeNode destination = item.fDestination; - IStatus status = refresh(destination, fStartTime, monitor); - if (!status.isOK()) { - return status; - } - - for (FSTreeNode source : item.fSources) { - status = refresh(source, fStartTime, monitor); - if (!status.isOK()) { - return status; - } - - status = performCopy(source, destination, monitor); - if (!status.isOK()) - return status; - } - return Status.OK_STATUS; + @Override + protected void notifyChange(FSTreeNode destination) { + destination.notifyChange(); } - private IStatus performCopy(FSTreeNode source, FSTreeNode destination, IProgressMonitor monitor) { - String newName = source.getName(); - FSTreeNode existing = destination.findChild(newName); - if (existing != null) { - if (source == existing) { - newName = createNewNameForCopy(destination, newName); - existing = null; - } else if (source.isDirectory()) { - if (!existing.isDirectory()) { - return StatusHelper.createStatus(format(Messages.OpCopy_error_noDirectory, existing.getLocation()), null); - } - int replace = confirmCallback(existing, fConfirmCallback); - if (replace == IConfirmCallback.NO) { - return Status.OK_STATUS; - } - if (replace != IConfirmCallback.YES) { - return Status.CANCEL_STATUS; - } + @Override + protected IStatus refreshDestination(FSTreeNode destination, long startTime, IProgressMonitor monitor) { + return refresh(destination, startTime, monitor); + } - fWork.addFirst(new WorkItem(source.getChildren(), existing, false)); - return Status.OK_STATUS; - } else if (source.isFile()) { - if (!existing.isFile()) { - return StatusHelper.createStatus(format(Messages.OpCopy_error_noFile, existing.getLocation()), null); - } - int replace = confirmCallback(existing, fConfirmCallback); - if (replace == IConfirmCallback.NO) { - return Status.OK_STATUS; - } - if (replace != IConfirmCallback.YES) { - return Status.CANCEL_STATUS; - } - } else { - return Status.OK_STATUS; - } - } - return performCopy(source, destination, newName, existing, monitor); + @Override + protected boolean isDirectory(FSTreeNode node) { + return node.isDirectory(); } + @Override + protected boolean isFile(FSTreeNode node) { + return node.isFile(); + } - private String createNewNameForCopy(FSTreeNode node, String origName) { - String name = origName; - int n = 0; - while (node.findChild(name) != null) { - if (n > 0) { - name = NLS.bind(Messages.Operation_CopyNOfFile, Integer.valueOf(n), origName); - } else { - name = NLS.bind(Messages.Operation_CopyOfFile, origName); - } - n++; - } - return name; + @Override + protected String getLocation(FSTreeNode node) { + return node.getLocation(); } - private IStatus performCopy(final FSTreeNode source, final FSTreeNode destination, final String newName, final FSTreeNode existing, IProgressMonitor monitor) { - final TCFResult<?> result = new TCFResult<Object>(); + @Override + protected IStatus performCopy(final FSTreeNode source, final FSTreeNode destination, final String newName, final FSTreeNode existing, IProgressMonitor monitor) { + final TCFOperationMonitor<?> result = new TCFOperationMonitor<Object>(); monitor.subTask(NLS.bind(Messages.OpCopy_Copying, source.getLocation())); Protocol.invokeLater(new Runnable() { @Override @@ -181,7 +87,7 @@ public class OpCopy extends AbstractOperation { } - protected void tcfPerformCopy(FSTreeNode source, FSTreeNode destination, String newName, FSTreeNode existing, TCFResult<?> result) { + protected void tcfPerformCopy(FSTreeNode source, FSTreeNode destination, String newName, FSTreeNode existing, TCFOperationMonitor<?> result) { if (result.checkCancelled()) return; @@ -194,7 +100,7 @@ public class OpCopy extends AbstractOperation { } } - private void tcfCopyFolder(final FSTreeNode source, final FSTreeNode dest, final String newName, final TCFResult<?> result) { + private void tcfCopyFolder(final FSTreeNode source, final FSTreeNode dest, final String newName, final TCFOperationMonitor<?> result) { final IFileSystem fileSystem = dest.getRuntimeModel().getFileSystem(); if (fileSystem == null) { result.setCancelled(); @@ -217,7 +123,7 @@ public class OpCopy extends AbstractOperation { FSTreeNode copy = new FSTreeNode(dest, newName, false, attrs); copy.setContent(new FSTreeNode[0], false); dest.addNode(copy, false); - fWork.addFirst(new WorkItem(source.getChildren(), copy, false)); + addWorkItem(source.getChildren(), copy); result.setDone(null); } } @@ -227,7 +133,7 @@ public class OpCopy extends AbstractOperation { }); } - private void tcfCopyFile(final FSTreeNode source, final FSTreeNode dest, final String newName, final FSTreeNode existing, final TCFResult<?> result) { + private void tcfCopyFile(final FSTreeNode source, final FSTreeNode dest, final String newName, final FSTreeNode existing, final TCFOperationMonitor<?> result) { final IFileSystem fileSystem = dest.getRuntimeModel().getFileSystem(); if (fileSystem == null) { result.setCancelled(); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopyBase.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopyBase.java new file mode 100644 index 000000000..5b8ebcf59 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopyBase.java @@ -0,0 +1,187 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations; + +import static java.text.MessageFormat.format; + +import java.io.File; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StatusHelper; +import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; + +/** + * The operation class that copies selected FSTreeNodes to a specify destination folder. + */ +public abstract class OpCopyBase<D> extends AbstractOperation { + private static class WorkItem<D> { + final boolean fTop; + final D fDestination; + final FSTreeNode[] fSources; + WorkItem(FSTreeNode[] sources, D destination, boolean top) { + fSources = sources; + fDestination = destination; + fTop = top; + } + } + + private IConfirmCallback fConfirmCallback; + + private LinkedList<WorkItem<D>> fWork = new LinkedList<WorkItem<D>>(); + private long fStartTime; + + /** + * Create a copy operation using the specified nodes and destination folder, + * using the specified flags of copying permissions and ownership and a callback + * to confirm to overwrite existing files. + * + * @param nodes The file/folder nodes to be copied. + * @param dest The destination folder to be copied to. + */ + public OpCopyBase(List<? extends IFSTreeNode> nodes, D dest, IConfirmCallback confirmCallback) { + super(); + fConfirmCallback = confirmCallback; + nodes = dropNestedNodes(nodes); + fWork.add(new WorkItem<D>(nodes.toArray(new FSTreeNode[nodes.size()]), dest, true)); + } + + abstract protected void notifyChange(D destination); + + abstract protected IStatus refreshDestination(D destination, long startTime, IProgressMonitor monitor); + + abstract protected D findChild(D destination, String newName); + + abstract protected boolean isDirectory(D existing); + + abstract protected boolean isFile(D existing); + + abstract protected String getLocation(D existing); + + abstract protected IStatus performCopy(final FSTreeNode source, final D destination, final String newName, final D existing, IProgressMonitor monitor); + + protected void addWorkItem(FSTreeNode[] nodes, D dest) { + fWork.addFirst(new WorkItem<D>(nodes, dest, false)); + } + + @Override + public final IStatus doRun(IProgressMonitor monitor) { + fStartTime = System.currentTimeMillis(); + monitor.beginTask(getName(), IProgressMonitor.UNKNOWN); + WorkItem<D> lastTop = null; + while (!fWork.isEmpty()) { + WorkItem<D> item = fWork.remove(); + if (item.fTop) { + if (lastTop != null) + notifyChange(lastTop.fDestination); + lastTop = item; + } + IStatus s = runWorkItem(item, monitor); + if (!s.isOK()) { + if (lastTop != null) { + notifyChange(lastTop.fDestination); + } + return s; + } + } + if (lastTop != null) + notifyChange(lastTop.fDestination); + + return Status.OK_STATUS; + } + + + protected IStatus runWorkItem(final WorkItem<D> item, IProgressMonitor monitor) { + final D destination = item.fDestination; + IStatus status = refreshDestination(destination, fStartTime, monitor); + if (!status.isOK()) { + return status; + } + + for (FSTreeNode source : item.fSources) { + status = refresh(source, fStartTime, monitor); + if (!status.isOK()) { + return status; + } + + status = performCopy(source, destination, monitor); + if (!status.isOK()) + return status; + } + return Status.OK_STATUS; + } + + + private IStatus performCopy(FSTreeNode source, D destination, IProgressMonitor monitor) { + String newName = new File(source.getName().replace(':', '$')).getName(); + D existing = findChild(destination, newName); + if (existing != null) { + if (source == existing) { + newName = createNewNameForCopy(destination, newName); + existing = null; + } else if (source.isDirectory()) { + if (!isDirectory(existing)) { + return StatusHelper.createStatus(format(Messages.OpCopy_error_noDirectory, getLocation(existing)), null); + } + int replace = confirmCallback(existing, fConfirmCallback); + if (replace == IConfirmCallback.NO) { + return Status.OK_STATUS; + } + if (replace != IConfirmCallback.YES) { + return Status.CANCEL_STATUS; + } + + fWork.addFirst(new WorkItem<D>(source.getChildren(), existing, false)); + return Status.OK_STATUS; + } else if (source.isFile()) { + if (!isFile(existing)) { + return StatusHelper.createStatus(format(Messages.OpCopy_error_noFile, getLocation(existing)), null); + } + int replace = confirmCallback(existing, fConfirmCallback); + if (replace == IConfirmCallback.NO) { + return Status.OK_STATUS; + } + if (replace != IConfirmCallback.YES) { + return Status.CANCEL_STATUS; + } + } else { + return Status.OK_STATUS; + } + } + return performCopy(source, destination, newName, existing, monitor); + } + + + private String createNewNameForCopy(D node, String origName) { + String name = origName; + int n = 0; + while (findChild(node, name) != null) { + if (n > 0) { + name = NLS.bind(Messages.Operation_CopyNOfFile, Integer.valueOf(n), origName); + } else { + name = NLS.bind(Messages.Operation_CopyOfFile, origName); + } + n++; + } + return name; + } + + @Override + public String getName() { + return Messages.OpCopy_CopyingFile; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopyLocal.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopyLocal.java new file mode 100644 index 000000000..ccc418477 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCopyLocal.java @@ -0,0 +1,139 @@ +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations; + +import static java.text.MessageFormat.format; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StatusHelper; +import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; + +/** + * The operation class that copies selected FSTreeNodes to a specify destination folder. + */ +public class OpCopyLocal extends OpCopyBase<File> { + private static final boolean IGNORE_CASE = new File("a").equals(new File("A")); //$NON-NLS-1$ //$NON-NLS-2$ + private static final File[] NO_FILES = {}; + + private final Map<File, File[]> fChildrenCache = new HashMap<File, File[]>(); + + public OpCopyLocal(List<? extends IFSTreeNode> nodes, File dest, IConfirmCallback confirmCallback) { + super(nodes, dest, confirmCallback); + } + + @Override + protected File findChild(File destination, String name) { + for (File child : getChildren(destination)) { + String childName = child.getName(); + if (IGNORE_CASE ? childName.equalsIgnoreCase(name) : childName.equals(name)) + return child; + } + return null; + } + + private File[] getChildren(File destination) { + File[] result = fChildrenCache.get(destination); + if (result == null) { + result = destination.listFiles(); + if (result == null) + result = NO_FILES; + fChildrenCache.put(destination, result); + } + return result; + } + + @Override + protected void notifyChange(File destination) { + } + + @Override + protected IStatus refreshDestination(File destination, long startTime, IProgressMonitor monitor) { + return Status.OK_STATUS; + } + + @Override + protected boolean isDirectory(File node) { + return node.isDirectory(); + } + + @Override + protected boolean isFile(File node) { + return node.isFile(); + } + + @Override + protected String getLocation(File node) { + return node.getAbsolutePath(); + } + + @Override + protected IStatus performCopy(final FSTreeNode source, final File destination, final String newName, final File existing, IProgressMonitor monitor) { + monitor.subTask(NLS.bind(Messages.OpCopy_Copying, source.getLocation())); + if (monitor.isCanceled()) + return Status.CANCEL_STATUS; + + if (source.isFile()) { + return copyFile(source, destination, newName, new SubProgressMonitor(monitor, 0)); + } + if (source.isDirectory()) { + return copyFolder(source, destination, newName); + } + return Status.OK_STATUS; + } + + private IStatus copyFolder(final FSTreeNode source, final File dest, final String newName) { + File newFolder = new File(dest, newName); + if (!newFolder.mkdir()) + return StatusHelper.createStatus(format(Messages.Operation_CannotCreateDirectory, newName), null); + + fChildrenCache.remove(dest); + addWorkItem(source.getChildren(), newFolder); + return Status.OK_STATUS; + } + + private IStatus copyFile(final FSTreeNode source, final File dest, final String newName, IProgressMonitor monitor) { + File fileDest = new File(dest, newName); + fChildrenCache.remove(dest); + OutputStream output; + try { + output = new BufferedOutputStream(new FileOutputStream(fileDest)); + } catch (FileNotFoundException e) { + return StatusHelper.createStatus(format(Messages.OpCopy_CannotCopyFile, newName), e); + } + IStatus result = source.operationDownload(output).run(monitor); + try { + output.close(); + } catch (IOException e) { + } + return result; + } + + @Override + public String getName() { + return Messages.OpCopy_CopyingFile; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java index 4709535d4..824f90cf2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreate.java @@ -17,6 +17,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.osgi.util.NLS; import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IResultOperation; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; @@ -51,7 +52,7 @@ public abstract class OpCreate extends AbstractOperation implements IResultOpera return StatusHelper.createStatus(format(Messages.OpCreate_error_existingFile, existing.getLocation()), null); } - final TCFResult<FSTreeNode> result = new TCFResult<FSTreeNode>(); + final TCFOperationMonitor<FSTreeNode> result = new TCFOperationMonitor<FSTreeNode>(); Protocol.invokeLater(new Runnable() { @Override public void run() { @@ -64,7 +65,7 @@ public abstract class OpCreate extends AbstractOperation implements IResultOpera return status; } - protected abstract void tcfCreate(FSTreeNode destination, String name, TCFResult<FSTreeNode> result); + protected abstract void tcfCreate(FSTreeNode destination, String name, TCFOperationMonitor<FSTreeNode> result); @Override public String getName() { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java index f4402aa50..b53627457 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFile.java @@ -21,6 +21,7 @@ import org.eclipse.tcf.services.IFileSystem.DoneStat; import org.eclipse.tcf.services.IFileSystem.FileAttrs; import org.eclipse.tcf.services.IFileSystem.FileSystemException; import org.eclipse.tcf.services.IFileSystem.IFileHandle; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; @@ -34,7 +35,7 @@ public class OpCreateFile extends OpCreate { } @Override - protected void tcfCreate(final FSTreeNode destination, final String name, final TCFResult<FSTreeNode> result) { + protected void tcfCreate(final FSTreeNode destination, final String name, final TCFOperationMonitor<FSTreeNode> result) { Assert.isTrue(Protocol.isDispatchThread()); if (result.checkCancelled()) return; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java index ab39988cc..03913964d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpCreateFolder.java @@ -19,6 +19,7 @@ import org.eclipse.tcf.services.IFileSystem.DoneMkDir; import org.eclipse.tcf.services.IFileSystem.DoneStat; import org.eclipse.tcf.services.IFileSystem.FileAttrs; import org.eclipse.tcf.services.IFileSystem.FileSystemException; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; @@ -32,7 +33,7 @@ public class OpCreateFolder extends OpCreate { } @Override - protected void tcfCreate(final FSTreeNode destination, final String name, final TCFResult<FSTreeNode> result) { + protected void tcfCreate(final FSTreeNode destination, final String name, final TCFOperationMonitor<FSTreeNode> result) { Assert.isTrue(Protocol.isDispatchThread()); if (result.checkCancelled()) return; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java index d5516e7bf..26d64ea8d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDelete.java @@ -26,6 +26,7 @@ import org.eclipse.tcf.services.IFileSystem; import org.eclipse.tcf.services.IFileSystem.DirEntry; import org.eclipse.tcf.services.IFileSystem.DoneRemove; import org.eclipse.tcf.services.IFileSystem.FileSystemException; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNodeWorkingCopy; @@ -121,7 +122,7 @@ public class OpDelete extends AbstractOperation { CacheManager.clearCache(item.fNode); - final TCFResult<?> result = new TCFResult<Object>(); + final TCFOperationMonitor<?> result = new TCFOperationMonitor<Object>(); monitor.subTask(NLS.bind(Messages.OpDelete_RemovingFileFolder, item.fNode.getLocation())); Protocol.invokeLater(new Runnable() { @Override @@ -142,7 +143,7 @@ public class OpDelete extends AbstractOperation { return workingCopy.operationCommit().run(new SubProgressMonitor(monitor, 0)); } - protected void tcfRunWorkItem(final WorkItem item, TCFResult<?> result) { + protected void tcfRunWorkItem(final WorkItem item, TCFOperationMonitor<?> result) { if (item.fNode.isFile()) { tcfDeleteFile(item, result); } else if (item.fNode.isDirectory()) { @@ -156,7 +157,7 @@ public class OpDelete extends AbstractOperation { } } - private void tcfDeleteFolder(final WorkItem item, final TCFResult<?> result) { + private void tcfDeleteFolder(final WorkItem item, final TCFOperationMonitor<?> result) { final String path = item.fNode.getLocation(true); final IFileSystem fs = item.fNode.getRuntimeModel().getFileSystem(); if (fs == null) { @@ -190,7 +191,7 @@ public class OpDelete extends AbstractOperation { }); } - private void tcfDeleteFile(final WorkItem item, final TCFResult<?> result) { + private void tcfDeleteFile(final WorkItem item, final TCFOperationMonitor<?> result) { final IFileSystem fs = item.fNode.getRuntimeModel().getFileSystem(); if (fs == null) { result.setCancelled(); @@ -204,7 +205,7 @@ public class OpDelete extends AbstractOperation { }); } - private void tcfDeleteEmptyFolder(final WorkItem item, final TCFResult<?> result) { + private void tcfDeleteEmptyFolder(final WorkItem item, final TCFOperationMonitor<?> result) { final IFileSystem fs = item.fNode.getRuntimeModel().getFileSystem(); if (fs == null) { result.setCancelled(); @@ -218,7 +219,7 @@ public class OpDelete extends AbstractOperation { }); } - protected void tcfHandleRemoved(final WorkItem item, FileSystemException error, final TCFResult<?> result) { + protected void tcfHandleRemoved(final WorkItem item, FileSystemException error, final TCFOperationMonitor<?> result) { if (error != null) { result.setError(format(Messages.OpDelete_error_delete, item.fNode.getLocation()), error); } else if (!result.checkCancelled()) { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java index 72aaa3bc3..d638ce5ed 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpDownload.java @@ -43,13 +43,18 @@ public class OpDownload extends AbstractOperation { @Override public IStatus doRun(IProgressMonitor monitor) { + MessageDigest digest = null; + try { + digest = MessageDigest.getInstance(MD_ALG); + } catch (NoSuchAlgorithmException e) { + } try { if (fTarget != null) { - downloadFile(fSource, fTarget, monitor); + downloadFile(fSource, fTarget, digest, monitor); } else { OutputStream out = new BufferedOutputStream(new FileOutputStream(fSource.getCacheFile())); try { - downloadFile(fSource, out, monitor); + downloadFile(fSource, out, digest, monitor); } finally { try { out.close(); @@ -63,10 +68,14 @@ public class OpDownload extends AbstractOperation { } return StatusHelper.createStatus("Cannot download " + fSource.getName(), e); //$NON-NLS-1$ } + + if (!monitor.isCanceled() && digest != null) { + updateNodeDigest(fSource, digest.digest()); + } return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS; } - private void downloadFile(FSTreeNode source, OutputStream out, IProgressMonitor monitor) throws IOException { + private void downloadFile(FSTreeNode source, OutputStream out, MessageDigest digest, IProgressMonitor monitor) throws IOException { byte[] data = new byte[DEFAULT_CHUNK_SIZE]; long size = source.getSize(); long percentSize = size / 100; @@ -75,15 +84,13 @@ public class OpDownload extends AbstractOperation { monitor.beginTask(getName(), 100); - MessageDigest digest = null; BufferedInputStream input = null; TcfURLConnection connection = (TcfURLConnection) source.getLocationURL().openConnection(); try { - try { - digest = MessageDigest.getInstance(MD_ALG); + if (digest != null) { input = new BufferedInputStream(new DigestInputStream(connection.getInputStream(), digest)); - } catch (NoSuchAlgorithmException e) { + } else { input = new BufferedInputStream(connection.getInputStream()); } @@ -102,11 +109,6 @@ public class OpDownload extends AbstractOperation { } } } - if (!monitor.isCanceled()) { - if (digest != null) { - updateNodeDigest(source, digest.digest()); - } - } } finally { out.flush(); if (input != null) { @@ -127,9 +129,9 @@ public class OpDownload extends AbstractOperation { protected void updateNodeDigest(FSTreeNode node, byte[] digest) { FileState fileDigest = PersistenceManager.getInstance().getFileDigest(node); if (fResetDigest) { - fileDigest.reset(digest); + fileDigest.reset(digest, fSource.getCacheFile().lastModified(), fSource.getModificationTime()); } else { - fileDigest.updateTargetDigest(digest); + fileDigest.updateTargetDigest(digest, fSource.getModificationTime()); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java index d8990ca50..5bca6bbad 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpMove.java @@ -25,6 +25,7 @@ import org.eclipse.tcf.services.IFileSystem; import org.eclipse.tcf.services.IFileSystem.DoneRemove; import org.eclipse.tcf.services.IFileSystem.DoneRename; import org.eclipse.tcf.services.IFileSystem.FileSystemException; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; @@ -174,7 +175,7 @@ public class OpMove extends AbstractOperation { CacheManager.clearCache(existing); CacheManager.clearCache(source); - final TCFResult<?> result = new TCFResult<Object>(); + final TCFOperationMonitor<?> result = new TCFOperationMonitor<Object>(); Protocol.invokeLater(new Runnable() { @Override public void run() { @@ -189,7 +190,7 @@ public class OpMove extends AbstractOperation { } - protected void tcfMoveReplace(final FSTreeNode source, final FSTreeNode destination, final FSTreeNode existing, final TCFResult<?> result) { + protected void tcfMoveReplace(final FSTreeNode source, final FSTreeNode destination, final FSTreeNode existing, final TCFOperationMonitor<?> result) { if (result.checkCancelled()) return; @@ -212,7 +213,7 @@ public class OpMove extends AbstractOperation { }); } - protected void tcfMove(final FSTreeNode source, final FSTreeNode dest, final TCFResult<?> result) { + protected void tcfMove(final FSTreeNode source, final FSTreeNode dest, final TCFOperationMonitor<?> result) { final IFileSystem fileSystem = dest.getRuntimeModel().getFileSystem(); if (fileSystem == null) { result.setCancelled(); @@ -239,7 +240,7 @@ public class OpMove extends AbstractOperation { private IStatus deleteEmptyFolder(final FSTreeNode source, IProgressMonitor monitor) { CacheManager.clearCache(source); - final TCFResult<?> result = new TCFResult<Object>(); + final TCFOperationMonitor<?> result = new TCFOperationMonitor<Object>(); Protocol.invokeLater(new Runnable() { @Override public void run() { @@ -249,7 +250,7 @@ public class OpMove extends AbstractOperation { return result.waitDone(monitor); } - protected void tcfDeleteEmptyFolder(final FSTreeNode source, final TCFResult<?> result) { + protected void tcfDeleteEmptyFolder(final FSTreeNode source, final TCFOperationMonitor<?> result) { final IFileSystem fs = source.getRuntimeModel().getFileSystem(); if (fs == null) { result.setCancelled(); diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java index e70332f5f..cbdf45b6d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRefresh.java @@ -11,12 +11,12 @@ package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations; import static java.text.MessageFormat.format; +import java.io.File; import java.io.OutputStream; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.concurrent.TimeoutException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -31,7 +31,8 @@ import org.eclipse.tcf.services.IFileSystem.DoneStat; import org.eclipse.tcf.services.IFileSystem.FileAttrs; import org.eclipse.tcf.services.IFileSystem.FileSystemException; import org.eclipse.tcf.te.runtime.callback.Callback; -import org.eclipse.tcf.te.tcf.core.concurrent.Rendezvous; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState; @@ -42,8 +43,7 @@ import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; * FSRefresh refreshes a specified tree node and its children and grand children recursively. */ public class OpRefresh extends AbstractOperation { - static final FSTreeNode[] NO_CHILDREN = {}; - private static Map<FSTreeNode, TCFResult<?>> fPendingResults = new HashMap<FSTreeNode, TCFResult<?>>(); + private static Map<FSTreeNode, TCFOperationMonitor<?>> fPendingResults = new HashMap<FSTreeNode, TCFOperationMonitor<?>>(); final LinkedList<FSTreeNode> fWork = new LinkedList<FSTreeNode>(); final boolean fRecursive; @@ -108,32 +108,15 @@ public class OpRefresh extends AbstractOperation { if (!node.isFileSystem() && !isDir && !isFile) return Status.OK_STATUS; - final Rendezvous rendezvous; - if (!isTop) { - rendezvous = null; - if (isFile || node.getChildren() == null) - return Status.OK_STATUS; - } else { - if (isFile) { - FileState digest = PersistenceManager.getInstance().getFileDigest(node); - rendezvous = new Rendezvous(); - digest.updateState(new Callback(){ - @Override - protected void internalDone(Object caller, IStatus status) { - rendezvous.arrive(); - } - }); - } else { - rendezvous = null; - } - } + if (!isTop && !isFile && node.getChildren() == null) + return Status.OK_STATUS; monitor.subTask(format(Messages.OpRefresh_name, node.getLocation())); IStatus status; synchronized (fPendingResults) { - TCFResult<?> result = fPendingResults.get(node); + TCFOperationMonitor<?> result = fPendingResults.get(node); if (result == null) { - result = new TCFResult<Object>(false); + result = new TCFOperationMonitor<Object>(false); fPendingResults.put(node, result); scheduleTcfRefresh(node, isTop, result); } @@ -143,67 +126,27 @@ public class OpRefresh extends AbstractOperation { fPendingResults.remove(node); } } - - if (rendezvous != null) { - try { - rendezvous.waiting(10000); - } catch (TimeoutException e) { - } - } return status; } - private void scheduleTcfRefresh(final FSTreeNode node, final boolean isTop, final TCFResult<?> result) { - Protocol.invokeLater(new Runnable() { - @Override - public void run() { - if (node.isFileSystem()) { - tcfRefreshRoots(node, result); - } else if (isTop && !node.isRootDirectory()) { - tcfStatAndRefresh(node, result); - } else { - tcfRefreshDir(node, result); - } - } - }); - } - - protected void tcfStatAndRefresh(final FSTreeNode node, final TCFResult<?> result) { + private void scheduleTcfRefresh(final FSTreeNode node, final boolean isTop, final TCFOperationMonitor<?> result) { if (!result.checkCancelled()) { - final IFileSystem fs = node.getRuntimeModel().getFileSystem(); - if (fs == null) { - result.setCancelled(); - return; - } - - fs.stat(node.getLocation(true), new DoneStat() { + Protocol.invokeLater(new Runnable() { @Override - public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) { - if (error != null) { - handleFSError(node, Messages.OpRefresh_errorReadAttributes, error, result); + public void run() { + if (node.isFileSystem()) { + tcfRefreshRoots(node, result); + } else if (isTop && !node.isRootDirectory()) { + tcfStatAndRefresh(node, result); } else { - node.setAttributes(attrs, false); - if (!attrs.isDirectory()) { - node.operationDownload(new OutputStream() { - @Override - public void write(int b) {} - }).runInJob(new Callback() { - @Override - protected void internalDone(Object caller, IStatus status) { - result.setDone(null); - } - }); - result.setDone(null); - } else if (!result.checkCancelled()){ - tcfRefreshDir(node, result); - } + tcfRefresh(node, result); } } }); } } - protected void tcfRefreshRoots(final FSTreeNode node, final TCFResult<?> result) { + protected void tcfRefreshRoots(final FSTreeNode node, final TCFOperationMonitor<?> result) { if (!result.checkCancelled()) { final IFileSystem fs = node.getRuntimeModel().getFileSystem(); if (fs == null) { @@ -223,8 +166,8 @@ public class OpRefresh extends AbstractOperation { nodes[i++] = new FSTreeNode(node, entry.filename, true, entry.attrs); } node.setContent(nodes, false); - if (fRecursive) { - for (FSTreeNode node : nodes) { + for (FSTreeNode node : nodes) { + if (fRecursive || node.isFile()) { fWork.addFirst(node); } } @@ -235,52 +178,115 @@ public class OpRefresh extends AbstractOperation { } } - protected void tcfRefreshDir(final FSTreeNode node, final TCFResult<?> result) { + protected void tcfStatAndRefresh(final FSTreeNode node, final TCFOperationMonitor<?> result) { if (!result.checkCancelled()) { - final String path = node.getLocation(true); final IFileSystem fs = node.getRuntimeModel().getFileSystem(); if (fs == null) { result.setCancelled(); return; } - tcfReadDir(fs, path, new IReadDirDone() { + fs.stat(node.getLocation(true), new DoneStat() { @Override - public void error(FileSystemException error) { - result.setError(format(Messages.OpRefresh_errorOpenDir, path), error); + public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) { + if (error != null) { + handleFSError(node, Messages.OpRefresh_errorReadAttributes, error, result); + } else { + node.setAttributes(attrs, false); + tcfRefresh(node, result); + } } + }); + } + } - @Override - public boolean checkCancelled() { - return result.checkCancelled(); + protected void tcfRefresh(final FSTreeNode node, final TCFOperationMonitor<?> result) { + if (!result.checkCancelled()) { + if (node.isFile()) { + tcfUpdateCacheDigest(node, result); + } else if (node.isDirectory()) { + final String path = node.getLocation(true); + final IFileSystem fs = node.getRuntimeModel().getFileSystem(); + if (fs == null) { + result.setCancelled(); + return; } - @Override - public void done(List<DirEntry> entries) { - int i = 0; - FSTreeNode[] nodes = new FSTreeNode[entries.size()]; - for (DirEntry entry : entries) { - nodes[i++] = new FSTreeNode(node, entry.filename, false, entry.attrs); + tcfReadDir(fs, path, new IReadDirDone() { + @Override + public void error(FileSystemException error) { + result.setError(format(Messages.OpRefresh_errorOpenDir, path), error); } - node.setContent(nodes, false); - if (fRecursive) { + + @Override + public boolean checkCancelled() { + return result.checkCancelled(); + } + + @Override + public void done(List<DirEntry> entries) { + int i = 0; + FSTreeNode[] nodes = new FSTreeNode[entries.size()]; + for (DirEntry entry : entries) { + nodes[i++] = new FSTreeNode(node, entry.filename, false, entry.attrs); + } + node.setContent(nodes, false); for (FSTreeNode node : nodes) { - fWork.addFirst(node); + if (fRecursive || node.isFile()) { + fWork.addFirst(node); + } } + result.setDone(null); + } + }); + } else { + result.setDone(null); + } + } + } + + protected void tcfUpdateCacheDigest(final FSTreeNode node, final TCFOperationMonitor<?> result) { + File cacheFile = node.getCacheFile(); + if (!cacheFile.exists()) { + result.setDone(null); + return; + } + + final FileState digest = PersistenceManager.getInstance().getFileDigest(node); + final long cacheMTime = cacheFile.lastModified(); + if (digest.getCacheDigest() == null || digest.getCacheMTime() != cacheMTime) { + final OpCacheFileDigest op = new OpCacheFileDigest(node); + op.runInJob(new Callback() { + @Override + protected void internalDone(Object caller, IStatus status) { + if (status.isOK()) { + digest.updateCacheDigest(op.getDigest(), cacheMTime); + tcfUpdateTargetDigest(digest, node, result); + } else { + result.setDone(status, null); } - result.setDone(null); } }); + } else { + tcfUpdateTargetDigest(digest, node, result); } } - protected void handleFSError(final FSTreeNode node, String msg, FileSystemException error, final TCFResult<?> result) { - int status = error.getStatus(); - if (status == IFileSystem.STATUS_NO_SUCH_FILE) { - node.getParent().removeNode(node, true); - result.setDone(null); + + protected void tcfUpdateTargetDigest(FileState digest, final FSTreeNode node, final TCFOperationMonitor<?> result) { + if (digest.getTargetDigest() == null || digest.getTargetMTime() != node.getModificationTime()) { + final IOperation op = node.operationDownload(new OutputStream() { + @Override + public void write(int b) { + } + }); + op.runInJob(new Callback() { + @Override + protected void internalDone(Object caller, IStatus status) { + result.setDone(status, null); + } + }); } else { - node.setContent(NO_CHILDREN, false); result.setDone(null); } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java index 3bc9e4f9a..4a63936e8 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpRename.java @@ -19,6 +19,7 @@ import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.services.IFileSystem; import org.eclipse.tcf.services.IFileSystem.DoneRename; import org.eclipse.tcf.services.IFileSystem.FileSystemException; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; @@ -41,7 +42,7 @@ public class OpRename extends AbstractOperation { monitor.beginTask(getName(), IProgressMonitor.UNKNOWN); CacheManager.clearCache(node); - final TCFResult<?> result = new TCFResult<Object>(); + final TCFOperationMonitor<?> result = new TCFOperationMonitor<Object>(); monitor.subTask(NLS.bind(Messages.OpMove_Moving, node.getLocation())); Protocol.invokeLater(new Runnable() { @Override @@ -53,7 +54,7 @@ public class OpRename extends AbstractOperation { } - protected void tcfRename(final TCFResult<?> result) { + protected void tcfRename(final TCFOperationMonitor<?> result) { if (result.checkCancelled()) return; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java index 6d8d23aaa..fad78084d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpTargetFileDigest.java @@ -25,6 +25,7 @@ import org.eclipse.tcf.services.IFileSystem; import org.eclipse.tcf.services.IFileSystem.DoneOpen; import org.eclipse.tcf.services.IFileSystem.FileSystemException; import org.eclipse.tcf.services.IFileSystem.IFileHandle; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StatusHelper; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; @@ -47,7 +48,7 @@ public class OpTargetFileDigest extends AbstractOperation { monitor.beginTask(getName(), 100); final String path = node.getLocation(true); - final TCFResult<InputStream> result = new TCFResult<InputStream>(); + final TCFOperationMonitor<InputStream> result = new TCFOperationMonitor<InputStream>(); Protocol.invokeLater(new Runnable() { @Override public void run() { @@ -99,7 +100,7 @@ public class OpTargetFileDigest extends AbstractOperation { } } - protected void tcfGetInputStream(IFileSystem fileSystem, final String path, final TCFResult<InputStream> result) { + protected void tcfGetInputStream(IFileSystem fileSystem, final String path, final TCFOperationMonitor<InputStream> result) { int flags = IFileSystem.TCF_O_READ; if (!result.checkCancelled()) { fileSystem.open(path, flags, null, new DoneOpen() { diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java index 47223fec8..cc5863d00 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/OpUpload.java @@ -36,6 +36,7 @@ import org.eclipse.tcf.services.IFileSystem.DoneStat; import org.eclipse.tcf.services.IFileSystem.FileAttrs; import org.eclipse.tcf.services.IFileSystem.FileSystemException; import org.eclipse.tcf.services.IFileSystem.IFileHandle; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState; @@ -148,7 +149,7 @@ public class OpUpload extends AbstractOperation { path = destination.getLocation(true); } - final TCFResult<OutputStream> result = new TCFResult<OutputStream>(); + final TCFOperationMonitor<OutputStream> result = new TCFOperationMonitor<OutputStream>(); monitor.subTask(NLS.bind(Messages.OpUpload_UploadSingleFile, item.fSource)); Protocol.invokeLater(new Runnable() { @Override @@ -182,7 +183,7 @@ public class OpUpload extends AbstractOperation { private IStatus updateNode(final String path, final String name, final FSTreeNode destination, final FSTreeNode existing, IProgressMonitor monitor) { - final TCFResult<?> r2 = new TCFResult<Object>(); + final TCFOperationMonitor<?> r2 = new TCFOperationMonitor<Object>(); Protocol.invokeLater(new Runnable() { @Override public void run() { @@ -211,7 +212,7 @@ public class OpUpload extends AbstractOperation { return r2.waitDone(monitor); } - protected void tcfGetOutputStream(IFileSystem fileSystem, final String path, final TCFResult<OutputStream> result) { + protected void tcfGetOutputStream(IFileSystem fileSystem, final String path, final TCFOperationMonitor<OutputStream> result) { int flags = IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_TRUNC; if (!result.checkCancelled()) { fileSystem.open(path, flags, null, new DoneOpen() { @@ -246,7 +247,6 @@ public class OpUpload extends AbstractOperation { digest = MessageDigest.getInstance(MD_ALG); input = new DigestInputStream(input, digest); } catch (NoSuchAlgorithmException e) { - digest = null; } } @@ -271,8 +271,9 @@ public class OpUpload extends AbstractOperation { } if (digest != null && existing != null) { + statFile(existing, monitor); FileState filedigest = PersistenceManager.getInstance().getFileDigest(existing); - filedigest.reset(digest.digest()); + filedigest.reset(digest.digest(), existing.getCacheFile().lastModified(), existing.getModificationTime()); } return Status.OK_STATUS; } catch (IOException e) { @@ -287,6 +288,39 @@ public class OpUpload extends AbstractOperation { } } + private void statFile(final FSTreeNode node, IProgressMonitor monitor) { + final TCFOperationMonitor<?> result = new TCFOperationMonitor<Object>(); + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + tcfStat(node, result); + } + }); + result.waitDone(monitor); + } + + protected void tcfStat(final FSTreeNode node, final TCFOperationMonitor<?> result) { + if (!result.checkCancelled()) { + final IFileSystem fs = node.getRuntimeModel().getFileSystem(); + if (fs == null) { + result.setCancelled(); + return; + } + + fs.stat(node.getLocation(true), new DoneStat() { + @Override + public void doneStat(IToken token, FileSystemException error, FileAttrs attrs) { + if (error != null) { + handleFSError(node, Messages.OpRefresh_errorReadAttributes, error, result); + } else { + node.setAttributes(attrs, false); + result.setDone(null); + } + } + }); + } + } + @Override public String getName() { String message; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/TCFResult.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/TCFResult.java deleted file mode 100644 index db724cf5d..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/operations/TCFResult.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 Wind River Systems, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Markus Schorn - initial API and implementation - *******************************************************************************/ -package org.eclipse.tcf.te.tcf.filesystem.core.internal.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.StatusHelper; - -public class TCFResult<T> { - private static final long UNRESPONSIVE_TIMEOUT = 60*1000; - - private IStatus fStatus; - private T fValue; - private long fCheckedTime; - private boolean fAutoCancel; - - private List<IProgressMonitor> fMonitors = new ArrayList<IProgressMonitor>(); - - - public TCFResult() { - this(true); - } - - public TCFResult(boolean autoCancel) { - fAutoCancel = autoCancel; - resetTimeout(); - } - - public IStatus waitDone(IProgressMonitor monitor) { - return waitDone(monitor, Long.MAX_VALUE, UNRESPONSIVE_TIMEOUT); - } - - public IStatus waitDone(IProgressMonitor monitor, long absoluteTimeout) { - return waitDone(monitor, absoluteTimeout, UNRESPONSIVE_TIMEOUT); - } - - public synchronized IStatus waitDone(IProgressMonitor monitor, long absoluteTimeout, long unresponsiveTimeout) { - if (monitor == null) - monitor = new NullProgressMonitor(); - - fMonitors.add(monitor); - try { - long startTime = System.currentTimeMillis(); - while (true) { - if (fStatus != null) { - return fStatus; - } - - if (monitor.isCanceled()) { - return cancelWait(monitor); - } - - long time = System.currentTimeMillis(); - if (time - startTime > absoluteTimeout || time - fCheckedTime > unresponsiveTimeout) { - return cancelWait(monitor); - } - - try { - wait(100); - } catch (InterruptedException e) { - return cancelWait(monitor); - } - } - } finally { - fMonitors.remove(monitor); - } - } - - private IStatus cancelWait(IProgressMonitor monitor) { - if (fAutoCancel && fMonitors.size() == 1) { - fStatus = Status.CANCEL_STATUS; - } - - return Status.CANCEL_STATUS; - } - - private long resetTimeout() { - return fCheckedTime = System.currentTimeMillis(); - } - - public T getValue() { - return fValue; - } - - public synchronized IStatus setDone(IStatus status, T result) { - if (fStatus == null) { - fStatus = status; - fValue = result; - notifyAll(); - } - return fStatus; - } - - public IStatus setDone(T result) { - return setDone(Status.OK_STATUS, result); - } - - public IStatus setError(String msg, Throwable th) { - return setDone(StatusHelper.createStatus(msg, th), null); - } - - public IStatus setCancelled() { - return setDone(Status.CANCEL_STATUS, null); - } - - public synchronized boolean checkCancelled() { - if (fStatus != null) { - return true; - } - resetTimeout(); - return false; - } - - public IStatus getStatus() { - return fStatus; - } - - public synchronized boolean hasWaiters() { - return !fMonitors.isEmpty(); - } -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java index 88c8d3142..2a503df0c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/CacheManager.java @@ -63,7 +63,7 @@ public class CacheManager { SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { - if (!dir.mkdir()) { + if (!dir.mkdirs()) { throw new Exception(NLS.bind(Messages.CacheManager_MkdirFailed, dir .getAbsolutePath())); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java index 4e699321a..8b8e460e3 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/FileState.java @@ -11,15 +11,8 @@ package org.eclipse.tcf.te.tcf.filesystem.core.internal.utils; import java.beans.PropertyChangeEvent; import java.io.File; -import java.io.OutputStream; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.tcf.te.runtime.callback.Callback; -import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; -import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; -import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCacheFileDigest; import org.eclipse.tcf.te.tcf.filesystem.core.model.CacheState; /** @@ -47,6 +40,11 @@ public class FileState { private long cache_mtime; /** + * The cache file's modification time. + */ + private long target_mtime; + + /** * If the job that computes the local cache's digest is running. */ transient boolean cache_digest_running = false; @@ -78,8 +76,9 @@ public class FileState { * @param target_digest The target file's digest. * @param base_digest The baseline digest. */ - public FileState(long mtime, byte[] cache_digest, byte[] target_digest, byte[]base_digest) { + public FileState(long mtime, long target_mtime, byte[] cache_digest, byte[] target_digest, byte[]base_digest) { this.cache_mtime = mtime; + this.target_mtime = target_mtime; this.cache_digest = cache_digest; this.target_digest = target_digest; this.base_digest = base_digest; @@ -121,6 +120,10 @@ public class FileState { return cache_mtime; } + public long getTargetMTime() { + return target_mtime; + } + /** * Get the node's cache file digest. * @@ -131,70 +134,14 @@ public class FileState { } /** - * Update the cache state of this file and invoke callback once the update is done. - * If the callback is null, then do not invoke any callback. - * - * @param callback Callback invoked after updating. - */ - public synchronized void updateState(final ICallback callback) { - File file = CacheManager.getCacheFile(node); - if (file.exists()) { - long cache_mtime = file.lastModified(); - if (!cache_digest_running && (cache_digest == null || this.cache_mtime != cache_mtime)) { - cache_digest_running = true; - this.cache_mtime = cache_mtime; - final OpCacheFileDigest op = new OpCacheFileDigest(node); - op.runInJob(new Callback() { - @Override - protected void internalDone(Object caller, IStatus status) { - if (status.isOK()) { - updateCacheDigest(op.getDigest()); - } - cache_digest_running = false; - if (status.isOK()) { - updateState(callback); - } - else if(callback != null){ - callback.done(this, status); - } - } - }); - } - else if (!target_digest_running && target_digest == null) { - target_digest_running = true; - final IOperation op = node.operationDownload(new OutputStream() { - @Override - public void write(int b) { - } - }); - op.runInJob(new Callback() { - @Override - protected void internalDone(Object caller, IStatus status) { - target_digest_running = false; - if (status.isOK()) { - updateState(callback); - } else if(callback != null){ - callback.done(this, status); - } - } - }); - } else if (callback != null) { - callback.done(this, Status.OK_STATUS); - } - } else if (callback != null) { - callback.done(this, Status.OK_STATUS); - } - } - - /** * Get this node's cache state using the current state data. * * @return The state expressed in a CacheState enum value. */ public synchronized CacheState getCacheState() { File file = CacheManager.getCacheFile(node); - if (!file.exists()) return CacheState.consistent; - updateState(null); + if (!file.exists()) + return CacheState.consistent; if (cache_digest == null || target_digest == null) return CacheState.consistent; if (isUnchanged(target_digest, cache_digest)) { @@ -215,8 +162,11 @@ public class FileState { * * @param target_digest The new target digest data. */ - public void updateTargetDigest(byte[] target_digest) { + public void updateTargetDigest(byte[] target_digest, long mtime) { +// System.out.println("targt: " + mtime + " " + PersistenceManagerDelegate.digest2string(target_digest)); + this.target_digest = target_digest; + this.target_mtime = mtime; PropertyChangeEvent event = new PropertyChangeEvent(this, "target_digest", null, target_digest); //$NON-NLS-1$ node.getRuntimeModel().firePropertyChanged(event); } @@ -243,9 +193,11 @@ public class FileState { * * @param cache_digest The new cache file digest data. */ - public void updateCacheDigest(byte[] cache_digest) { + public void updateCacheDigest(byte[] cache_digest, long mtime) { +// System.out.println("cache: " + mtime + " " + PersistenceManagerDelegate.digest2string(cache_digest)); byte[] old_digest = cache_digest; this.cache_digest = cache_digest; + this.cache_mtime = mtime; PropertyChangeEvent event = new PropertyChangeEvent(node, "cache_digest", old_digest, cache_digest); //$NON-NLS-1$ node.getRuntimeModel().firePropertyChanged(event); } @@ -255,10 +207,13 @@ public class FileState { * * @param digest The new digest data. */ - public void reset(byte[] digest) { + public void reset(byte[] digest, long cache_mtime, long target_mtime) { +// System.out.println("reset: " + cache_mtime + " " + target_mtime + " " + PersistenceManagerDelegate.digest2string(digest)); cache_digest = digest; target_digest = digest; base_digest = digest; + this.cache_mtime = cache_mtime; + this.target_mtime = target_mtime; PropertyChangeEvent event = new PropertyChangeEvent(node, "reset_digest", null, digest); //$NON-NLS-1$ node.getRuntimeModel().firePropertyChanged(event); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java index 28fd5baa1..dd6f52a11 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/internal/utils/PersistenceManagerDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2012, 2015 Wind River Systems, 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 @@ -30,6 +30,7 @@ import org.eclipse.tcf.te.runtime.persistence.delegates.GsonMapPersistenceDelega public class PersistenceManagerDelegate extends GsonMapPersistenceDelegate { private static final String MAP_KEY_MTIME = "mtime"; //$NON-NLS-1$ + private static final String MAP_KEY_TARGET_MTIME = "target_mtime"; //$NON-NLS-1$ private static final String MAP_KEY_TARGET = "target"; //$NON-NLS-1$ private static final String MAP_KEY_CACHE = "cache"; //$NON-NLS-1$ private static final String MAP_KEY_BASE = "base"; //$NON-NLS-1$ @@ -116,7 +117,7 @@ public class PersistenceManagerDelegate extends GsonMapPersistenceDelegate { /** * Translate the specified map whose keys are QualifiedNames to a map whose keys are strings. - * + * * @param map The map to be translated. * @return a map with string keys. */ @@ -196,7 +197,9 @@ public class PersistenceManagerDelegate extends GsonMapPersistenceDelegate { byte[] target_digest = string2digest((String) value.get(MAP_KEY_TARGET)); Number number = (Number) value.get(MAP_KEY_MTIME); long mtime = number.longValue(); - return new FileState(mtime, cache_digest, target_digest, base_digest); + number = (Number) value.get(MAP_KEY_TARGET_MTIME); + long target_mtime = number == null ? 0 : number.longValue(); + return new FileState(mtime, target_mtime, cache_digest, target_digest, base_digest); } private Map<String, Object> digest2map(FileState digest) { @@ -205,10 +208,11 @@ public class PersistenceManagerDelegate extends GsonMapPersistenceDelegate { map.put(MAP_KEY_CACHE, digest2string(digest.getCacheDigest())); map.put(MAP_KEY_TARGET, digest2string(digest.getTargetDigest())); map.put(MAP_KEY_MTIME, Long.valueOf(digest.getCacheMTime())); + map.put(MAP_KEY_TARGET_MTIME, Long.valueOf(digest.getTargetMTime())); return map; } - private String digest2string(byte[] digest) { + static String digest2string(byte[] digest) { if (digest != null && digest.length > 0) { StringBuilder buffer = new StringBuilder(); for (byte element : digest) { @@ -245,7 +249,7 @@ public class PersistenceManagerDelegate extends GsonMapPersistenceDelegate { /** * Translate the specified map with string keys to a map whose keys are qualified names. - * + * * @param strMap The map with string keys. * @return A map with qualified names as keys. */ @@ -267,7 +271,7 @@ public class PersistenceManagerDelegate extends GsonMapPersistenceDelegate { /** * Convert the string to a URI. - * + * * @param string The string to be converted. * @return the URI or null if there're issues when parsing. */ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java index f2cb848a2..b2168be88 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/ModelManager.java @@ -26,6 +26,7 @@ import org.eclipse.tcf.services.IFileSystem.DoneUser; import org.eclipse.tcf.services.IFileSystem.FileSystemException; import org.eclipse.tcf.te.core.interfaces.IConnectable; import org.eclipse.tcf.te.tcf.core.Tcf; +import org.eclipse.tcf.te.tcf.core.concurrent.TCFOperationMonitor; import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager; import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; @@ -39,7 +40,6 @@ import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpDelete; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefresh; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpUpload; -import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.TCFResult; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; @@ -69,7 +69,7 @@ public class ModelManager { return null; - final TCFResult<IRuntimeModel> result = new TCFResult<IRuntimeModel>(); + final TCFOperationMonitor<IRuntimeModel> result = new TCFOperationMonitor<IRuntimeModel>(); // Create the runnable to execute Runnable runnable = new Runnable() { @Override @@ -95,12 +95,12 @@ public class ModelManager { return result.getValue(); } - protected static void createRuntimeModel(final IPeerNode peerNode, final TCFResult<IRuntimeModel> result) { + protected static void createRuntimeModel(final IPeerNode peerNode, final TCFOperationMonitor<IRuntimeModel> result) { Assert.isTrue(Protocol.isDispatchThread()); Map<String, Boolean> flags = new HashMap<String, Boolean>(); flags.put(IChannelManager.FLAG_FORCE_NEW, Boolean.TRUE); flags.put(IChannelManager.FLAG_NO_PATH_MAP, Boolean.TRUE); - flags.put(IChannelManager.FLAG_NO_VALUE_ADD, Boolean.FALSE); + flags.put(IChannelManager.FLAG_NO_VALUE_ADD, Boolean.TRUE); Tcf.getChannelManager().openChannel(peerNode.getPeer(), flags, new DoneOpenChannel() { @Override diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java index 33659d814..17a62bb07 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/model/RuntimeModel.java @@ -13,6 +13,7 @@ import static org.eclipse.tcf.te.tcf.locator.model.ModelManager.getPeerModel; import java.beans.PropertyChangeEvent; import java.io.File; +import java.util.List; import java.util.concurrent.atomic.AtomicReference; import org.eclipse.core.runtime.Assert; @@ -26,11 +27,14 @@ import org.eclipse.tcf.te.runtime.model.ContainerModelNode; import org.eclipse.tcf.te.runtime.model.factory.Factory; import org.eclipse.tcf.te.runtime.model.interfaces.factory.IFactory; import org.eclipse.tcf.te.tcf.core.model.interfaces.services.IModelService; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IConfirmCallback; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IOperation; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.IResultOperation; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel; import org.eclipse.tcf.te.tcf.filesystem.core.internal.FSTreeNode; import org.eclipse.tcf.te.tcf.filesystem.core.internal.UserAccount; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpCopyLocal; import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager; import org.eclipse.tcf.te.tcf.filesystem.core.nls.Messages; @@ -154,6 +158,11 @@ public final class RuntimeModel extends ContainerModelNode implements IRuntimeMo } @Override + public IOperation operationDownload(List<IFSTreeNode> nodes, File destination, IConfirmCallback confirmCallback) { + return new OpCopyLocal(nodes, destination, confirmCallback); + } + + @Override public IResultOperation<IFSTreeNode> operationRestoreFromPath(String path) { return new OpParsePath(fPeerNode, path); } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java index ab8b976d4..7a18a67cf 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.core/src/org/eclipse/tcf/te/tcf/filesystem/core/services/FileTransferService.java @@ -75,7 +75,7 @@ public class FileTransferService { Assert.isNotNull(fileSystem); - IPath targetPath = item.getTargetPath(); + String targetPath = item.getTargetPathString(); if (targetPath != null) { final AtomicReference<FileSystemException> error = new AtomicReference<FileSystemException>(); @@ -173,7 +173,7 @@ public class FileTransferService { IStatus result = Status.OK_STATUS; IPath hostPath = item.getHostPath(); - IPath targetPath = item.getTargetPath(); + String targetPath = item.getTargetPathString(); BufferedOutputStream outStream = null; TCFFileInputStream inStream = null; @@ -195,7 +195,7 @@ public class FileTransferService { } // If the host file is a directory, append the remote file name if (hostPath.toFile().isDirectory()) { - hostPath = item.getHostPath().append(targetPath.lastSegment()); + hostPath = item.getHostPath().append(lastSegment(targetPath)); } // Remember the modification time of the remote file. @@ -205,7 +205,7 @@ public class FileTransferService { try { // Open the remote file - fileSystem.open(targetPath.toString(), IFileSystem.TCF_O_READ, null, new IFileSystem.DoneOpen() { + fileSystem.open(targetPath, IFileSystem.TCF_O_READ, null, new IFileSystem.DoneOpen() { @Override public void doneOpen(IToken token, FileSystemException e, IFileHandle h) { error[0] = e; @@ -286,11 +286,18 @@ public class FileTransferService { if (callback != null) callback.done(peer, result); } - protected static void transferToTarget(IPeer peer, IFileSystem fileSystem, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) { + private static String lastSegment(String targetPath) { + int idx = targetPath.lastIndexOf('/'); + if (idx > 0) + return targetPath.substring(idx+1); + return targetPath; + } + + protected static void transferToTarget(IPeer peer, IFileSystem fileSystem, IFileTransferItem item, IProgressMonitor monitor, ICallback callback) { IStatus result = Status.OK_STATUS; - IPath targetPath = item.getTargetPath(); + String targetPath = item.getTargetPathString(); IPath hostPath = item.getHostPath(); BufferedInputStream inStream = null; @@ -300,60 +307,65 @@ public class FileTransferService { final FileSystemException[] error = new FileSystemException[1]; final FileAttrs[] attrs = new FileAttrs[1]; - // Check the target destination directory - for (int i = 0; i < targetPath.segmentCount(); i++) { - IPath tp = i + 1 < targetPath.segmentCount() ? targetPath.removeLastSegments(targetPath.segmentCount() - (i + 1)) : targetPath; - - error[0] = null; - attrs[0] = null; - - fileSystem.stat(tp.toString(), new IFileSystem.DoneStat() { - @Override - public void doneStat(IToken token, FileSystemException e, FileAttrs a) { - error[0] = e; - attrs[0] = a; - } - }); - - if (attrs[0] == null && i + 1 < targetPath.segmentCount()) { - error[0] = null; - attrs[0] = null; - - fileSystem.mkdir(tp.toString(), null, new IFileSystem.DoneMkDir() { - @Override - public void doneMkDir(IToken token, FileSystemException e) { - error[0] = e; - } - }); - if (error[0] != null) { - result = StatusHelper.getStatus(error[0]); - if (callback != null) callback.done(peer, result); - return; - } - - // Read the attributes of the created directory - error[0] = null; - attrs[0] = null; - - fileSystem.stat(tp.toString(), new IFileSystem.DoneStat() { - @Override - public void doneStat(IToken token, FileSystemException e, FileAttrs a) { - error[0] = e; - attrs[0] = a; - } - }); - } - } + // Read the attributes of the target + error[0] = null; + attrs[0] = null; + fileSystem.stat(targetPath, new IFileSystem.DoneStat() { + @Override + public void doneStat(IToken token, FileSystemException e, FileAttrs a) { + error[0] = e; + attrs[0] = a; + } + }); // If we get the attributes back, the name at least exist in the target file system - if (attrs[0] != null && attrs[0].isDirectory()) { - targetPath = targetPath.append(item.getHostPath().lastSegment()); + if (attrs[0] != null) { + if (attrs[0].isDirectory()) { + targetPath = targetPath + '/' + item.getHostPath().lastSegment(); + } + } else { + // Try to create the parent directory + for (int i = targetPath.indexOf('/'); i>=0; i = targetPath.indexOf('/', i+1)) { + if (i > 0) { + String path = targetPath.substring(0, i); + + error[0] = null; + attrs[0] = null; + + fileSystem.stat(path, new IFileSystem.DoneStat() { + @Override + public void doneStat(IToken token, FileSystemException e, FileAttrs a) { + error[0] = e; + attrs[0] = a; + } + }); + + if (attrs[0] == null) { + error[0] = null; + attrs[0] = null; + + fileSystem.mkdir(path, null, new IFileSystem.DoneMkDir() { + @Override + public void doneMkDir(IToken token, FileSystemException e) { + error[0] = e; + } + }); + + if (error[0] != null) { + result = StatusHelper.getStatus(error[0]); + if (callback != null) + callback.done(peer, result); + return; + } + } + } + } } try { // Open the remote file - fileSystem.open(targetPath.toString(), IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_TRUNC, null, new IFileSystem.DoneOpen() { + fileSystem.open(targetPath, IFileSystem.TCF_O_CREAT | IFileSystem.TCF_O_WRITE | IFileSystem.TCF_O_TRUNC, null, new IFileSystem.DoneOpen() { @Override public void doneOpen(IToken token, FileSystemException e, IFileHandle h) { error[0] = e; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties index 525d813eb..050e20f27 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.properties @@ -1,5 +1,5 @@ ################################################################################## -# Copyright (c) 2011, 2014 Wind River Systems, Inc. and others. All rights reserved. +# Copyright (c) 2011, 2015 Wind River Systems, 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 @@ -63,6 +63,7 @@ command.update.name = Update File command.commit.name = Commit File command.merge.name = Merge File command.revert.name = Revert File +command.download.name = Download Files command.delete.label=Delete command.delete.description=Delete the selected node @@ -82,6 +83,7 @@ command.label.paste = Paste command.label.delete = Delete command.label.rename = Rename command.label.move = Move +command.label.download = Download... command.newfile.label = &File command.newfolder.label = &Folder @@ -118,3 +120,4 @@ command.delete.mnemonic = D command.rename.mnemonic = R command.refresh.mnemonic = f command.move.mnemonic = M +command.download.mnemonic = l diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml index 393e9eb49..ca7e2f0e2 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml @@ -522,6 +522,22 @@ </with> </visibleWhen> </command> + <command + commandId="org.eclipse.tcf.te.tcf.filesystem.ui.download" + helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Download" + id="download" + label="%command.label.download" + mnemonic="%command.download.mnemonic" + style="push"> + <visibleWhen checkEnabled="false"> + <with variable="selection"> + <count value="+"/> + <iterate> + <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode"/> + </iterate> + </with> + </visibleWhen> + </command> <separator name="group.search" visible="true"> @@ -938,6 +954,25 @@ </with> </visibleWhen> </command> + <command + commandId="org.eclipse.tcf.te.tcf.filesystem.ui.download" + helpContextId="org.eclipse.tcf.te.tcf.filesystem.command_Download" + id="download" + label="%command.label.download" + mnemonic="%command.download.mnemonic" + style="push"> + <visibleWhen checkEnabled="false"> + <with variable="selection"> + <count value="+"/> + <iterate> + <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode"/> + <not> + <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/> + </not> + </iterate> + </with> + </visibleWhen> + </command> </menuContribution> <menuContribution @@ -1028,6 +1063,10 @@ id="org.eclipse.tcf.te.tcf.filesystem.commands.refreshViewer" name="%command.refreshViewer.name"> </command> + <command + id="org.eclipse.tcf.te.tcf.filesystem.ui.download" + name="%command.download.name"> + </command> </extension> <!-- Command handler contributions --> @@ -1382,6 +1421,35 @@ </enabledWhen> </handler> <handler + class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.DownloadFilesHandler" + commandId="org.eclipse.tcf.te.tcf.filesystem.ui.download"> + <activeWhen> + <and> + <with variable="activePartId"> + <or> + <equals value="org.eclipse.tcf.te.ui.views.View"/> + <equals value="org.eclipse.tcf.te.ui.views.Editor"/> + </or> + </with> + <with variable="selection"> + <iterate operator="and" ifEmpty="false"> + <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode"/> + </iterate> + </with> + </and> + </activeWhen> + <enabledWhen> + <with variable="selection"> + <iterate operator="and" ifEmpty="false"> + <instanceof value="org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode"/> + <not> + <test property="org.eclipse.tcf.te.tcf.filesystem.propertytester.treenode.isSystemRoot"/> + </not> + </iterate> + </with> + </enabledWhen> + </handler> + <handler class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers.RenameFilesHandler" commandId="org.eclipse.ui.edit.rename"> <activeWhen> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java index b212938f5..ce23977a6 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/CommonDnD.java @@ -12,7 +12,6 @@ package org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd; import static java.util.Arrays.asList; import java.io.File; -import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.IStatus; @@ -115,80 +114,6 @@ public class CommonDnD implements IConfirmCallback { return status.isOK(); } -// private ICallback getCopyCallback(final TreeViewer viewer, final String[] files, final IFSTreeNode target) { -// return new Callback() { -// @Override -// protected void internalDone(Object caller, IStatus status) { -// // mstodo handle via notifications -// if (status.isOK()) { -// IOpExecutor executor = new JobExecutor(getSelectionCallback(viewer, files, target)); -// executor.execute(new OpRefresh(target)); -// } -// } -// }; -// } - -// private ICallback getMoveCallback(final TreeViewer viewer, final String[] files, final IFSTreeNode target) { -// return new Callback() { -// @Override -// protected void internalDone(Object caller, IStatus status) { -// if (status.isOK()) { -// for (String path : files) { -// File file = new File(path); -// if (!file.delete()) { -// } -// } - // mstodo handle via notifications -// if (successful) { -// IRuntimeModel model = ModelManager.getRuntimeModel(target.getPeerNode()); -// IOpExecutor executor = new JobExecutor(getSelectionCallback(viewer, files, target)); -// executor.execute(new OpRefresh(model.getRoot())); -// } -// } -// } -// }; -// } - -// ICallback getSelectionCallback(final TreeViewer viewer, final String[] paths, final IFSTreeNode target) { -// return new Callback() { -// @Override -// protected void internalDone(Object caller, IStatus status) { -// if(status.isOK()) { -// List<IFSTreeNode> nodes = new ArrayList<IFSTreeNode>(); -// IFSTreeNode[] children = target.getChildren(true); -// for (String path : paths) { -// File file = new File(path); -// String name = file.getName(); -// for (IFSTreeNode child : children) { -// if (name.equals(child.getName())) { -// nodes.add(child); -// break; -// } -// } -// } -// if (viewer != null) { -// updateViewer(viewer, target, nodes); -// } -// } -// } -// }; -// } - -// protected void updateViewer(final TreeViewer viewer, final IFSTreeNode target, final List<IFSTreeNode> nodes) { -// if (Display.getCurrent() != null) { -// viewer.refresh(target); -// IStructuredSelection selection = new StructuredSelection(nodes.toArray()); -// viewer.setSelection(selection, true); -// } -// else { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable(){ -// @Override -// public void run() { -// updateViewer(viewer, target, nodes); -// }}); -// } -// } - /** * Perform the drop operation over dragged selection. * @@ -357,19 +282,6 @@ public class CommonDnD implements IConfirmCallback { anEvent.data = LocalSelectionTransfer.getTransfer().getSelection(); return true; } - else if (FileTransfer.getInstance().isSupportedType(anEvent.dataType)) { - IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection(); - List<IFSTreeNode> nodes = selection.toList(); - List<String> paths = new ArrayList<String>(); - for(IFSTreeNode node : nodes) { - File file = node.getCacheFile(); - if(file.exists()) { - paths.add(file.getAbsolutePath()); - } - } - if (!paths.isEmpty()) anEvent.data = paths.toArray(new String[paths.size()]); - return !paths.isEmpty(); - } return false; } } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java index 9163a6a39..d0d9d74eb 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/dnd/FSDragAdapterAssistant.java @@ -12,7 +12,6 @@ package org.eclipse.tcf.te.tcf.filesystem.ui.internal.dnd; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.dnd.DragSourceEvent; -import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.ui.navigator.CommonDragAdapterAssistant; @@ -46,7 +45,7 @@ public class FSDragAdapterAssistant extends CommonDragAdapterAssistant { */ @Override public Transfer[] getSupportedTransferTypes() { - return new Transfer[] {FileTransfer.getInstance()}; + return new Transfer[] {}; } /* diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java new file mode 100644 index 000000000..85f8e1717 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/DownloadFilesHandler.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.List; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.URIUtil; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IFSTreeNode; +import org.eclipse.tcf.te.tcf.filesystem.core.interfaces.runtime.IRuntimeModel; +import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin; +import org.eclipse.tcf.te.tcf.filesystem.ui.internal.operations.UiExecutor; +import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages; +import org.eclipse.ui.handlers.HandlerUtil; +/** + * The handler that downloads the selected files or folders to a local destination folder. + */ +public class DownloadFilesHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + Shell shell = HandlerUtil.getActiveShellChecked(event); + DirectoryDialog dlg = new DirectoryDialog(shell); + dlg.setFilterPath(getFilterPath()); + dlg.setText(Messages.DownloadFilesHandler_folderDlg_text); + dlg.setMessage(Messages.DownloadFilesHandler_folderDlg_message); + + String destination = dlg.open(); + if (destination == null) + return null; + + File destinationFile = new File(destination); + saveFilterPath(destinationFile); + + IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); + List<IFSTreeNode> nodes = selection.toList(); + IRuntimeModel peer = nodes.get(0).getRuntimeModel(); + UiExecutor.execute(peer.operationDownload(nodes, destinationFile, new MoveCopyCallback())); + return null; + } + + private String getFilterPath() { + String lastFolder = UIPlugin.getDefault().getDialogSettings().get(getClass().getName() + ".lastFolder"); //$NON-NLS-1$ + if (lastFolder != null) + return lastFolder; + Location loc = Platform.getInstanceLocation(); + if (loc != null) { + URL url = loc.getURL(); + try { + File file = URIUtil.toFile(url.toURI()); + if (file != null) + return file.getPath(); + } catch (URISyntaxException e) { + } + } + return null; + } + + private void saveFilterPath(File destinationFile) { + if (destinationFile != null) { + UIPlugin.getDefault().getDialogSettings().put(getClass().getName() + ".lastFolder", destinationFile.getPath()); //$NON-NLS-1$ + } + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java index d7536402c..b47d4e898 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/handlers/MoveCopyCallback.java @@ -9,6 +9,8 @@ *******************************************************************************/ package org.eclipse.tcf.te.tcf.filesystem.ui.internal.handlers; +import java.io.File; + import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.graphics.Image; @@ -41,15 +43,16 @@ public class MoveCopyCallback implements IConfirmCallback { */ @Override public int confirms(Object object) { - final IFSTreeNode node = (IFSTreeNode) object; + final boolean isDirectory = isDirectory(object); + final String name = getName(object); final int[] results = new int[1]; Display display = PlatformUI.getWorkbench().getDisplay(); display.syncExec(new Runnable() { @Override public void run() { Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - String title = node.isDirectory() ? Messages.FSOperation_ConfirmFolderReplaceTitle : Messages.FSOperation_ConfirmFileReplace; - String message = NLS.bind(node.isDirectory() ? Messages.FSOperation_ConfirmFolderReplaceMessage : Messages.FSOperation_ConfirmFileReplaceMessage, node.getName()); + String title = isDirectory ? Messages.FSOperation_ConfirmFolderReplaceTitle : Messages.FSOperation_ConfirmFileReplace; + String message = NLS.bind(isDirectory ? Messages.FSOperation_ConfirmFolderReplaceMessage : Messages.FSOperation_ConfirmFileReplaceMessage, name); final Image titleImage = UIPlugin.getImage(ImageConsts.REPLACE_FOLDER_CONFIRM); MessageDialog qDialog = new MessageDialog(parent, title, null, message, MessageDialog.QUESTION, new String[] { Messages.FSOperation_ConfirmDialogYes, Messages.FSOperation_ConfirmDialogYesToAll, Messages.FSOperation_ConfirmDialogNo, Messages.FSOperation_ConfirmDialogCancel }, 0) { @Override @@ -63,4 +66,20 @@ public class MoveCopyCallback implements IConfirmCallback { return results[0]; } + private String getName(Object object) { + if (object instanceof IFSTreeNode) + return ((IFSTreeNode) object).getName(); + if (object instanceof File) + return ((File) object).getName(); + return String.valueOf(object); + } + + private boolean isDirectory(Object object) { + if (object instanceof IFSTreeNode) + return ((IFSTreeNode) object).isDirectory(); + if (object instanceof File) + return ((File) object).isDirectory(); + return false; + } + } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java index da365d3ae..38931ed20 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/operations/UiExecutor.java @@ -61,7 +61,7 @@ public class UiExecutor { } }); } catch (InvocationTargetException e) { - ref.set(StatusHelper.getStatus(e)); + ref.set(StatusHelper.getStatus(e.getTargetException())); } catch (InterruptedException e) { return Status.CANCEL_STATUS; } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java index 53f8ac980..3fd9bf9c7 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java @@ -114,6 +114,8 @@ public class Messages extends NLS { public static String DeleteFilesHandler_DeleteMultipleFilesConfirmation; public static String DeleteFilesHandler_DeleteOneFileConfirmation; public static String DeleteFilesHandler_ConfirmDialogTitle; + public static String DownloadFilesHandler_folderDlg_message; + public static String DownloadFilesHandler_folderDlg_text; public static String FSRenamingAssistant_NameAlreadyExists; public static String FSRenamingAssistant_SpecifyNonEmptyName; public static String FSRenamingAssistant_UnixIllegalCharacters; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties index 89b2d4a7d..33a0fe182 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties @@ -36,6 +36,8 @@ DateValidator_YearOutofRange=The year is a number which is bigger than zero. DeleteFilesHandler_ConfirmDialogTitle=Confirm Delete DeleteFilesHandler_DeleteMultipleFilesConfirmation=Are you sure you want to delete these {0} files/folders? DeleteFilesHandler_DeleteOneFileConfirmation=Are you sure you want to delete ''{0}''? +DownloadFilesHandler_folderDlg_message=Select the destination folder: +DownloadFilesHandler_folderDlg_text=Download Files FSRenamingAssistant_NameAlreadyExists=A file/folder with the name you specified already exists\! Specify a different name. FSRenamingAssistant_SpecifyNonEmptyName=Specify a non-empty name. FSRenamingAssistant_UnixIllegalCharacters=File or folder name cannot contain any of the following characters:\n/ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/model/ModelTestCase.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/model/ModelTestCase.java index dd6296c0a..41bfe514c 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/model/ModelTestCase.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/model/ModelTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2012, 2015 Wind River Systems, 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 @@ -158,11 +158,11 @@ public class ModelTestCase extends CoreTestCase { FileTransferItem item1 = new FileTransferItem(); assertNotNull("Failed to create empty file transfer item!", item1); //$NON-NLS-1$ - FileTransferItem item2 = new FileTransferItem(new Path("/folk/uwe/tmp/cobble.out"), new Path("/root/cobble.out")); //$NON-NLS-1$ //$NON-NLS-2$ + FileTransferItem item2 = new FileTransferItem(new Path("/folk/uwe/tmp/cobble.out"), "/root/cobble.out"); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("Failed to create file transfer item from pathes!", item2); //$NON-NLS-1$ - assertNotNull("Unexpected value 'null' for item2.getTargetPath()!", item2.getTargetPath()); //$NON-NLS-1$ - assertEquals("Invalid target path!", "/root/cobble.out", item2.getTargetPath().toString()); //$NON-NLS-1$ //$NON-NLS-2$ + assertNotNull("Unexpected value 'null' for item2.getTargetPath()!", item2.getTargetPathString()); //$NON-NLS-1$ + assertEquals("Invalid target path!", "/root/cobble.out", item2.getTargetPathString().toString()); //$NON-NLS-1$ //$NON-NLS-2$ assertNotNull("Unexpected value 'null' for item2.getHostPath()!", item2.getHostPath()); //$NON-NLS-1$ assertEquals("Invalid host path!", "/folk/uwe/tmp/cobble.out", item2.getHostPath().toString()); //$NON-NLS-1$ //$NON-NLS-2$ assertTrue("Unexpected value 'false' for item2.isEnabled()!",item2.isEnabled()); //$NON-NLS-1$ diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/url/URLTestBase.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/url/URLTestBase.java index 0c78dc7e9..474b5face 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/url/URLTestBase.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/url/URLTestBase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2012, 2015 Wind River Systems, 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 @@ -11,11 +11,15 @@ package org.eclipse.tcf.te.tests.tcf.filesystem.url; import java.io.BufferedOutputStream; import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import org.eclipse.tcf.te.tcf.filesystem.core.internal.url.TcfURLConnection; +import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager; import org.eclipse.tcf.te.tests.tcf.filesystem.FSPeerTestCase; public class URLTestBase extends FSPeerTestCase { @@ -46,6 +50,11 @@ public class URLTestBase extends FSPeerTestCase { protected void writeFileContent(String content) throws IOException { printDebugMessage("Write file " + testFile.getLocation() + "..."); //$NON-NLS-1$ //$NON-NLS-2$ + try { + // last modification time needs to change + Thread.sleep(1000); + } catch (InterruptedException e) { + } BufferedOutputStream output = null; try { URL url = testFile.getLocationURL(); @@ -66,4 +75,18 @@ public class URLTestBase extends FSPeerTestCase { } } } + + protected void writeCacheFileContent(String content) throws IOException { + try { + // last modification time needs to change + Thread.sleep(1); + } catch (InterruptedException e) { + } + File file = CacheManager.getCacheFile(testFile); + BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + writer.write(content); + writer.close(); + } + + } diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/utils/StateManagerTest.java b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/utils/StateManagerTest.java index 9fc05f521..609c01438 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/utils/StateManagerTest.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tests/src/org/eclipse/tcf/te/tests/tcf/filesystem/utils/StateManagerTest.java @@ -9,16 +9,9 @@ *******************************************************************************/ package org.eclipse.tcf.te.tests.tcf.filesystem.utils; -import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; -import java.util.concurrent.TimeoutException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.tcf.te.runtime.callback.Callback; -import org.eclipse.tcf.te.tcf.core.concurrent.Rendezvous; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.CacheManager; -import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.FileState; import org.eclipse.tcf.te.tcf.filesystem.core.internal.utils.PersistenceManager; import org.eclipse.tcf.te.tcf.filesystem.core.model.CacheState; @@ -30,57 +23,30 @@ public class StateManagerTest extends UtilsTestBase { updateCache(testFile); CacheState cacheState = testFile.getCacheState(); assertEquals(CacheState.consistent, cacheState); - Thread.sleep(5000L); } public void testCacheStateModified() throws Exception { cleanUp(); writeFileContent("hello,world!"); //$NON-NLS-1$ updateCache(testFile); - File file = CacheManager.getCacheFile(testFile); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("hello, test!"); //$NON-NLS-1$ - writer.close(); + writeCacheFileContent("hello, test!"); //$NON-NLS-1$ updateCacheState(); CacheState cacheState = testFile.getCacheState(); assertEquals(CacheState.modified, cacheState); - Thread.sleep(5000L); } - private void updateCacheState() throws TimeoutException { - FileState digest = PersistenceManager.getInstance().getFileDigest(testFile); - final Rendezvous rendezvous = new Rendezvous(); - digest.updateState(new Callback(){ - @Override - protected void internalDone(Object caller, IStatus status) { - rendezvous.arrive(); - } - }); - rendezvous.waiting(10000); + private void updateCacheState() { + assertTrue(testFile.operationRefresh(false).run(null).isOK()); } - private void refreshCacheState() throws TimeoutException { - final Rendezvous rendezvous = new Rendezvous(); - testFile.operationRefresh(true).runInJob(new Callback(){ - @Override - protected void internalDone(Object caller, IStatus status) { - rendezvous.arrive(); - } - }); - rendezvous.waiting(10000); - } - - public void testCacheStateOutdated() throws Exception { cleanUp(); writeFileContent("hello,world!"); //$NON-NLS-1$ updateCache(testFile); - Thread.sleep(2000L); writeFileContent("hello,test!"); //$NON-NLS-1$ - refreshCacheState(); + updateCacheState(); CacheState cacheState = testFile.getCacheState(); assertEquals(CacheState.outdated, cacheState); - Thread.sleep(5000L); } private void cleanUp() { @@ -96,15 +62,10 @@ public class StateManagerTest extends UtilsTestBase { writeFileContent("hello,world!"); //$NON-NLS-1$ updateCache(testFile); writeFileContent("hello,test!"); //$NON-NLS-1$ - refreshCacheState(); - Thread.sleep(2000L); - File file = CacheManager.getCacheFile(testFile); - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); - writer.write("hello, earth!"); //$NON-NLS-1$ - writer.close(); + updateCacheState(); + writeCacheFileContent("hello, earth!"); //$NON-NLS-1$ updateCacheState(); CacheState cacheState = testFile.getCacheState(); assertEquals(CacheState.conflict, cacheState); - Thread.sleep(5000L); } } |