diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.core')
27 files changed, 1763 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.classpath new file mode 100644 index 000000000..8a8f1668c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.options b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.options new file mode 100644 index 000000000..4367d1867 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.tcf.core/debug/channels = false diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.project b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.project new file mode 100644 index 000000000..ad68b6b11 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.project @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tcf.te.tcf.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <filteredResources>
+ <filter>
+ <id>1311579476519</id>
+ <name></name>
+ <type>10</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-target</arguments>
+ </matcher>
+ </filter>
+ </filteredResources>
+</projectDescription>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..c56a6854b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Fri Oct 07 16:14:02 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
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..434836052 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Fri Oct 07 16:14:02 CEST 2011
+eclipse.preferences.version=1
+formatter_profile=_Target Explorer Java STD
+formatter_settings_version=12
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF new file mode 100644 index 000000000..e5302f890 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.tcf.core;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.tcf.core;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.tcf.core, + org.eclipse.tcf.te.tcf.core.activator;x-internal:=true, + org.eclipse.tcf.te.tcf.core.interfaces, + org.eclipse.tcf.te.tcf.core.interfaces.listeners, + org.eclipse.tcf.te.tcf.core.internal;x-internal:=true, + org.eclipse.tcf.te.tcf.core.internal.interfaces;x-internal:=true, + org.eclipse.tcf.te.tcf.core.internal.listener;x-internal:=true, + org.eclipse.tcf.te.tcf.core.internal.nls;x-internal:=true, + org.eclipse.tcf.te.tcf.core.internal.utils;x-internal:=true, + org.eclipse.tcf.te.tcf.core.streams, + org.eclipse.tcf.te.tcf.core.utils diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/build.properties new file mode 100644 index 000000000..30b2fc40b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + plugin.xml diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties new file mode 100644 index 000000000..ff3ae2476 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.properties @@ -0,0 +1,12 @@ +################################################################################## +# Copyright (c) 2011 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 +################################################################################## + +pluginName = Target Explorer, Common TCF Extensions +providerName = Eclipse.org diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml new file mode 100644 index 000000000..994d0debe --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/plugin.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + +<!-- TCF framework startup participant --> + <extension point="org.eclipse.tcf.startup"> + <class name="org.eclipse.tcf.te.tcf.core.internal.Startup"/> + </extension> + +</plugin> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/pom.xml new file mode 100644 index 000000000..bbc6d0d4c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/pom.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.tcf</groupId> + <artifactId>tcf-parent</artifactId> + <version>1.0.0-SNAPSHOT</version> + <relativePath>../../../pom.xml</relativePath> + </parent> + + <version>1.0.0.qualifier</version> + <artifactId>org.eclipse.tcf.te.tcf.core</artifactId> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/Tcf.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/Tcf.java new file mode 100644 index 000000000..6a7bcbfc1 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/Tcf.java @@ -0,0 +1,298 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdapterManager; +import org.eclipse.core.runtime.Platform; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.protocol.Protocol.ChannelOpenListener; +import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager; +import org.eclipse.tcf.te.tcf.core.interfaces.listeners.IChannelStateChangeListener; +import org.eclipse.tcf.te.tcf.core.interfaces.listeners.IProtocolStateChangeListener; +import org.eclipse.tcf.te.tcf.core.internal.ChannelManager; +import org.eclipse.tcf.te.tcf.core.internal.Startup; +import org.eclipse.tcf.te.tcf.core.internal.interfaces.IChannelOpenListener; +import org.eclipse.tcf.te.tcf.core.internal.listener.InternalChannelOpenListener; + + +/** + * The main entry point to access the TCF framework extensions. + */ +public final class Tcf { + /* default */ IChannelManager channelManager; + + /* default */ ChannelOpenListener channelOpenListener; + + /* default */ final List<IProtocolStateChangeListener> protocolStateChangeListeners = new ArrayList<IProtocolStateChangeListener>(); + /* default */ final List<IChannelStateChangeListener> channelStateChangeListeners = new ArrayList<IChannelStateChangeListener>(); + + + /* + * Thread save singleton instance creation. + */ + private static class LazyInstance { + public static Tcf instance = new Tcf(); + } + + /** + * Constructor. + */ + /* default */ Tcf() { + super(); + } + + /** + * Returns the singleton instance. + */ + /* default */ static Tcf getInstance() { + return LazyInstance.instance; + } + + /** + * Executes the given runnable within the TCF protocol dispatch thread. + * <p> + * <b>Note:</b> Code which is executed in the TCF protocol dispatch thread + * cannot use any blocking API! + * + * @param runnable The runnable. Must not be <code>null</code>. + */ + private static final void runSafe(Runnable runnable) { + Assert.isNotNull(runnable); + + if (Protocol.isDispatchThread()) { + runnable.run(); + } else { + Protocol.invokeAndWait(runnable); + } + } + + /** + * Adds a listener that will be notified once the TCF framework state changes. + * + * @param listener The listener. Must not be <code>null</code>. + */ + public static final void addProtocolStateChangeListener(IProtocolStateChangeListener listener) { + Assert.isTrue(Protocol.isDispatchThread()); + Assert.isNotNull(listener); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + if (!tcf.protocolStateChangeListeners.contains(listener)) { + tcf.protocolStateChangeListeners.add(listener); + } + } + + /** + * Removes the specified protocol state change listener. + * + * @param listener The listener. Must not be <code>null</code>. + */ + public static final void removeProtocolStateChangeListener(IProtocolStateChangeListener listener) { + Assert.isTrue(Protocol.isDispatchThread()); + Assert.isNotNull(listener); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + tcf.protocolStateChangeListeners.remove(listener); + } + + /** + * Adds a listener that will be notified once the TCF framework state changes. + * + * @param listener The listener. Must not be <code>null</code>. + */ + public static final void addChannelStateChangeListener(IChannelStateChangeListener listener) { + Assert.isTrue(Protocol.isDispatchThread()); + Assert.isNotNull(listener); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + if (!tcf.channelStateChangeListeners.contains(listener)) { + tcf.channelStateChangeListeners.add(listener); + } + } + + /** + * Removes the specified protocol state change listener. + * + * @param listener The listener. Must not be <code>null</code>. + */ + public static final void removeChannelStateChangeListener(IChannelStateChangeListener listener) { + Assert.isTrue(Protocol.isDispatchThread()); + Assert.isNotNull(listener); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + tcf.channelStateChangeListeners.remove(listener); + } + + /** + * Fires the channel state change listeners. + * + * @param channel The channel which changed state. Must not be <code>null</code>. + * @param state The new state. + */ + public static final void fireChannelStateChangeListeners(final IChannel channel, final int state) { + Assert.isTrue(Protocol.isDispatchThread()); + Assert.isNotNull(channel); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + final IChannelStateChangeListener[] listeners = tcf.channelStateChangeListeners.toArray(new IChannelStateChangeListener[tcf.channelStateChangeListeners.size()]); + if (listeners.length > 0) { + for (IChannelStateChangeListener listener : listeners) { + listener.stateChanged(channel, state); + } + } + } + + /** + * Returns if or if not the TCF framework is up and running. + * + * @return <code>True</code> if the framework is up and running, <code>false</code> otherwise. + */ + public static final boolean isRunning() { + return Startup.isStarted(); + } + + /** + * Startup TCF related services and listeners once the core + * TCF framework starts up. + * <p> + * <b>Note:</b> The method is expected to be called within the TCF protocol dispatch thread. + * + * @see Startup#setStarted(boolean) + */ + public static void start() { + Assert.isTrue(Protocol.isDispatchThread()); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + // Create and register the global channel open listener + if (tcf.channelOpenListener == null) { + tcf.channelOpenListener = new InternalChannelOpenListener(); + Protocol.addChannelOpenListener(tcf.channelOpenListener); + } + + // Signal (asynchronously) to interested listeners that we've started up + final IProtocolStateChangeListener[] listeners = tcf.protocolStateChangeListeners.toArray(new IProtocolStateChangeListener[tcf.protocolStateChangeListeners.size()]); + if (listeners.length > 0) { + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + for (IProtocolStateChangeListener listener : listeners) { + listener.stateChanged(true); + } + } + }); + } + } + + /** + * Shutdown TCF related services and listeners once the core + * TCF framework shuts down. + * <p> + * <b>Note:</b> The method is expected to be called within the TCF protocol dispatch thread. + * + * @see Startup#setStarted(boolean) + */ + public static void stop() { + Assert.isTrue(Protocol.isDispatchThread()); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + // Unregister the channel open listener of created + if (tcf.channelOpenListener != null) { + Protocol.removeChannelOpenListener(tcf.channelOpenListener); + tcf.channelOpenListener = null; + } + + // Signal to interested listeners that we've just went down + final IProtocolStateChangeListener[] listeners = tcf.protocolStateChangeListeners.toArray(new IProtocolStateChangeListener[tcf.protocolStateChangeListeners.size()]); + if (listeners.length > 0) { + // Catch IllegalStateException: TCF event dispatcher might have been shut down already + try { + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + for (IProtocolStateChangeListener listener : listeners) { + listener.stateChanged(false); + } + } + }); + } catch (IllegalStateException e) { /* ignored on purpose */ } + } + } + + /** + * Returns the channel manager instance. + * <p> + * <b>Note:</b> The method will create the channel manager instance on + * first invocation. + * + * @return The channel manager instance. + */ + public static IChannelManager getChannelManager() { + final Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + runSafe(new Runnable() { + @Override + public void run() { + Assert.isTrue(Protocol.isDispatchThread()); + + if (tcf.channelManager == null) { + // We have to create the channel manager + tcf.channelManager = new ChannelManager(); + } + } + }); + + return tcf.channelManager; + } + + /** + * Returns an object which is an instance of the given class associated with the given object. + * Returns <code>null</code> if no such object can be found. + * + * @param adapter The type of adapter to look up + * @return An object castable to the given adapter type, or <code>null</code> + * if the given adaptable object does not have an available adapter of the given type + * + * @see IAdapterManager#getAdapter(Object, Class) + */ + public static Object getAdapter(Class<?> adapter) { + Assert.isNotNull(adapter); + + Tcf tcf = getInstance(); + Assert.isNotNull(tcf); + + if (IChannelManager.class.equals(adapter)) { + return tcf.channelManager; + } + if (IChannelOpenListener.class.equals(adapter)) { + return tcf.channelOpenListener; + } + + return Platform.getAdapterManager().getAdapter(tcf, adapter); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/activator/CoreBundleActivator.java new file mode 100644 index 000000000..e716a3b8d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/activator/CoreBundleActivator.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.activator; + +import org.eclipse.tcf.te.tcf.core.internal.Startup; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + + +/** + * The activator class controls the plug-in life cycle + */ +public class CoreBundleActivator implements BundleActivator { + // The bundle context + private static BundleContext context; + + /** + * Returns the bundle context + * + * @return the bundle context + */ + public static BundleContext getContext() { + return context; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getContext() != null && getContext().getBundle() != null) { + return getContext().getBundle().getSymbolicName(); + } + return null; + } + + /* (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext bundleContext) throws Exception { + CoreBundleActivator.context = bundleContext; + } + + /* (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext bundleContext) throws Exception { + CoreBundleActivator.context = null; + + // Mark the core framework as not started anymore + Startup.setStarted(false); + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java new file mode 100644 index 000000000..b7d7aca1f --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/IChannelManager.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.interfaces; + +import java.util.Map; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.protocol.IPeer; + +/** + * TCF channel manager public API declaration. + */ +public interface IChannelManager extends IAdaptable { + + /** + * Client call back interface for openChannel(...). + */ + interface DoneOpenChannel { + /** + * Called when the channel fully opened or failed to open. + * + * @param error The error description if operation failed, <code>null</code> if succeeded. + * @param channel The channel object or <code>null</code>. + */ + void doneOpenChannel(Throwable error, IChannel channel); + } + + /** + * Opens a new channel to communicate with the given peer. + * <p> + * The method can be called from any thread context. + * + * @param peer The peer. Must not be <code>null</code>. + * @param done The client callback. Must not be <code>null</code>. + */ + public void openChannel(IPeer peer, DoneOpenChannel done); + + /** + * Opens a new channel to communicate with the peer described by the + * given peer attributes. + * <p> + * The method can be called from any thread context. + * + * @param peerAttributes The peer attributes. Must not be <code>null</code>. + * @param done The client callback. Must not be <code>null</code>. + */ + public void openChannel(Map<String, String> peerAttributes, DoneOpenChannel done); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java new file mode 100644 index 000000000..b218febea --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/ITransportTypes.java @@ -0,0 +1,45 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.core.interfaces;
+
+/**
+ * Declaration of the TCF transport type constants.
+ * <p>
+ * The constants defined in this interface needs to be kept in sync with
+ * the TCF framework transport manager implementation. Probably the interface
+ * should be moved to the core TCF framework plug-in's some when.
+ */
+public interface ITransportTypes {
+
+ /**
+ * Transport type "TCP".
+ */
+ public static final String TRANSPORT_TYPE_TCP = "TCP"; //$NON-NLS-1$
+
+ /**
+ * Transport type "SSL".
+ */
+ public static final String TRANSPORT_TYPE_SSL = "SSL"; //$NON-NLS-1$
+
+ /**
+ * Transport type "PIPE".
+ */
+ public static final String TRANSPORT_TYPE_PIPE = "PIPE"; //$NON-NLS-1$
+
+ /**
+ * Transport type "Loop".
+ */
+ public static final String TRANSPORT_TYPE_LOOP = "Loop"; //$NON-NLS-1$
+
+ /**
+ * Custom transport type.
+ */
+ public static final String TRANSPORT_TYPE_CUSTOM = "Custom"; //$NON-NLS-1$
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/listeners/IChannelStateChangeListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/listeners/IChannelStateChangeListener.java new file mode 100644 index 000000000..3257bd225 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/listeners/IChannelStateChangeListener.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.interfaces.listeners; + +import org.eclipse.tcf.protocol.IChannel; + +/** + * Interface for clients to implement that wishes to listen + * channel state changes, like opening and closing of a channel. + */ +public interface IChannelStateChangeListener { + + /** + * Invoked if the channel state has changed. + * + * @param channel The channel which changed state. + * @param state The new state. + */ + public void stateChanged(IChannel channel, int state); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/listeners/IProtocolStateChangeListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/listeners/IProtocolStateChangeListener.java new file mode 100644 index 000000000..ff69500f8 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/interfaces/listeners/IProtocolStateChangeListener.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.interfaces.listeners; + +/** + * Interface for clients to implement that wishes to listen + * for the TCF protocol framework to come up and shutdown. + */ +public interface IProtocolStateChangeListener { + + /** + * Invoked if the TCF framework comes up, <i>state == true</i>, or + * if it shuts down, <i>state == false</i>. + * + * @param state The current TCF framework state. + */ + public void stateChanged(boolean state); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java new file mode 100644 index 000000000..1be6135fa --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java @@ -0,0 +1,162 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.internal; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.tcf.core.AbstractPeer; +import org.eclipse.tcf.core.TransientPeer; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.protocol.IPeer; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager; + + +/** + * TCF channel manager implementation. + */ +public final class ChannelManager extends PlatformObject implements IChannelManager { + + /** + * Constructor. + */ + public ChannelManager() { + super(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager#openChannel(org.eclipse.tcf.protocol.IPeer, org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel) + */ + @Override + public void openChannel(final IPeer peer, final DoneOpenChannel done) { + if (Protocol.isDispatchThread()) { + internalOpenChannel(peer, done); + } else { + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + internalOpenChannel(peer, done); + } + }); + } + } + + /** + * Internal implementation of {@link #openChannel(IPeer, org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel)}. + * <p> + * Method must be called within the TCF dispatch thread. + * + * @param peer The peer. Must not be <code>null</code>. + * @param done The client callback. Must not be <code>null</code>. + */ + /* default */ void internalOpenChannel(final IPeer peer, final DoneOpenChannel done) { + Assert.isNotNull(peer); + Assert.isNotNull(done); + Assert.isTrue(Protocol.isDispatchThread()); + + // Open the channel + final IChannel channel = peer.openChannel(); + // Register the channel listener + if (channel != null) { + channel.addChannelListener(new IChannel.IChannelListener() { + + @Override + public void onChannelOpened() { + // Remove ourself as listener from the channel + channel.removeChannelListener(this); + // Channel opening succeeded + done.doneOpenChannel(null, channel); + } + + @Override + public void onChannelClosed(Throwable error) { + // Remove ourself as listener from the channel + channel.removeChannelListener(this); + // Channel opening failed + done.doneOpenChannel(error, channel); + } + + @Override + public void congestionLevel(int level) { + // ignored + } + }); + } else { + // Channel is null? Something went terrible wrong. + done.doneOpenChannel(new Exception("Unexpected null return value from IPeer#openChannel()!"), null); //$NON-NLS-1$ + } + + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager#openChannel(java.util.Map, org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel) + */ + @Override + public void openChannel(final Map<String, String> peerAttributes, final DoneOpenChannel done) { + if (Protocol.isDispatchThread()) { + internalOpenChannel(peerAttributes, done); + } else { + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + internalOpenChannel(peerAttributes, done); + } + }); + } + } + + /** + * Internal implementation of {@link #openChannel(Map, org.eclipse.tcf.te.tcf.core.interfaces.IChannelManager.DoneOpenChannel)}. + * <p> + * Method must be called within the TCF dispatch thread. + * + * @param peerAttributes The peer attributes. Must not be <code>null</code>. + * @param done The client callback. Must not be <code>null</code>. + */ + /* default */ void internalOpenChannel(final Map<String, String> peerAttributes, final DoneOpenChannel done) { + Assert.isNotNull(peerAttributes); + Assert.isNotNull(done); + Assert.isTrue(Protocol.isDispatchThread()); + internalOpenChannel(getOrCreatePeerInstance(peerAttributes), done); + } + + /** + * Tries to find an existing peer instance or create an new {@link IPeer} + * instance if not found. + * <p> + * <b>Note:</b> This method must be invoked at the TCF dispatch thread. + * + * @param peerAttributes The peer attributes. Must not be <code>null</code>. + * @return The peer instance. + */ + private IPeer getOrCreatePeerInstance(final Map<String, String> peerAttributes) { + Assert.isNotNull(peerAttributes); + Assert.isTrue(Protocol.isDispatchThread()); + + // Get the peer id from the properties + String peerId = peerAttributes.get(IPeer.ATTR_ID); + Assert.isNotNull(peerId); + + // Check if we shall open the peer transient + boolean isTransient = peerAttributes.containsKey("transient") ? Boolean.parseBoolean(peerAttributes.remove("transient")) : false; //$NON-NLS-1$ //$NON-NLS-2$ + + // Look the peer via the Locator Service. + IPeer peer = Protocol.getLocator().getPeers().get(peerId); + // If not peer could be found, create a new one + if (peer == null) { + peer = isTransient ? new TransientPeer(peerAttributes) : new AbstractPeer(peerAttributes); + } + + // Return the peer instance + return peer; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/Startup.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/Startup.java new file mode 100644 index 000000000..0cae997dc --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/Startup.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.internal; + +import java.util.concurrent.atomic.AtomicBoolean; + +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.tcf.core.Tcf; +import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator; + + +/** + * Class loaded by the TCF core framework when the framework is fired up. The static + * constructor of the class will trigger whatever is necessary in this case. + * <p> + * <b>Note:</b> This will effectively trigger {@link CoreBundleActivator#start(org.osgi.framework.BundleContext)} + * to be called. + */ +public class Startup { + // Atomic boolean to store the started state of the TCF core framework + /* default */ final static AtomicBoolean STARTED = new AtomicBoolean(false); + + static { + // We might get here on shutdown as well, and if TCF has not + // been loaded, than we will run into an NPE. Lets double check. + if (Protocol.getEventQueue() != null) { + // Initialize the framework status by scheduling a simple + // runnable to execute and be invoked once the framework + // is fully up and usable. + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + // Core framework is scheduling the runnables, means it is started. + setStarted(true); + } + }); + } + } + + /** + * Set the core framework started state to the given state. + * + * @param started <code>True</code> when the framework is started, <code>false</code> otherwise. + */ + public static final void setStarted(boolean started) { + STARTED.set(started); + + // Start/Stop should be called in the TCF protocol dispatch thread + if (Protocol.getEventQueue() != null) { + // Catch IllegalStateException: TCF event dispatcher has shut down + try { + Protocol.invokeLater(new Runnable() { + @Override + public void run() { + if (STARTED.get()) Tcf.start(); else Tcf.stop(); + } + }); + } catch (IllegalStateException e) { + if (!STARTED.get() && "TCF event dispatcher has shut down".equals(e.getLocalizedMessage())) { //$NON-NLS-1$ + // ignore the exception on shutdown + } else { + // re-throw in any other case + throw e; + } + } + } + } + + /** + * Returns if or if not the core framework has been started. + * + * @return <code>True</code> when the framework is started, <code>false</code> otherwise. + */ + public static final boolean isStarted() { + return STARTED.get(); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/interfaces/IChannelOpenListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/interfaces/IChannelOpenListener.java new file mode 100644 index 000000000..f665ad52b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/interfaces/IChannelOpenListener.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.internal.interfaces; + +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.protocol.Protocol.ChannelOpenListener; + +/** + * Enhanced channel open listener interface for internal use. + */ +public interface IChannelOpenListener extends ChannelOpenListener { + + /** + * Stores the given channel listener to the internal map. The map + * key is the given channel. If the given channel listener is <code>null</code>, + * the channel is removed from the internal map. + * + * @param channel The channel. Must not be <code>null</code>. + * @param listener The channel listener or <code>null</code>. + */ + public void setChannelListener(IChannel channel, IChannel.IChannelListener listener); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/listener/InternalChannelListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/listener/InternalChannelListener.java new file mode 100644 index 000000000..8f77376ad --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/listener/InternalChannelListener.java @@ -0,0 +1,100 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.internal.listener; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.tcf.core.Tcf; +import org.eclipse.tcf.te.tcf.core.internal.interfaces.IChannelOpenListener; +import org.eclipse.tcf.te.tcf.core.internal.nls.Messages; +import org.eclipse.tcf.te.tcf.core.internal.utils.LogUtils; + + +/** + * Internal channel listener. Attached to a TCF channel for tracing purpose. + */ +public class InternalChannelListener implements IChannel.IChannelListener { + // The reference to the channel + private final IChannel channel; + + /** + * Constructor. + * + * @param channel The channel. Must not be <code>null</code>. + */ + public InternalChannelListener(IChannel channel) { + Assert.isNotNull(channel); + this.channel = channel; + } + + /** + * Return the associated channel. + * + * @return The channel instance. + */ + protected final IChannel getChannel() { + return channel; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.protocol.IChannel.IChannelListener#congestionLevel(int) + */ + @Override + public void congestionLevel(int level) { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.protocol.IChannel.IChannelListener#onChannelClosed(java.lang.Throwable) + */ + @Override + public void onChannelClosed(Throwable error) { + Assert.isTrue(Protocol.isDispatchThread()); + + // Detach the listeners cleanly + detachListeners(getChannel()); + + // Construct the cause message + String cause = ""; //$NON-NLS-1$ + if (error != null) { + cause = NLS.bind(Messages.InternalChannelListener_onChannelClosed_cause, error.getLocalizedMessage()); + } + + // Trace the channel closing + LogUtils.logMessageForChannel(getChannel(), NLS.bind(Messages.InternalChannelListener_onChannelClosed_message, cause), "debug/channels", this); //$NON-NLS-1$ + + // Fire the property change event for the channel + Tcf.fireChannelStateChangeListeners(getChannel(), IChannel.STATE_CLOSED); + } + + /** + * Detach all registered listeners from the given channel. + * + * @param channel The channel. Must not be <code>null</code>. + */ + protected void detachListeners(IChannel channel) { + Assert.isNotNull(channel); + + // Cleanly remove all listeners from the channel + channel.removeChannelListener(this); + + // And remove the listener references from the global channel open listener + IChannelOpenListener openListener = (IChannelOpenListener)Tcf.getAdapter(IChannelOpenListener.class); + if (openListener != null) openListener.setChannelListener(channel, null); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.protocol.IChannel.IChannelListener#onChannelOpened() + */ + @Override + public void onChannelOpened() { + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/listener/InternalChannelOpenListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/listener/InternalChannelOpenListener.java new file mode 100644 index 000000000..9d5e093c4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/listener/InternalChannelOpenListener.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.internal.listener; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.protocol.IChannel.IChannelListener; +import org.eclipse.tcf.protocol.Protocol; +import org.eclipse.tcf.te.tcf.core.Tcf; +import org.eclipse.tcf.te.tcf.core.internal.interfaces.IChannelOpenListener; +import org.eclipse.tcf.te.tcf.core.internal.nls.Messages; +import org.eclipse.tcf.te.tcf.core.internal.utils.LogUtils; + + +/** + * Internal channel open listener taking care of logging and caching. + */ +public class InternalChannelOpenListener implements IChannelOpenListener { + // Static map containing the channel listeners per channel. Access to the + // map should happen from the TCF protocol dispatch thread only. + private final Map<IChannel, IChannel.IChannelListener> channelListeners = new HashMap<IChannel, IChannel.IChannelListener>(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.protocol.Protocol.ChannelOpenListener#onChannelOpen(org.eclipse.tcf.protocol.IChannel) + */ + @Override + public void onChannelOpen(IChannel channel) { + Assert.isNotNull(channel); + Assert.isTrue(Protocol.isDispatchThread()); + + // Trace the channel opening + LogUtils.logMessageForChannel(channel, Messages.InternalChannelOpenListener_onChannelOpen_message, "debug/channels", this); //$NON-NLS-1$ + + // As the channel has just opened, there should be no channel listener, but better be safe and check. + IChannel.IChannelListener channelListener = channelListeners.remove(channel); + if (channelListener != null) channel.removeChannelListener(channelListener); + // Create a new channel listener instance + channelListener = new InternalChannelListener(channel); + // Add the channel listener to the global map + setChannelListener(channel, channelListener); + // Attach channel listener to the channel + channel.addChannelListener(channelListener); + + // Fire the property change event for the channel + Tcf.fireChannelStateChangeListeners(channel, IChannel.STATE_OPEN); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.tcf.core.internal.interfaces.IChannelOpenListener#setChannelListener(org.eclipse.tcf.protocol.IChannel, org.eclipse.tcf.protocol.IChannel.IChannelListener) + */ + @Override + public void setChannelListener(IChannel channel, IChannelListener listener) { + Assert.isNotNull(channel); + if (listener != null) channelListeners.put(channel, listener); + else channelListeners.remove(channel); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/nls/Messages.java new file mode 100644 index 000000000..a3e6ca469 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/nls/Messages.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.internal.nls; + +import java.lang.reflect.Field; + +import org.eclipse.osgi.util.NLS; + +/** + * Plug-in externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.tcf.core.internal.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + /** + * Returns if or if not this NLS manager contains a constant for + * the given externalized strings key. + * + * @param key The externalized strings key or <code>null</code>. + * @return <code>True</code> if a constant for the given key exists, <code>false</code> otherwise. + */ + public static boolean hasString(String key) { + if (key != null) { + try { + Field field = Messages.class.getDeclaredField(key); + return field != null; + } catch (NoSuchFieldException e) { /* ignored on purpose */ } + } + + return false; + } + + /** + * Returns the corresponding string for the given externalized strings + * key or <code>null</code> if the key does not exist. + * + * @param key The externalized strings key or <code>null</code>. + * @return The corresponding string or <code>null</code>. + */ + public static String getString(String key) { + if (key != null) { + try { + Field field = Messages.class.getDeclaredField(key); + if (field != null) { + return (String)field.get(null); + } + } catch (Exception e) { /* ignored on purpose */ } + } + + return null; + } + + // **** Declare externalized string id's down here ***** + + public static String InternalChannelOpenListener_onChannelOpen_message; + + public static String InternalChannelListener_onChannelClosed_message; + public static String InternalChannelListener_onChannelClosed_cause; + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/nls/Messages.properties new file mode 100644 index 000000000..50c4de0de --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/nls/Messages.properties @@ -0,0 +1,9 @@ +# +# org.eclipse.tcf.te.tcf.core +# Externalized Strings. +# + +InternalChannelOpenListener_onChannelOpen_message=Channel opened. + +InternalChannelListener_onChannelClosed_message=Channel closed. {0} +InternalChannelListener_onChannelClosed_cause=; Possibly caused by: {0} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/utils/LogUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/utils/LogUtils.java new file mode 100644 index 000000000..fdea98cf8 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/utils/LogUtils.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.internal.utils; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.tcf.protocol.IChannel; +import org.eclipse.tcf.te.tcf.core.activator.CoreBundleActivator; + + +/** + * Logging utilities helper implementations. + */ +public final class LogUtils { + + /** + * Log the given message for the given channel. + * + * @param channel The channel. Must not be <code>null</code>. + * @param message The message to log. Must not be <code>null</code>. + * @param slotId The Eclipse debug slot id which must be enabled to log the message. Must not be <code>null</code>. + * @param clazz The invoking class or <code>null</code>. + */ + public static void logMessageForChannel(IChannel channel, String message, String slotId, Object clazz) { + Assert.isNotNull(channel); + Assert.isNotNull(message); + Assert.isNotNull(slotId); + + // Trace the message + String fullMessage = channel.toString() + ": " + message; //$NON-NLS-1$ + + if (Boolean.parseBoolean(Platform.getDebugOption(CoreBundleActivator.getUniqueIdentifier() + "/" + slotId))) { //$NON-NLS-1$ + IStatus status = new Status(IStatus.INFO, CoreBundleActivator.getUniqueIdentifier(), fullMessage.trim()); + Platform.getLog(CoreBundleActivator.getContext().getBundle()).log(status); + } + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/streams/StreamsDataProvider.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/streams/StreamsDataProvider.java new file mode 100644 index 000000000..17adba4f5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/streams/StreamsDataProvider.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.streams; + +import java.io.IOException; +import java.io.Reader; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.tcf.services.IProcesses; + +/** + * Remote context streams data provider implementation. + */ +public class StreamsDataProvider extends PlatformObject { + // The associated reader instance + private final Reader reader; + // The list of applicable stream type id's + private final List<String> streamTypeIds; + + /** + * Constructor. + * + * @param reader The reader instance. Must not be <code>null</code>. + * @param streamTypeIds The list of applicable stream type id's or <code>null</code>. + * + * @see IProcesses + */ + public StreamsDataProvider(Reader reader, String[] streamTypeIds) { + Assert.isNotNull(reader); + this.reader = reader; + this.streamTypeIds = streamTypeIds != null ? Arrays.asList(streamTypeIds) : null; + } + + /** + * Dispose the data provider instance. + */ + public void dispose() { + try { + reader.close(); + } + catch (IOException e) { + /* ignored on purpose */ + } + } + + /** + * Returns the associated reader instance. + * + * @return The associated reader instance. + */ + public final Reader getReader() { + return reader; + } + + /** + * Returns if or if not the given stream type id is applicable for this data receiver. + * + * @param streamTypeId The stream type id. Must not be <code>null</code>. + * @return <code>True</code> if the given stream type id is applicable for this data receiver, + * <code>false</code> otherwise. + */ + public final boolean isApplicable(String streamTypeId) { + Assert.isNotNull(streamTypeId); + return streamTypeIds == null || streamTypeIds.contains(streamTypeId); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/streams/StreamsDataReceiver.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/streams/StreamsDataReceiver.java new file mode 100644 index 000000000..0de12c694 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/streams/StreamsDataReceiver.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 2011 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.core.streams; + +import java.io.IOException; +import java.io.Writer; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.tcf.services.IProcesses; + +/** + * Remote context streams data receiver implementation. + */ +public class StreamsDataReceiver extends PlatformObject { + // The associated writer instance + private final Writer writer; + // The list of applicable stream type id's + private final List<String> streamTypeIds; + + /** + * Constructor. + * + * @param writer The writer instance. Must not be <code>null</code>. + * @param streamTypeIds The list of applicable stream type id's or <code>null</code>. + * + * @see IProcesses + */ + public StreamsDataReceiver(Writer writer, String[] streamTypeIds) { + Assert.isNotNull(writer); + this.writer = writer; + this.streamTypeIds = streamTypeIds != null ? Arrays.asList(streamTypeIds) : null; + } + + /** + * Dispose the data receiver instance. + */ + public void dispose() { + try { + writer.close(); + } + catch (IOException e) { + /* ignored on purpose */ + } + } + + /** + * Returns the associated writer instance. + * + * @return The associated writer instance. + */ + public final Writer getWriter() { + return writer; + } + + /** + * Returns if or if not the given stream type id is applicable for this data receiver. + * + * @param streamTypeId The stream type id. Must not be <code>null</code>. + * @return <code>True</code> if the given stream type id is applicable for this data receiver, <code>false</code> + * otherwise. + */ + public final boolean isApplicable(String streamTypeId) { + Assert.isNotNull(streamTypeId); + return streamTypeIds == null || streamTypeIds.contains(streamTypeId); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/utils/ExceptionUtils.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/utils/ExceptionUtils.java new file mode 100644 index 000000000..58deb17b5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/utils/ExceptionUtils.java @@ -0,0 +1,43 @@ +/*******************************************************************************
+ * Copyright (c) 2011 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.core.utils;
+
+import java.util.concurrent.ExecutionException;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.tcf.util.TCFTask;
+
+/**
+ * Exception utilities helper implementations.
+ */
+public final class ExceptionUtils {
+
+ /**
+ * The {@link TCFTask} implementation is wrapping the error cause into an
+ * {@link ExecutionException} with the default error message "TCF
+ * task aborted". As this message is not very informative to the user,
+ * unpack the given exception to reveal the real error cause to the clients.
+ *
+ * @param e The source exception. Must not be <code>null</code>.
+ * returns Exception The real error cause.
+ */
+ public static Exception checkAndUnwrapException(Exception e) {
+ Assert.isNotNull(e);
+
+ // If the incoming exception is a ExecutionException and has set
+ // the default error message text, get the embedded cause.
+ if (e instanceof ExecutionException && "TCF task aborted".equals(e.getMessage())) { //$NON-NLS-1$
+ // Get the cause
+ if (e.getCause() instanceof Exception) return (Exception)e.getCause();
+ }
+
+ return e;
+ }
+}
|