diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.core')
36 files changed, 3919 insertions, 0 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/.classpath b/target_explorer/plugins/org.eclipse.tcf.te.core/.classpath new file mode 100644 index 000000000..8a8f1668c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.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.core/.options b/target_explorer/plugins/org.eclipse.tcf.te.core/.options new file mode 100644 index 000000000..70c4f94f0 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/.options @@ -0,0 +1 @@ +org.eclipse.tcf.te.core/debugmode = 0 diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/.project b/target_explorer/plugins/org.eclipse.tcf.te.core/.project new file mode 100644 index 000000000..33df94b26 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/.project @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.tcf.te.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>1311579470341</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.core/.settings/org.eclipse.jdt.core.prefs b/target_explorer/plugins/org.eclipse.tcf.te.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..8c6bafedf --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Fri Oct 07 16:13:14 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.core/.settings/org.eclipse.jdt.ui.prefs b/target_explorer/plugins/org.eclipse.tcf.te.core/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..a8480b3b5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,4 @@ +#Fri Oct 07 16:13:14 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.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.core/META-INF/MANIFEST.MF new file mode 100644 index 000000000..3c3a60530 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.core;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.core.activator.CoreBundleActivator +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.tcf.te.runtime;bundle-version="1.0.0", + org.eclipse.tcf.te.runtime.stepper;bundle-version="1.0.0", + org.eclipse.tcf.te.runtime.services;bundle-version="1.0.0", + org.eclipse.tcf.te.runtime.persistence;bundle-version="1.0.0", + org.eclipse.tcf.te.runtime.model;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.core.activator;x-internal:=true, + org.eclipse.tcf.te.core.adapters, + org.eclipse.tcf.te.core.async, + org.eclipse.tcf.te.core.async.interfaces, + org.eclipse.tcf.te.core.connection, + org.eclipse.tcf.te.core.connection.interfaces, + org.eclipse.tcf.te.core.connection.managers, + org.eclipse.tcf.te.core.connection.strategy, + org.eclipse.tcf.te.core.model.interfaces, + org.eclipse.tcf.te.core.nls;x-internal:=true, + org.eclipse.tcf.te.core.utils.text diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/build.properties b/target_explorer/plugins/org.eclipse.tcf.te.core/build.properties new file mode 100644 index 000000000..73a5119ed --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.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.core/plugin.properties b/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.properties new file mode 100644 index 000000000..3303cbe06 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.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, Core +providerName = Eclipse.org diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml new file mode 100644 index 000000000..4162ecfe9 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/plugin.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+<!-- Extension point contributions -->
+ <extension-point id="connectionTypes" name="Connection Type Contributions" schema="schema/connectionTypes.exsd"/>
+ <extension-point id="connectionTypeBindings" name="Connection Type Bindings Contributions" schema="schema/connectionTypeBindings.exsd"/>
+
+<!-- Adapter factory contributions -->
+ <extension point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.tcf.te.runtime.model.interfaces.IModelNode"
+ class="org.eclipse.tcf.te.core.adapters.AdapterFactory">
+ <adapter type="org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistable"/>
+ </factory>
+ </extension>
+
+<!-- Reusable core expression fragments -->
+ <extension point="org.eclipse.core.expressions.definitions">
+
+ <!-- Expression to test if the selection contains only one element which
+ is an connectable model node -->
+ <definition id="te.core.expression.isConnectable">
+ <with variable="selection">
+ <count value="1"/>
+ <iterate operator="and" ifEmpty="false">
+ <instanceof value="org.eclipse.tcf.te.core.model.interfaces.IConnectable"/>
+ </iterate>
+ </with>
+ </definition>
+ </extension>
+
+</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/pom.xml b/target_explorer/plugins/org.eclipse.tcf.te.core/pom.xml new file mode 100644 index 000000000..91fbb7ac5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.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.core</artifactId> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectStrategies.exsd b/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectStrategies.exsd new file mode 100644 index 000000000..fb240a9db --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectStrategies.exsd @@ -0,0 +1,283 @@ +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tcf.te.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tcf.te.core" id="connectStrategies" name="Connect Strategies"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to contribute connect strategies.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="connectStrategy" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="connectStrategy">
+ <annotation>
+ <documentation>
+ Declares a Target Explorer connect strategy contribution.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="class" minOccurs="0" maxOccurs="1"/>
+ <element ref="description" minOccurs="0" maxOccurs="1"/>
+ <element ref="stepGroups" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique id of the connect strategy.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+ The label representing the connect strategy within the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The connect strategy class that implements <code>org.eclipse.tcf.te.core.connection.interfaces.IConnectStrategy</code> or extends <code>org.eclipse.tcf.te.core.connection.AbstractConnectStrategy</code>.
+<p>
+The connect strategy implementation class must be specified either by the class attribute or the class child element!
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.core.connection.AbstractConnectStrategy:org.eclipse.tcf.te.core.connection.interfaces.IConnectStrategy"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="description" type="string">
+ <annotation>
+ <documentation>
+ A short description of the connect strategy to be presented in the UI.
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="class">
+ <annotation>
+ <documentation>
+ <p>Used when creating an <code>IExecutableExtension</code> with a named parameter, or more than one.</p>
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The connect strategy class that implements <code>org.eclipse.tcf.te.core.connection.interfaces.IConnectStrategy</code> or extends <code>org.eclipse.tcf.te.core.connection.AbstractConnectStrategy</code>.
+<p>
+The connect strategy implementation class must be specified either by the class attribute or the class child element!
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.core.connection.AbstractConnectStrategy:org.eclipse.tcf.te.core.connection.interfaces.IConnectStrategy"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="parameter">
+ <annotation>
+ <documentation>
+ <p>A parameter for an <code>IExecutableExtension</code>.</p>
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ <p>The parameter name.</p>
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ <p>The parameter value.</p>
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="stepGroups">
+ <annotation>
+ <documentation>
+ The container the step groups are declared in.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="stepGroup" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="stepGroup">
+ <annotation>
+ <documentation>
+ A connect strategy step group.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="step" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" use="required">
+ <annotation>
+ <documentation>
+ The unique id of the connect strategy step group.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier"/>
+ </appinfo>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="org.eclipse.tcf.te.core.steps.connect">
+ </enumeration>
+ <enumeration value="org.eclipse.tcf.te.core.steps.disconnect">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="label" type="string">
+ <annotation>
+ <documentation>
+ The label representing the step group in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="step">
+ <annotation>
+ <documentation>
+ A connect strategy step.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique id of the connect strategy step.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+ The label representing the connect strategy step in the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class implementing the connect strategy step.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.tcf.te.core.stepper.interfaces.IContextStep"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ Target Explorer 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ This is an example of the extension point usage:
+<p>
+<pre><code>
+ <extension point="org.eclipse.tcf.te.core.connectStrategies">
+ <connectStrategy
+ id="org.eclipse.tcf.te.core.strategies.SshConnectStrategy"
+ class="org.eclipse.tcf.te.core.connection.strategies.SshConnectStrategy"
+ label="Ssh Connect Strategy">
+ </connectStrategy>
+ </extension>
+</code></pre>
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ The provider of a connect strategy must implement <samp>org.eclipse.tcf.te.core.interfaces.IConnectStrategy</samp>.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectionTypeBindings.exsd b/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectionTypeBindings.exsd new file mode 100644 index 000000000..7b5bda24b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectionTypeBindings.exsd @@ -0,0 +1,144 @@ +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tcf.te.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tcf.te.core" id="connectionTypeBindings" name="Connection Type Bindings"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to contribute connection types bindings.
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="connectionTypeBinding" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="connectionTypeBinding">
+ <annotation>
+ <documentation>
+ Declares a connection type binding.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="connectStrategy" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="enablement" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="connectionTypeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ The full qualified id of the connection type contribution.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="connectStrategy">
+ <annotation>
+ <documentation>
+ The connect strategy to bind to the connection type.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The full qualified id of the connect strategy contribution.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.tcf.te.core.connectStrategies/connectStrategy/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="overwrite" type="string">
+ <annotation>
+ <documentation>
+ The full qualified id of the connect strategy contribution to overwrite by this contribution.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.tcf.te.core.connectStrategies/connectStrategy/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ Target Explorer 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ This is an example of the extension point usage:
+<p>
+<pre>
+ <connectionTypeBinding connectionTypeId="org.eclipse.tcf.te.core.connection.ssh">
+ <enablement>
+ ...
+ </enablement>
+ ...
+ </connectionTypeBinding>
+</pre>
+ </documentation>
+ </annotation>
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectionTypes.exsd b/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectionTypes.exsd new file mode 100644 index 000000000..706a3a62c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/schema/connectionTypes.exsd @@ -0,0 +1,230 @@ +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tcf.te.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tcf.te.core" id="connectionTypes" name="Connection Types"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to contribute connection types.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="connectionType" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="connectionType">
+ <annotation>
+ <documentation>
+ Declares a Target Explorer connection type contribution.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="class" minOccurs="0" maxOccurs="1"/>
+ <element ref="description" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The unique id of the connection type contribution.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+ The label representing the connection type within the UI.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The connection type class that implements <code>org.eclipse.tcf.te.core.connection.interfaces.IConnectionType</code> or extends <code>org.eclipse.tcf.te.core.connection.ConnectionType</code>.
+<p>
+The connection type implementation class must be specified either by the class attribute or the class child element!
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.core.connection.ConnectionType:org.eclipse.tcf.te.core.connection.interfaces.IConnectionType"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="isEnabled" type="boolean" use="default" value="true">
+ <annotation>
+ <documentation>
+ Setting this attribute to <code>false</code> disables this connection type explicitly. If set to <code>true</code>, the connection type may be still disabled by other conditions like disabled capabilities.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="shortName" type="string">
+ <annotation>
+ <documentation>
+ An optional short name for the connection type for default naming of connections and launches.
+<p>
+Can be specified as parameter if the connection type implementation class is specified with the class child element. The parameter key is "shortname".
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="categoryId" type="string">
+ <annotation>
+ <documentation>
+ The category id this connection type will be sorted in within the new connection wizard.
+<p>
+Can be specified as parameter if the connection type implementation class is specified with the class child element. The parameter key is "categoryId".
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.rse.ui.newConnectionWizards/category/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="description" type="string">
+ <annotation>
+ <documentation>
+ A short description of the connection type to be presented in the UI.
+ </documentation>
+ </annotation>
+ </element>
+
+ <element name="class">
+ <annotation>
+ <documentation>
+ <p>Used when creating an <code>IExecutableExtension</code> with a named parameter, or more than one.</p>
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The connection type class that implements <code>org.eclipse.tcf.te.core.connection.interfaces.IConnectionType</code> or extends <code>org.eclipse.tcf.te.core.connection.ConnectionType</code>.
+<p>
+The connection type implementation class must be specified either by the class attribute or the class child element!
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.tcf.te.core.connection.ConnectionType:org.eclipse.tcf.te.core.connection.interfaces.IConnectionType"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="parameter">
+ <annotation>
+ <documentation>
+ <p>A parameter for an <code>IExecutableExtension</code>.</p>
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ <p>The parameter name.</p>
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ <p>The parameter value.</p>
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ Target Explorer 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ This is an example of the extension point usage:
+<p>
+<pre><code>
+ <extension point="org.eclipse.tcf.te.core.connectionTypes">
+ <connectionType
+ id="org.eclipse.tcf.te.core.connection.ssh"
+ class="org.eclipse.tcf.te.core.connection.types.SSHConnectionType"
+ shortName="SSH"
+ label="SSH Connection"
+ isEnabled="true">
+ </connectionType>
+ </extension>
+</code></pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ The provider of a connection type must implement <samp>org.eclipse.tcf.te.core.interfaces.IConnectionType</samp>.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/activator/CoreBundleActivator.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/activator/CoreBundleActivator.java new file mode 100644 index 000000000..58c9765be --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/activator/CoreBundleActivator.java @@ -0,0 +1,73 @@ +/*******************************************************************************
+ * 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.core.activator;
+
+import org.eclipse.tcf.te.runtime.tracing.TraceHandler;
+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;
+ // The trace handler instance
+ private static TraceHandler traceHandler;
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Returns the bundles trace handler.
+ *
+ * @return The bundles trace handler.
+ */
+ public static TraceHandler getTraceHandler() {
+ if (traceHandler == null) {
+ traceHandler = new TraceHandler(getUniqueIdentifier());
+ }
+ return traceHandler;
+ }
+
+ /* (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;
+ traceHandler = null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/AdapterFactory.java new file mode 100644 index 000000000..6f7638185 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/AdapterFactory.java @@ -0,0 +1,48 @@ +/*******************************************************************************
+ * 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.core.adapters;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistable;
+
+/**
+ * Adapter factory implementation.
+ */
+public class AdapterFactory implements IAdapterFactory {
+ // The single instance adapter references
+ private final IPersistable modelNodePersistableAdapter = new ModelNodePersistableAdapter();
+
+ private static final Class<?>[] CLASSES = new Class[] {
+ IPersistable.class
+ };
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+ */
+ @Override
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IModelNode) {
+ if (IPersistable.class.equals(adapterType)) {
+ return modelNodePersistableAdapter;
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
+ */
+ @Override
+ public Class[] getAdapterList() {
+ return CLASSES;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/ModelNodePersistableAdapter.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/ModelNodePersistableAdapter.java new file mode 100644 index 000000000..6c4bab4be --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/adapters/ModelNodePersistableAdapter.java @@ -0,0 +1,138 @@ +/*******************************************************************************
+ * 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.core.adapters;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.tcf.te.core.activator.CoreBundleActivator;
+import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode;
+import org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistable;
+
+/**
+ * Model node persistable adapter implementation.
+ */
+public class ModelNodePersistableAdapter implements IPersistable {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistable#getStorageID()
+ */
+ @Override
+ public String getStorageID() {
+ return "org.eclipse.tcf.te.runtime.persistence.properties"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistable#getURI(java.lang.Object)
+ */
+ @Override
+ public URI getURI(Object data) {
+ Assert.isNotNull(data);
+
+ URI uri = null;
+
+ // Only model nodes are supported
+ if (data instanceof IModelNode) {
+ IModelNode node = (IModelNode) data;
+ if (node.getName() != null && !"".equals(node.getName().trim())) { //$NON-NLS-1$
+ // Get the node name and make it a valid file system name (no spaces etc).
+ IPath path = getRoot().append(makeValidFileSystemName(((IModelNode) data).getName().trim()));
+ if (!"ini".equals(path.getFileExtension())) path = path.addFileExtension("ini"); //$NON-NLS-1$ //$NON-NLS-2$
+ uri = path.toFile().toURI();
+ }
+ // If the name is not set, check for "Path"
+ else if (node.getStringProperty("Path") != null && !"".equals(node.getStringProperty("Path").trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ IPath path = new Path(node.getStringProperty("Path")); //$NON-NLS-1$
+ uri = path.toFile().toURI();
+ }
+ }
+
+ return uri;
+ }
+
+ /**
+ * Make a valid file system name from the given name.
+ *
+ * @param name The original name. Must not be <code>null</code>.
+ * @return The valid file system name.
+ */
+ private String makeValidFileSystemName(String name) {
+ Assert.isNotNull(name);
+ return name.replaceAll("\\W", "_"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * Returns the root location.
+ *
+ * @return The root location or <code>null</code> if it cannot be determined.
+ */
+ public IPath getRoot() {
+ IPath location = null;
+
+ // Try the bundles state location first (not available if launched with -data @none).
+ try {
+ IPath path = Platform.getStateLocation(CoreBundleActivator.getContext().getBundle()).append(".store"); //$NON-NLS-1$
+ if (!path.toFile().exists()) path.toFile().mkdirs();
+ if (path.toFile().canRead() && path.toFile().isDirectory()) {
+ location = path;
+ }
+ } catch (IllegalStateException e) {
+ // Workspace less environments (-data @none)
+ // The users local target definition persistence directory is $HOME/.tcf/.store.
+ IPath path = new Path(System.getProperty("user.home")).append(".tcf/.store"); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!path.toFile().exists()) path.toFile().mkdirs();
+ if (path.toFile().canRead() && path.toFile().isDirectory()) {
+ location = path;
+ }
+ }
+
+ return location;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistable#exportFrom(java.lang.Object)
+ */
+ @Override
+ public Map<String, Object> exportFrom(Object data) throws IOException {
+ Assert.isNotNull(data);
+
+ Map<String, Object> result = null;
+
+ // Only model nodes are supported
+ if (data instanceof IModelNode) {
+ result = ((IModelNode)data).getProperties();
+ }
+
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.persistence.interfaces.IPersistable#importTo(java.lang.Object, java.util.Map)
+ */
+ @Override
+ public void importTo(Object data, Map<String, Object> external) throws IOException {
+ Assert.isNotNull(data);
+ Assert.isNotNull(external);
+
+ // Only model nodes are supported
+ if (data instanceof IModelNode) {
+ IModelNode node = (IModelNode) data;
+ for (String key : external.keySet()) {
+ node.setProperty(key, external.get(key));
+ }
+ }
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutable.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutable.java new file mode 100644 index 000000000..b5d6ab6c4 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutable.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.core.async; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tcf.te.core.async.interfaces.IAsyncExecutable; +import org.eclipse.tcf.te.runtime.callback.Callback; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; +import org.eclipse.tcf.te.runtime.utils.ProgressHelper; + +/** + * Abstract asynchronous executable implementation. + */ +public abstract class AbstractAsyncExecutable extends PropertiesContainer implements IAsyncExecutable { + + private boolean cancelable = true; + + /** + * Constructor. + */ + public AbstractAsyncExecutable() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(ICallback callback) { + execute(null, ProgressHelper.PROGRESS_NONE, callback); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.core.runtime.IProgressMonitor, int, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(IProgressMonitor progress, int ticksToUse, ICallback callback) { + progress = ProgressHelper.getProgressMonitor(progress, ticksToUse); + int jobTicks = getJobTicks(); + ProgressHelper.beginTask(progress, getTaskName(), jobTicks); + callback = new Callback(progress, ProgressHelper.PROGRESS_DONE, callback); + + internalExecute(progress, callback); + } + + protected abstract void internalExecute(IProgressMonitor monitor, ICallback callback); + + /** + * Return the ticks for this executable. + */ + protected int getJobTicks() { + return 100; + } + + /** + * Return the name of the task. + */ + protected String getTaskName() { + return ""; //$NON-NLS-1$ + } + + /** + * Return <code>true</code> if the job can be canceled. + */ + public final boolean isCancelable() { + return cancelable; + } + + /** + * Set if the job can be canceled. + * + * @param cancelable <code>true</code> if the job should be cancelable. + */ + public final void setCancelable(boolean cancelable) { + this.cancelable = cancelable; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutableJob.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutableJob.java new file mode 100644 index 000000000..87e0e6b4c --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutableJob.java @@ -0,0 +1,218 @@ +/******************************************************************************* + * 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.core.async; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobManager; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.tcf.te.core.async.interfaces.IAsyncExecutable; +import org.eclipse.tcf.te.runtime.callback.Callback; +import org.eclipse.tcf.te.runtime.interfaces.IConditionTester; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.utils.ProgressHelper; + +/** + * Abstract asynchronous executable job implementation. + */ +public abstract class AbstractAsyncExecutableJob extends Job implements IAsyncExecutable { + + /** + * Job family id to identify jobs based on {@link AbstractAsyncExecutableJob}. + * + * @see IJobManager + */ + public final String ID = "jobfamily.jobs.asynchronous"; //$NON-NLS-1$ + + private int rescheduleDelay = -1; + private boolean cancelable = true; + protected boolean finished = false; + private boolean statusHandled = false; + + private String jobFamily = null; + + private ICallback jobCallback = null; + + /** + * Constructor. + * + * @param name The job name. + * @param context The context to refresh. + * @param mode The refresh mode. + */ + protected AbstractAsyncExecutableJob(String name) { + super(name); + setPriority(Job.INTERACTIVE); + setJobFamily(ID); + } + + /** + * Set the delay if the job should be rescheduled. + * @param seconds The reschedule delay or <code>-1</code> if job should not be rescheduled. + */ + public final void setRescheduleDelay(int seconds) { + this.rescheduleDelay = seconds; + } + + /** + * Return the delay in seconds until the job should be rescheduled. + */ + public final int getRescheduleDelay() { + return rescheduleDelay; + } + + /** + * Sets if the result status should be handled by the job manager. + * @param handled <code>true</code> if the job manager should not handle the result status. + */ + protected void setStatusHandled(boolean handled) { + this.statusHandled = handled; + } + + /** + * Set if the job can be canceled. + * @param cancelable <code>true</code> if the job should be cancelable. + */ + public final void setCancelable(boolean cancelable) { + this.cancelable = cancelable; + } + + /** + * Return <code>true</code> if the job can be canceled. + */ + public final boolean isCancelable() { + return cancelable; + } + + /** + * Set the callback for the job. + * @param callback The callback. + */ + public final void setJobCallback(ICallback callback) { + this.jobCallback = callback; + } + + /** + * Return the job callback. + */ + public final ICallback getJobCallback() { + return jobCallback; + } + + /** + * Return <code>true</code> if the job is finished. + */ + public final boolean isFinished() { + return finished; + } + + /** + * Set the job family to identify a job using <code>belongsTo(Object family)</code>. + * @param jobFamily The job family or <code>null</code>. + */ + public final void setJobFamily(String jobFamily) { + this.jobFamily = jobFamily; + } + + /** + * Return the job family. + */ + public final String getJobFamily() { + return jobFamily; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object) + */ + @Override + public boolean belongsTo(Object family) { + if (family instanceof String && getJobFamily() != null && getJobFamily().startsWith(family.toString())) { + return true; + } + return super.belongsTo(family); + } + + /** + * Number of ticks the job uses to show the progress. + * + * @return The number of progress ticks. + */ + protected abstract int getJobTicks(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(ICallback callback) { + execute(null, ProgressHelper.PROGRESS_NONE, callback); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.interfaces.IAsyncExecutable#execute(org.eclipse.core.runtime.IProgressMonitor, int, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final void execute(IProgressMonitor progress, int ticksToUse, ICallback callback) { + finished = false; + progress = ProgressHelper.getProgressMonitor(progress, ticksToUse); + int jobTicks = getJobTicks(); + ProgressHelper.beginTask(progress, "", jobTicks); //$NON-NLS-1$ + callback = new Callback(progress, ProgressHelper.PROGRESS_DONE, callback); + if (getJobCallback() != null && getJobCallback() != callback) { + callback.addParentCallback(getJobCallback()); + } + + internalExecute(progress, new Callback(progress, ProgressHelper.PROGRESS_DONE, callback) { + @Override + protected void internalDone(Object caller, IStatus status) { + finished = true; + } + }); + } + + /** + * The job itself. + * + * @param monitor The progress monitor (never <code>null</code>). + * @param callback The callback. + */ + protected abstract void internalExecute(final IProgressMonitor monitor, final ICallback callback); + + /** + * Hold the execution of {@link #run(IProgressMonitor)} until the asynchronous executable + * has completed the execution and invoked the callback. + * + * @param timeout The timeout in milliseconds. <code>0</code> means wait forever. + * @param conditionTester The condition tester which condition must be fulfilled until + * the execution hold of {@link #run(IProgressMonitor)} can be released. + */ + protected abstract void waitAndExecute(long timeout, IConditionTester conditionTester); + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + protected final IStatus run(final IProgressMonitor monitor) { + finished = false; + int jobTicks = getJobTicks(); + ProgressHelper.beginTask(monitor, "", jobTicks); //$NON-NLS-1$ + final Callback callback = new Callback(monitor, ProgressHelper.PROGRESS_DONE, getJobCallback()); + internalExecute(monitor, callback); + waitAndExecute(0, callback.getDoneConditionTester(isCancelable() ? monitor : null)); + finished = true; + + if (getRescheduleDelay() >= 0 && Platform.isRunning() && (!isCancelable() || !monitor.isCanceled())) { + schedule(getRescheduleDelay() * 1000); + } + + return statusHandled ? Status.OK_STATUS : callback.getStatus(); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutableStepperJob.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutableStepperJob.java new file mode 100644 index 000000000..6f1d901a6 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AbstractAsyncExecutableStepperJob.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * 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.core.async; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.tcf.te.core.async.interfaces.IAsyncExecutable; +import org.eclipse.tcf.te.runtime.callback.Callback; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.utils.ProgressHelper; + +/** + * Abstract asynchronous executable stepper job. + * <p> + * The job executes a list of actions. If any action returns with an error, the whole job will be + * aborted. + */ +public abstract class AbstractAsyncExecutableStepperJob extends AbstractAsyncExecutableJob { + private final IAsyncExecutable[] actions; + + /** + * Constructor. + * + * @param name The job name. Must not be <code>null</code> + * @param actions The actions to execute. Must not be <code>null</code>. + */ + public AbstractAsyncExecutableStepperJob(String name, IAsyncExecutable[] actions) { + super(name); + + Assert.isNotNull(actions); + this.actions = actions; + } + + /** + * Returns the actions to execute. + * + * @return The actions to execute. + */ + protected IAsyncExecutable[] getActions() { + return actions; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.AbstractAsyncExecutableJob#getJobTicks() + */ + @Override + protected int getJobTicks() { + return getActions().length * 100; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.AbstractAsyncExecutableJob#internalExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + protected final void internalExecute(final IProgressMonitor monitor, final ICallback callback) { + if (getActions() == null || getActions().length == 0) { + callback.done(this, Status.OK_STATUS); + } + else { + ICallback stepCallback = new Callback() { + private int index = 0; + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.callback.Callback#internalDone(java.lang.Object, org.eclipse.core.runtime.IStatus) + */ + @Override + protected void internalDone(Object caller, IStatus status) { + if (!ProgressHelper.isCancelOrError(caller, status, getProgressMonitor(), null) && index < getActions().length) { + setProperty(PROPERTY_IS_DONE, false); + getActions()[index++].execute(monitor, 100, this); + } + else { + callback.done(caller, status); + } + } + }; + stepCallback.done(this, Status.OK_STATUS); + } + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AsyncCallbackCollector.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AsyncCallbackCollector.java new file mode 100644 index 000000000..94000d9f3 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AsyncCallbackCollector.java @@ -0,0 +1,260 @@ +/******************************************************************************* + * 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.core.async; + +import java.util.concurrent.ExecutionException; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.tcf.te.core.activator.CoreBundleActivator; +import org.eclipse.tcf.te.runtime.callback.Callback; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; + +/** + * The asynchronous callback collector is an extension to the asynchronous callback handler. The + * difference is that the collector is not blocking a thread for waiting till all associated + * callback's have been finished, the collector will by itself call an asynchronous callback if all + * other callback's have been removed from the collector. + * + * In case of an error, all outstanding asynchronous callback's are ignored and the master callback + * is invoked directly. + * + * Note: The creator of the asynchronous callback collector must call <code>AsyncCallbackCollector.initDone()</code> + * if all initialization work and chaining of the target callback's are done. This will do avoid that + * the collector is fired before all pending callback could have been added! + */ +public class AsyncCallbackCollector extends AsyncCallbackHandler { + // The final master callback to send if all other callback have been removed. + final ICallback callback; + // Once the master callback has been fired, the collector is marked finish. + private boolean isFinished; + private boolean initDone; + + // The reference to the callback invocation delegate + private ICallbackInvocationDelegate delegate = null; + + /** + * Delegation interfaces used by the asynchronous callback collector to + * invoke the final callback. + */ + public static interface ICallbackInvocationDelegate { + + /** + * Invokes the given runnable. + * + * @param runnable The runnable. Must not be <code>null</code>. + */ + public void invoke(Runnable runnable); + } + + /** + * Simple target callback handling an asynchronous callback collector parent itself and remove + * themselves from the collector after callback has done. + * <p> + * Errors are handled using the collector. + */ + public static class SimpleCollectorCallback extends Callback { + private final AsyncCallbackCollector collector; + + /** + * Constructor. + * + * @param collector The parent asynchronous callback collector. Must be not + * <code>null</code>. + */ + public SimpleCollectorCallback(AsyncCallbackCollector collector) { + Assert.isNotNull(collector); + // Remember the callback collector instance + this.collector = collector; + // Add ourself to the callback collector + this.collector.addCallback(this); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.callback.Callback#internalDone(java.lang.Object, org.eclipse.core.runtime.IStatus) + */ + @Override + protected void internalDone(Object caller, IStatus status) { + // If an error occurred, pass on to the collector and + // let the collector handle the error. + if (status.getException() != null) { + collector.handleError(status.getMessage(), status.getException()); + } + else { + collector.removeCallback(this); + } + } + + /** + * Return the collector using this callback. + */ + protected AsyncCallbackCollector getCollector() { + return collector; + } + } + + /** + * Constructor. + */ + public AsyncCallbackCollector() { + this(null, null); + } + + /** + * Constructor. + * + * @param callback The final callback to invoke if the collector enters the finished state. + * @param delegate The callback invocation delegate. Must not be <code>null</code> if the callback is not <code>null</code>. + */ + public AsyncCallbackCollector(ICallback callback, ICallbackInvocationDelegate delegate) { + super(); + + if (callback != null) Assert.isNotNull(delegate); + + // We have to add our master callback to the list of callback to avoid that + // the collector is running empty to early! + addCallback(callback); + this.callback = callback; + this.delegate = delegate; + + // We are not finished yet. + isFinished = false; + initDone = false; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.AsyncCallbackHandler#addCallback(org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final synchronized void addCallback(ICallback callback) { + Assert.isTrue(!isFinished() || getError() != null); + super.addCallback(callback); + } + + /** + * Checks if the collector run empty and we can fire the master callback. + */ + protected final synchronized void checkAndFireCallback() { + if (!isEmpty() || isFinished()) { + return; + } + isFinished = true; + onCollectorFinished(); + } + + /** + * Called from {@link #checkAndFireCallback()} once the collector has been marked finished. + * Subclasses may override this method for any necessary finished handling necessary.<br> + * The default implementation is just firing the collectors final callback. + * <p> + * Note: The method does not need to be explicitly synchronized. It's called from inside a + * <code>synchronized(this)</code> block! + */ + protected void onCollectorFinished() { + if (callback != null) { + Assert.isNotNull(delegate); + delegate.invoke(new Runnable() { + @Override + public void run() { + Throwable error = getError(); + IStatus status = new Status((error != null ? (error instanceof OperationCanceledException ? IStatus.CANCEL : IStatus.ERROR) : IStatus.OK), CoreBundleActivator + .getUniqueIdentifier(), 0, (error != null ? error.getMessage() : null), error); + callback.done(this, status); + } + }); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.async.AsyncCallbackHandler#removeCallback(org.eclipse.tcf.te.runtime.interfaces.callback.ICallback) + */ + @Override + public final synchronized void removeCallback(ICallback callback) { + super.removeCallback(callback); + checkAndFireCallback(); + } + + /** + * Returns if or if not all pending callback's have been invoked and the collector entered the + * finished state. Once in the finished state, the state cannot be reversed anymore! + */ + public final boolean isFinished() { + return isFinished; + } + + /** + * Method to be called if the initialization of the collector is finished. The creator of the + * collector must call this method in order to "activate" the collector finally. + */ + public final synchronized void initDone() { + Assert.isTrue(initDone == false); + if (callback != null) { + removeCallback(callback); + } + initDone = true; + } + + /** + * Creates and {@link ExecutionException} for the given error message and the given cause. Calls + * {@link #handleError(Throwable)} afterwards. If the given cause is an + * {@link OperationCanceledException}, the cause will be passed on untouched. + * + * @param errMsg The error message or <code>null</code>. + * @param cause The cause or <code>null</code>. + */ + public final synchronized void handleError(final String errMsg, Throwable cause) { + // In case of an error, isFinished() can be set before all callback's are in. + // Callback's that come later do not change the result, they are silently ignored. + Assert.isTrue(!isFinished() || getError() != null); + + Throwable error = cause; + + // In case the incoming error is itself an OperationCanceledException, re-throw it as is. + // Otherwise re-package the cause to an ExecutionException. + // + // In all cases the exceptions will be thrown here in order to create a useful back trace. + if (error instanceof OperationCanceledException) { + // leave everything as is + } + else { + cause = new ExecutionException(errMsg, error); + } + error.fillInStackTrace(); + handleError(error); + } + + /** + * Handles the given error. If the collector is not yet finished and not error has been set yet, + * the collector is finished and the error is set as the error to pass on with the callback. If + * the collector is already finished, the method will return immediately. + * + * @param error The error to handle. Must be not <code>null</code>. + */ + public final synchronized void handleError(final Throwable error) { + Assert.isNotNull(error); + + // In case of an error, isFinished() can be set before all callback's are in. + // Callback's that come later do not change the result, they are silently ignored. + Assert.isTrue(!isFinished() || getError() != null); + + if (!isFinished()) { + setError(error); + clear(); + checkAndFireCallback(); + } + + // Re-throw any Error except assertion errors ! NEVER REMOVE THIS ! + if ((error instanceof Error) && !(error instanceof AssertionError)) { + throw (Error) error; + } + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AsyncCallbackHandler.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AsyncCallbackHandler.java new file mode 100644 index 000000000..22b9a6bc2 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/AsyncCallbackHandler.java @@ -0,0 +1,192 @@ +/******************************************************************************* + * 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.core.async; + +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.tcf.te.runtime.interfaces.IConditionTester; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; + +/** + * Common implementation to handle and wait for asynchronous callback's. + */ +public class AsyncCallbackHandler { + private final List<ICallback> callbacks = new Vector<ICallback>(); + private final IConditionTester conditionTester; + private Throwable error; + + private final static boolean TRACING_ENABLED = Boolean.parseBoolean(Platform.getDebugOption("org.eclipse.tcf.te.runtime/trace/callbacks")); //$NON-NLS-1$ + + // This map will track who have added a specific callback to the handler. + // This is for internal debugging purpose only. + private final Map<ICallback, Throwable> callbackAdders = new Hashtable<ICallback, Throwable>(); + + /** + * Constructor. + */ + public AsyncCallbackHandler() { + this(null); + } + + /** + * Constructor. + */ + public AsyncCallbackHandler(IConditionTester tester) { + super(); + error = null; + conditionTester = new AsyncCallbackConditionTester(tester); + } + + /** + * Adds the given callback to the list of pending sequent's or callback's. In case of adding a + * callback to the list, the caller must remove the callback from list as well. + * + * @param callback The callback to add to the list. + */ + public void addCallback(ICallback callback) { + if (callback != null && !callbacks.contains(callback)) { + callbacks.add(callback); + + if (TRACING_ENABLED) { + try { + throw new Exception("Pending callback added!"); //$NON-NLS-1$ + } + catch (Exception e) { + callbackAdders.put(callback, e.fillInStackTrace()); + } + } + } + } + + /** + * Removes the given callback from the list of pending sequent's or callback's. + * + * @param callback The callback to remove from the list. + */ + public void removeCallback(ICallback callback) { + if (callback != null) { + callbacks.remove(callback); + + if (TRACING_ENABLED) { + callbackAdders.remove(callback); + } + } + } + + /** + * Returns if or if not all previously added callback's have been removed again. + * + * @return <code>true</code> if the callback handler is empty, <code>false</code> otherwise. + */ + public final boolean isEmpty() { + if (TRACING_ENABLED) { + System.err.println(this.getClass().getName() + ": size = " + callbacks.size()); //$NON-NLS-1$ + if (callbacks.size() < 4) { + synchronized (callbacks) { + Iterator<?> iterator = callbacks.iterator(); + System.err.println("Remaining adders: "); //$NON-NLS-1$ + while (iterator.hasNext()) { + Exception adder = (Exception) callbackAdders.get(iterator.next()); + adder.printStackTrace(); + System.err.println("*****"); //$NON-NLS-1$ + } + } + } + } + return callbacks.isEmpty(); + } + + /** + * Remove all remaining callback's from the callback handler. + */ + public final void clear() { + callbacks.clear(); + } + + /** + * Sets the given error for this handler. In case an error had been set before, the previous + * error will be preserved and the current error will be dropped. + * + * @param error The error to set or <code>null</code>. + */ + public final void setError(Throwable error) { + if (error != null) { + // The first error is the most precious. + // Don't override it by subsequent errors. + if (this.error == null) { + this.error = error; + } + } + else { + this.error = error; + } + } + + /** + * Returns the associated error. + * + * @return The error or <code>null</code>. + */ + public final Throwable getError() { + return error; + } + + /** + * Returns the condition tester to use for waiting for the callback handler + * until all callbacks have been invoked and the external condition tester + * is fulfilled too. + * + * @return The condition tester instance. + */ + public IConditionTester getConditionTester() { + return conditionTester; + } + + final class AsyncCallbackConditionTester implements IConditionTester { + private final IConditionTester externalTester; + + /** + * Constructor. + * <p> + * If an external condition tester is passed in, {@link #isConditionFulfilled()} will return + * <code>true</code> if either the callback handler is empty or the external tester's + * {@link #isConditionFulfilled()} returns <code>true</code>. + * + * @param tester An external condition tester or <code>null</code>. + */ + public AsyncCallbackConditionTester(IConditionTester tester) { + externalTester = tester; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.interfaces.IConditionTester#cleanup() + */ + @Override + public void cleanup() { + if (!isEmpty()) { + clear(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.interfaces.IConditionTester#isConditionFulfilled() + */ + @Override + public boolean isConditionFulfilled() { + // the condition is fulfilled if no remaining callback's are registered! + return isEmpty() || (externalTester != null && externalTester.isConditionFulfilled()); + } + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/interfaces/IAsyncExecutable.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/interfaces/IAsyncExecutable.java new file mode 100644 index 000000000..949bc0b34 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/async/interfaces/IAsyncExecutable.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.core.async.interfaces; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; + +/** + * Describes a common interface of an encapsulated executable. + * <p> + * All required steps combined to execute the action must be executed by the implementor of the + * executable. The executable itself has no UI or job control. It is only supposed to use the + * provided progress monitors to give feedback and report errors using exceptions and the callback + * mechanism. + */ +public interface IAsyncExecutable { + + /** + * Execute the necessary steps to complete the executable. + * <p> + * If the executable has been finished, the specified callback <b>must</b> be called! + * + * @param callback The callback to invoke or <code>null</code> + */ + public void execute(ICallback callback); + + /** + * Execute the necessary steps to complete the executable. + * <p> + * User feedback can be provided through the specified progress monitor, if not <code>null</code>. + * <p> + * If the executable has been finished, the specified callback <b>must</b> be called! + * + * @param progress The progress monitor or <code>null</code>. + * @param ticksToUse The ticks to use from the progress monitor. + * @param callback The callback to invoke or <code>null</code> + */ + public void execute(IProgressMonitor progress, int ticksToUse, ICallback callback); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/ConnectionType.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/ConnectionType.java new file mode 100644 index 000000000..52a907f62 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/ConnectionType.java @@ -0,0 +1,227 @@ +/******************************************************************************* + * 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.core.connection; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.activator.CoreBundleActivator; +import org.eclipse.tcf.te.core.connection.interfaces.IConnectionType; +import org.eclipse.tcf.te.core.connection.interfaces.IConnectionTypeConstants; +import org.eclipse.tcf.te.core.utils.text.StringUtil; +import org.eclipse.tcf.te.runtime.nls.Messages; +import org.eclipse.tcf.te.runtime.properties.PropertiesContainer; + +/** + * Connection type implementation. + */ +public class ConnectionType extends PropertiesContainer implements IConnectionType { + + /** + * Initialize the default connection type properties. + * <p> + * <b>Note:</b> This method is called from {@link #setInitializationData(IConfigurationElement, String, Object)}. + */ + protected void initDefaultProperties() { + setProperty(IConnectionTypeConstants.PROPERTY_DEFINING_BUNDLE, null); + setProperty(IConnectionTypeConstants.PROPERTY_ID, null); + setProperty(IConnectionTypeConstants.PROPERTY_LABEL, ""); //$NON-NLS-1$ + setProperty(IConnectionTypeConstants.PROPERTY_SHORTNAME, ""); //$NON-NLS-1$ + setProperty(IConnectionTypeConstants.PROPERTY_DESCRIPTION, ""); //$NON-NLS-1$ + setProperty(IConnectionTypeConstants.PROPERTY_CATEGORY_ID, null); + setProperty(IConnectionTypeConstants.PROPERTY_SUPPORTS_EARLY_FINISH, false); + setProperty(IConnectionTypeConstants.PROPERTY_ENABLED, true); + setProperty(IConnectionTypeConstants.PROPERTY_LAST_INVALID_CAUSE, null); + setProperty(IConnectionTypeConstants.PROPERTY_CONNECT_IMMEDIATELY, true); + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) + */ + @Override + @SuppressWarnings("unchecked") + public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { + // Initialize the default properties first + initDefaultProperties(); + + // read the connection type attributes from the configuration element and apply + if (config != null && config.getName().equals("connectionType")) { //$NON-NLS-1$ + + // Set the id if an id attribute is specified and the id had been not + // yet set by the connection type implementation class. + // Throws an exception if the id is empty or null. + String id = config.getAttribute("id"); //$NON-NLS-1$ + if (getId() == null && id != null && id.length() > 0) { + setProperty(IConnectionTypeConstants.PROPERTY_ID, id); + } else { + throw createMissingMandatoryAttributeException("id", config.getContributor().getName()); //$NON-NLS-1$ + } + + // Initialize the label field by reading the <label> extension attribute if present. + String label = config.getAttribute("label"); //$NON-NLS-1$ + if (label != null && label.length() > 0) { + setProperty(IConnectionTypeConstants.PROPERTY_LABEL, label); + } else { + throw createMissingMandatoryAttributeException("label", config.getContributor().getName()); //$NON-NLS-1$ + } + + // Initialize the description field by reading the "<description>" extension child element if present. + IConfigurationElement[] children = config.getChildren("description"); //$NON-NLS-1$ + // Only one description element is allow. All other will be ignored + if (children.length > 0) { + IConfigurationElement description = children[0]; + String value = description.getValue(); + setProperty(IConnectionTypeConstants.PROPERTY_DESCRIPTION, value != null ? value.trim() : ""); //$NON-NLS-1$ + } + + // Get the enabled attribute + String isEnabled = config.getAttribute("isEnabled"); //$NON-NLS-1$ + + // We allow to overwrite the enabled attribute from the plugin.xml + // via a .options file property: + // + // The options file key is: <contribution plugin>/connectionType/<id>/enabled = true + StringBuilder debugKey = new StringBuilder(config.getContributor().getName()); + debugKey.append("/connectionType/"); //$NON-NLS-1$ + debugKey.append(id.replaceAll("\\s", "_")); //$NON-NLS-1$ //$NON-NLS-2$ + debugKey.append("/enabled"); //$NON-NLS-1$ + + if (Boolean.parseBoolean(Platform.getDebugOption(debugKey.toString()))) { + isEnabled = "true"; //$NON-NLS-1$ + } + + // Apply the enabled attribute + if (isEnabled != null && isEnabled.length() > 0 && (isEnabled.equalsIgnoreCase("true") || isEnabled.equalsIgnoreCase("false"))) { //$NON-NLS-1$ //$NON-NLS-2$ + setProperty(IConnectionTypeConstants.PROPERTY_ENABLED, Boolean.valueOf(isEnabled).booleanValue()); + } + + // Get the short name attribute + String shortName = config.getAttribute("shortName"); //$NON-NLS-1$ + if (shortName != null && shortName.length() > 0) { + setProperty(IConnectionTypeConstants.PROPERTY_SHORTNAME, shortName); + } + + // Get the new connection wizard category id + String categoryId = config.getAttribute("categoryId"); //$NON-NLS-1$ + if (categoryId != null && categoryId.length() > 0) { + setProperty(IConnectionTypeConstants.PROPERTY_CATEGORY_ID, categoryId); + } + } + + // Check the initialization data object. Can be either a string or a hash table. + if (data instanceof String) { + // Tokenize the string and take the pairs as properties + String[] params = StringUtil.tokenize((String)data, 0, false); + for (int i = 0; i < params.length - 1; i++) { + // Parameter key is the first parameter + String paramKey = params[i]; + // Parameter value is the second parameter + String paramValue = (i + 1) < params.length ? params[++i] : null; + // Don't apply a property with the same name if already set (protects + // explicit attributes like "shortName", "isEnabled" or "categoryId"). + if (paramKey != null && getProperty(paramKey) != null) continue; + // Store it + if (paramKey != null) setProperty(paramKey, paramValue); + } + } + else if (data instanceof Map<?,?>) { + // Just copy the map content to the properties + Map<String, String> params = (Map<String, String>)data; + for (String paramKey : params.keySet()) { + // If the short name is already set, don't overwrite it + if (IConnectionTypeConstants.PROPERTY_SHORTNAME.equals(paramKey) && getProperty(paramKey) != null) continue; + // Store it + if (paramKey != null) setProperty(paramKey, params.get(paramKey)); + } + } + } + + /** + * Creates a new {@link CoreException} to be thrown if a mandatory extension attribute + * is missing. + * + * @param attributeName The attribute name. Must be not <code>null</code>. + * @param extensionId The extension id. Must be not <code>null</code>. + * + * @return The {@link CoreException} instance. + */ + protected CoreException createMissingMandatoryAttributeException(String attributeName, String extensionId) { + Assert.isNotNull(attributeName); + Assert.isNotNull(extensionId); + + return new CoreException(new Status(IStatus.ERROR, + CoreBundleActivator.getUniqueIdentifier(), + 0, + NLS.bind(Messages.Extension_error_missingRequiredAttribute, attributeName, extensionId), + null)); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension#getId() + */ + @Override + public final String getId() { + return getStringProperty(IConnectionTypeConstants.PROPERTY_ID); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension#getLabel() + */ + @Override + public final String getLabel() { + return getStringProperty(IConnectionTypeConstants.PROPERTY_LABEL); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension#getDescription() + */ + @Override + public final String getDescription() { + return getStringProperty(IConnectionTypeConstants.PROPERTY_DESCRIPTION); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.connection.interfaces.IConnectionType#isEnabled() + */ + @Override + public boolean isEnabled() { + return getBooleanProperty(IConnectionTypeConstants.PROPERTY_ENABLED) /*&& ConnectionTypeBindingsManager.getInstance().isConnectionTypeEnabled(getId())*/; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.core.connection.interfaces.IConnectionType#isValid() + */ + @Override + public boolean isValid() { + setProperty(IConnectionTypeConstants.PROPERTY_LAST_INVALID_CAUSE, null); + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + // If the requested adapter is a connection service type, + // forward to the connection type service manager +// if (IConnectionTypeService.class.isAssignableFrom(adapter)) { +// IConnectionTypeService service = ConnectionTypeServiceManager.getInstance().getService(getId(), adapter); +// if (service != null) return service; +// } + return super.getAdapter(adapter); + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java new file mode 100644 index 000000000..e707bba10 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectStrategy.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * 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.core.connection.interfaces; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.tcf.te.core.model.interfaces.IConnectable; +import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback; +import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension; + +/** + * A connect strategy. + * <p> + * The connect strategy describes the step to perform to connect or disconnect + * to or from a given context. + */ +public interface IConnectStrategy extends IExecutableExtension { + + /** + * Check if the given connectable is valid for this connect strategy. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @return An error message if the connectable context is invalid, </code>null</code> if it is valid. + */ + public String validate(IConnectable connectable); + + /** + * Check if prerequisites for connecting are valid. + * <p> + * Don't run any time-consuming checks. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @return <code>True</code> if the connectable can be connected, <code>false</code> otherwise. + */ + public boolean canConnect(IConnectable connectable); + + /** + * Check if prerequisites for disconnecting are valid. + * <p> + * Don't run any time-consuming checks. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @return <code>True</code> if the connectable can be disconnected, <code>false</code> otherwise. + */ + public boolean canDisconnect(IConnectable connectable); + + /** + * Connect the context. + * <p> + * The connect will be performed by the eclipse job model when no external progress monitor is given. + * If the connect sequence finished or failed or got canceled, the given callback is called if not <code>null</code>. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @param progress An possible external progress monitor or <code>null</code>. + * @param ticksToUse The ticks to use. + * @param cb The callback to call when completed. + * @param autoAttach <code>false</code> to avoid auto attaching. + */ + public void connect(IConnectable connectable, IProgressMonitor progress, int ticksToUse, ICallback cb, boolean autoAttach); + + /** + * Disconnect the context. + * <p> + * The connect will be performed by the eclipse job model when no external progress monitor is given. + * If the connect sequence finished or failed , the given callback is called if not <code>null</code>. + * + * @param connectable The connectable context. Must not be <code>null</code>. + * @param progress An possible external progress monitor or <code>null</code>. + * @param cb The callback to call when completed. + * @param useJob <code>true</code> if the disconnect should run in a job. + * @param quitting <code>true</code> if disconnect is called during workbench shutdown. + */ + public void disconnect(IConnectable connectable, IProgressMonitor progress, int ticksToUse, ICallback cb, boolean quitting); + + /** + * Returns if or if not this connect strategy describes a connection type + * of the given family. + * + * @param connectable The connectable context or <code>null</code>. + * @param typeFamily The connection type family id. + * + * @return <code>True</code> if this connect strategy describes a connection type of the given family. + */ + public boolean isConnectionTypeFamily(IConnectable connectable, long typeFamily); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectionType.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectionType.java new file mode 100644 index 000000000..dfd710c44 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectionType.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.core.connection.interfaces;
+
+import org.eclipse.tcf.te.runtime.interfaces.extensions.IExecutableExtension;
+import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
+
+/**
+ * A connection type.
+ * <p>
+ * Each node on each level of the Target Explorer tree can be bound to a connection type. Child
+ * nodes does inherit the connection type of the parent nodes automatically if not bound to another
+ * connection type explicitly.
+ * <p>
+ * A node can be bound to a single connection type only. The first connection type with an
+ * enablement matching a node is chosen if multiple connection types would match.
+ * <p>
+ * Connection types not bound to any enablement are considered invalid. Enablements are
+ * contributed through the connection type bindings extension point. Multiple enablements
+ * from different plug-ins are allowed. The ordering of multiple enablements is undefined and
+ * given by the order the extension points are provided to the extension point manager by
+ * the Eclipse platform.
+ * <p>
+ * Connection types can bind connection type specific services through the connection type
+ * bindings extension point.
+ */
+public interface IConnectionType extends IPropertiesContainer, IExecutableExtension {
+
+ /**
+ * Returns if or if not this connection type has been explicitly disabled by the
+ * connection type contributor.
+ * <p>
+ * Even if this method returns <code>true</code>, connection types might be still
+ * disabled by other conditions like disabled capabilities.
+ *
+ * @return <code>True</code> if the connection type is enabled, <code>false</code> otherwise.
+ */
+ public boolean isEnabled();
+
+ /**
+ * Returns if or if not this connection types is valid.
+ * <p>
+ * A connection type is considered valid if all prerequisites like installed plug-ins or
+ * products, runtime platforms or licensing conditions are fulfilled.
+ *
+ * @return <code>True</code> if the connection type is valid, <code>false</code> otherwise.
+ */
+ public boolean isValid();
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectionTypeConstants.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectionTypeConstants.java new file mode 100644 index 000000000..5c88feed8 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/interfaces/IConnectionTypeConstants.java @@ -0,0 +1,115 @@ +/******************************************************************************* + * 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.core.connection.interfaces; + +import org.osgi.framework.Bundle; + +/** + * Connection type property constant definitions. + */ +public interface IConnectionTypeConstants { + + /** + * The bundle which is contributing the connection type definition. + * <p> + * Type: {@link Bundle} + */ + public static final String PROPERTY_DEFINING_BUNDLE = "definingBundle"; //$NON-NLS-1$ + + /** + * The connection type unique id. + * <p> + * Type: {@link String} + */ + public static final String PROPERTY_ID = "id"; //$NON-NLS-1$ + + /** + * The connection type label for representing the connection type within the UI. + * <p> + * Type: {@link String} + */ + public static final String PROPERTY_LABEL = "label"; //$NON-NLS-1$ + + /** + * The connection type description. + * <p> + * The description is presented to the user within the new connection wizard to give the user a + * hint what the connection type can be used for. + * <p> + * Type: {@link String} + */ + public static final String PROPERTY_DESCRIPTION = "description"; //$NON-NLS-1$ + + /** + * The connection type short name. + * <p> + * The short name is used to construct a default connection name for new connections of this + * type. + * <p> + * Type: {@link String} + */ + public static final String PROPERTY_SHORTNAME = "shortname"; //$NON-NLS-1$ + + /** + * The connection type category id. + * <p> + * The id of the category the connection type is associated with. The categories are visualized + * to the user by grouping connection types of the same category within the new connection + * wizard. + * <p> + * Type: {@link String} + */ + public static final String PROPERTY_CATEGORY_ID = "categoryId"; //$NON-NLS-1$ + + /** + * Supports early finish. + * <p> + * The user can finish the new connection wizard early. The user is not required to walk through + * all available new connection wizard pages, associated with this connection type. + * <p> + * Type: {@link Boolean} + */ + public static final String PROPERTY_SUPPORTS_EARLY_FINISH = "supportsEarlyFinish"; //$NON-NLS-1$ + + /** + * The connection types explicit enabled state. + * <p> + * Type: {@link Boolean} + */ + public static final String PROPERTY_ENABLED = "enabled"; //$NON-NLS-1$ + + /** + * Instances of this target connection type can be created by the user via the + * "New Connection" wizard UI. The default value is <code>true</code>. + * <p> + * Type: {@link Boolean} + */ + public static final String PROPERTY_IS_USER_CREATABLE = "isUserCreatable"; //$NON-NLS-1$ + + /** + * The connection type last invalidation cause. + * <p> + * User readable string presented within the UI (error log) to inform the user why this + * connection type had been set invalid. + * <p> + * Type: {@link String} + */ + public static final String PROPERTY_LAST_INVALID_CAUSE = "lastInvalidCause"; //$NON-NLS-1$ + + /** + * Property to control if newly created connections of this connection type will be connected + * immediately. This property is effective as long the user did not modified the setting via the + * new connection wizard. The users last choice for this connection type is remembered by the + * new connection wizard via the wizards dialog settings history (per workspace). + * <p> + * Type: {@link Boolean} + */ + public static final String PROPERTY_CONNECT_IMMEDIATELY = "connectImmediately"; //$NON-NLS-1$ +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectStrategyExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectStrategyExtensionPointManager.java new file mode 100644 index 000000000..47c0f5e36 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectStrategyExtensionPointManager.java @@ -0,0 +1,133 @@ +/******************************************************************************* + * 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.core.connection.managers; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.tcf.te.core.connection.interfaces.IConnectStrategy; +import org.eclipse.tcf.te.core.connection.strategy.ConnectStrategyStepGroup; +import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager; +import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup; + +/** + * Connect strategy extension point manager implementation. + * <p> + * The class is not intended to be subclassed by clients. + */ +public class ConnectStrategyExtensionPointManager extends AbstractExtensionPointManager<IConnectStrategy> { + + protected class ConnectStrategyExtensionPointProxy extends ExecutableExtensionProxy<IConnectStrategy> { + private final Map<String, IContextStepGroup> stepGroups = new LinkedHashMap<String, IContextStepGroup>(); + + public ConnectStrategyExtensionPointProxy(IConfigurationElement element) throws CoreException { + super(element); + loadGroups(element); + } + + private void loadGroups(IConfigurationElement element) { + for (IConfigurationElement stepGroupsElement : element.getChildren("stepGroups")) { //$NON-NLS-1$ + for (IConfigurationElement stepGroupElement : stepGroupsElement.getChildren("stepGroup")) { //$NON-NLS-1$ + IContextStepGroup stepGroup = new ConnectStrategyStepGroup(); + try { + stepGroup.setInitializationData(stepGroupElement, stepGroupElement.getName(), null); + stepGroups.put(stepGroup.getId(), stepGroup); + } + catch (CoreException e) { + } + } + } + } + + public IContextStepGroup getStepGroup(String stepGroupId) { + return stepGroups.get(stepGroupId); + } + } + + /* + * Thread save singleton instance creation. + */ + private static class LazyConnectStrategyExtensionPointManager { + public static ConnectStrategyExtensionPointManager instance = new ConnectStrategyExtensionPointManager(); + } + + /** + * Returns the singleton instance for the connection type bindings manager. + */ + public static ConnectStrategyExtensionPointManager getInstance() { + return LazyConnectStrategyExtensionPointManager.instance; + } + + /** + * Constructor. + */ + /* default */ ConnectStrategyExtensionPointManager() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId() + */ + @Override + protected String getExtensionPointId() { + return "org.eclipse.tcf.te.core.connectStrategies"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName() + */ + @Override + protected String getConfigurationElementName() { + return "connectStrategy"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#doCreateExtensionProxy(org.eclipse.core.runtime.IConfigurationElement) + */ + @Override + protected ExecutableExtensionProxy<IConnectStrategy> doCreateExtensionProxy(IConfigurationElement element) throws CoreException { + return new ConnectStrategyExtensionPointProxy(element); + } + + /** + * Returns the connect strategy instance for the given id. + * + * @param id The connect strategy id or <code>null</code>. + * @return Returns the connect strategy instance or <code>null</code>. + */ + public IConnectStrategy getConnectStrategy(String connectStrategyId) { + if (connectStrategyId == null) { + return null; + } + + IConnectStrategy connectStrategy = null; + if (getExtensions().containsKey(connectStrategyId)) { + ExecutableExtensionProxy<IConnectStrategy> proxy = getExtensions().get(connectStrategyId); + // Get the extension instance + connectStrategy = proxy.getInstance(); + } + + return connectStrategy; + } + + public IContextStepGroup getStepGroup(String connectStrategyId, String stepGroupId) { + if (connectStrategyId == null || stepGroupId == null) { + return null; + } + + if (getExtensions().containsKey(connectStrategyId)) { + ConnectStrategyExtensionPointProxy proxy = (ConnectStrategyExtensionPointProxy)getExtensions().get(connectStrategyId); + return proxy.getStepGroup(stepGroupId); + } + return null; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectionTypeBindingsManager.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectionTypeBindingsManager.java new file mode 100644 index 000000000..92870e2ac --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectionTypeBindingsManager.java @@ -0,0 +1,257 @@ +/******************************************************************************* + * 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.core.connection.managers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; +import org.eclipse.tcf.te.core.connection.interfaces.IConnectStrategy; +import org.eclipse.tcf.te.core.connection.interfaces.IConnectionType; + +/** + * Connection type bindings extension point manager implementation. + */ +public class ConnectionTypeBindingsManager { + + /** + * Immutable class describing a connect strategy binding. + */ + private final static class ConnectStrategyBinding { + public final String id; + public final String overwrite; + + public ConnectStrategyBinding(String id, String overwrite) { + this.id = id; + this.overwrite = overwrite; + } + } + + // Flag to remember if the extension point got already read and processed. + private boolean initialized; + + // The map between connection type id's and their associated connect strategies. + private final Map<String, List<ConnectStrategyBinding>> typeIdToStrategyId = new LinkedHashMap<String, List<ConnectStrategyBinding>>(); + + // The sub extension point manager instances + private final ConnectionTypeExtensionPointManager connectionTypeManger = new ConnectionTypeExtensionPointManager(); + + /* + * Thread save singleton instance creation. + */ + private static class LazyConnectionTypeBindingsManager { + public static ConnectionTypeBindingsManager instance = new ConnectionTypeBindingsManager(); + } + + /** + * Returns the singleton instance for the connection type bindings manager. + */ + public static ConnectionTypeBindingsManager getInstance() { + return LazyConnectionTypeBindingsManager.instance; + } + + /** + * Constructor. + */ + ConnectionTypeBindingsManager() { + initialized = false; + initialize(); + } + + /** + * Initialize the connection type bindings manager and triggers to load and read the managed + * extension points. + */ + public void initialize() { + if (initialized) { + return; + } + // load and register the connection type bindings + loadConnectionTypeBindings(); + initialized = true; + } + + // ***** BEGIN: Section extension point management ***** + + /** + * Load and register all connection type id shortcuts. + */ + private void loadConnectionTypeBindings() { + // load all target connection type bindings and register them + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint point = registry.getExtensionPoint("org.eclipse.tcf.te.core.connectionTypeBindings"); //$NON-NLS-1$ + if (point != null) { + // load target connection type bindings + IExtension[] typeBindings = point.getExtensions(); + for (IExtension typeBinding : typeBindings) { + // load configuration elements + IConfigurationElement[] configElements = typeBinding.getConfigurationElements(); + for (IConfigurationElement configElement : configElements) { + // handle connection type binding + if ("connectionTypeBinding".equals(configElement.getName())) { //$NON-NLS-1$ + String connectionTypeId = configElement.getAttribute("connectionTypeId"); //$NON-NLS-1$ + // load connect strategy binding + IConfigurationElement[] connectStrategy = configElement.getChildren("connectStrategy"); //$NON-NLS-1$ + for (IConfigurationElement element : connectStrategy) { + String connectStrategyId = element.getAttribute("id"); //$NON-NLS-1$ + String connectStrategyOverwrite = element.getAttribute("overwrite"); //$NON-NLS-1$ + if (connectStrategyId != null && connectStrategyId.length() > 0) { + registerConnectStrategyBinding(connectionTypeId.trim(), connectStrategyId.trim(), connectStrategyOverwrite != null ? connectStrategyOverwrite.trim() : null); + } + } + } + } + } + } + } + + // ***** END: Section extension point management ***** + + // ***** BEGIN: Section connect strategy management ***** + + /** + * Register a binding between a connection type id and a connect strategy id. Bindings + * registered for the same connection type will be overwritten using the overwrite attribute. If + * the connect strategy id is <code>null</code>, possibly registered bindings are removed. + * + * @param typeId The connection type id. Must not be <code>null</code> and not empty. + * @param strategyId The connect strategy id or <code>null</code>. + * @param overwrite The connect strategy id that should be overwritten by this id. + */ + public void registerConnectStrategyBinding(String typeId, String strategyId, String overwrite) { + Assert.isNotNull(typeId); + Assert.isTrue(typeId.trim().length() > 0); + + if (strategyId != null && strategyId.trim().length() > 0) { + List<ConnectStrategyBinding> bindings = typeIdToStrategyId.get(typeId.trim()); + if (bindings == null) { + bindings = new ArrayList<ConnectStrategyBinding>(); + typeIdToStrategyId.put(typeId.trim(), bindings); + } + ConnectStrategyBinding binding = new ConnectStrategyBinding(strategyId.trim(), overwrite != null ? overwrite.trim() : null); + bindings.add(binding); + Collections.sort(bindings, new Comparator<ConnectStrategyBinding>() { + @Override + public int compare(ConnectStrategyBinding o1, ConnectStrategyBinding o2) { + // handle multiple id's without overwrite (alphabetical order) + if (o1.overwrite == null && o2.overwrite == null) { + return o1.id.compareTo(o2.id); + } + // handle overwrite the same id twice (alphabetical order) + if (o1.overwrite != null && o2.overwrite != null && o1.overwrite.equals(o2.overwrite)) { + return o1.id.compareTo(o2.id); + } + // handle recursive overwrite (alphabetical order) + if (o1.overwrite != null && o1.overwrite.equals(o2.id) && o2.overwrite != null && o2.overwrite.equals(o1.id)) { + return o1.id.compareTo(o2.id); + } + // o1 overwrites o2 + if (o1.overwrite != null && o1.overwrite.equals(o2.id)) { + return -1; + } + // o2 overwrites o1 + if (o2.overwrite != null && o2.overwrite.equals(o1.id)) { + return 1; + } + // fallback alphabetical order + return o1.id.compareTo(o2.id); + } + }); + + } else if (strategyId == null) { + typeIdToStrategyId.remove(typeId.trim()); + } + } + + /** + * Returns the corresponding connect strategy id for the given connection type id. + * + * @param typeId The connection type id. Must not be <code>null</code> and not empty! + * @return The connect strategy id if registered or <code>null</code>. + */ + public String getConnectStrategyId(String typeId) { + if (typeId != null && typeId.trim().length() > 0) { + List<ConnectStrategyBinding> bindings = typeIdToStrategyId.get(typeId.trim()); + return bindings != null && !bindings.isEmpty() ? bindings.get(0).id : null; + } + return null; + } + + /** + * Returns the corresponding <code>IConnectStrategy</code> for the given connection type id. + * + * @param typeId The connection type id. Must not be <code>null</code>. + * @return The corresponding connect strategy object or <code>null</code>. + */ + public IConnectStrategy getConnectStrategy(String typeId) { + Assert.isNotNull(typeId); + String connectStrategyId = getConnectStrategyId(typeId); + return ConnectStrategyExtensionPointManager.getInstance().getConnectStrategy(connectStrategyId); + } + + // ***** END: Section connect strategy management ***** + + // ***** BEGIN: Section connection type management ***** + + /** + * Returns the list of all contributed connection types. + * + * @return The list of contributed connection types, or an empty array. + */ + public IConnectionType[] getConnectionTypes() { + return connectionTypeManger.getConnectionTypes(); + } + + /** + * Returns the corresponding <code>IConnectionType</code> for the given connection type id. + * + * @param typeId The connection type id. Must not be <code>null</code>. + * @return The corresponding connection type object or <code>null</code>. + */ + public IConnectionType getConnectionType(String typeId) { + Assert.isNotNull(typeId); + return connectionTypeManger.getConnectionType(typeId); + } + + /** + * Returns the corresponding <code>IConnectionType</code> for the given connectable context object. + * + * @param context The connectable context object. Must not be <code>null</code> + * @return The corresponding target connection type object or <code>null</code>. + */ + public IConnectionType getConnectionType(Object context) { + Assert.isNotNull(context); + return null; + } + + /** + * Checks if the connection type, specified by the given type id, is enabled. + * <p> + * A connection type is enabled when at least one enablement evaluates to <code>true</code>. + * + * @param typeId The connection type id. Must not be <code>null</code>. + * @return <code>True</code> if the connection type is enabled, <code>false</code> otherwise. + */ + public boolean isConnectionTypeEnabled(String typeId) { + Assert.isNotNull(typeId); + return true; + } + + // ***** END: Section connection type management ***** +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectionTypeExtensionPointManager.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectionTypeExtensionPointManager.java new file mode 100644 index 000000000..3483833c5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/managers/ConnectionTypeExtensionPointManager.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.core.connection.managers; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.connection.interfaces.IConnectionType; +import org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager; +import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy; + +/** + * Connection type extension point manager implementation. + * <p> + * The class is not intended to be subclassed by clients. + */ +public final class ConnectionTypeExtensionPointManager extends AbstractExtensionPointManager<IConnectionType> { + + /** + * Constructor. + */ + /* default */ ConnectionTypeExtensionPointManager() { + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getExtensionPointId() + */ + @Override + protected String getExtensionPointId() { + return "org.eclipse.tcf.te.core.connectionTypes"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.AbstractExtensionPointManager#getConfigurationElementName() + */ + @Override + protected String getConfigurationElementName() { + return "connectionType"; //$NON-NLS-1$ + } + + /** + * Returns the list of all contributed connection types. + * + * @return The list of contributed connection types, or an empty array. + */ + public IConnectionType[] getConnectionTypes() { + List<IConnectionType> types = new ArrayList<IConnectionType>(); + Collection<ExecutableExtensionProxy<IConnectionType>> proxies = getExtensions().values(); + for (ExecutableExtensionProxy<IConnectionType> proxy : proxies) + if (proxy.getInstance() != null && !types.contains(proxy.getInstance())) + types.add(proxy.getInstance()); + + return types.toArray(new IConnectionType[types.size()]); + } + + /** + * Returns the connection type identified by its unique id. If no connection + * type with the specified id is registered, <code>null</code> is returned. + * + * @param id The unique id of the connection type. Must not be <code>null</code> + * @return The connection type or <code>null</code>. + */ + public IConnectionType getConnectionType(String id) { + Assert.isNotNull(id); + + IConnectionType connectionType = null; + if (getExtensions().containsKey(id)) { + ExecutableExtensionProxy<IConnectionType> proxy = getExtensions().get(id); + connectionType = proxy.getInstance(); + } + + return connectionType; + } + +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepExecutor.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepExecutor.java new file mode 100644 index 000000000..c4c59d420 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepExecutor.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * 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.core.connection.strategy; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.activator.CoreBundleActivator; +import org.eclipse.tcf.te.core.nls.Messages; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepExecutor; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContext; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId; + +/** + * Connect strategy step executor implementation. + */ +public class ConnectStrategyStepExecutor extends AbstractContextStepExecutor { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepExecutor#formatMessage(java.lang.String, int, org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.tcf.te.runtime.stepper.interfaces.IContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer) + */ + @Override + protected String formatMessage(String message, int severity, IContextStep step, IFullQualifiedId id, IContext context, IPropertiesContainer data) { + String template = null; + + switch (severity) { + case IStatus.INFO: + template = Messages.ConnectStrategyStepExecutor_info_stepFailed; + break; + case IStatus.WARNING: + template = Messages.ConnectStrategyStepExecutor_warning_stepFailed; + break; + case IStatus.ERROR: + template = Messages.ConnectStrategyStepExecutor_error_stepFailed; + break; + } + + // If we cannot determine the formatted message template, just return the message as is + if (template == null) { + return message; + } + + // Split the message. The first sentence is shown more prominent on the top, + // the rest as additional information below the step information. + String[] splittedMsg = message != null ? message.split("[\t\n\r\f]+", 2) : new String[] { null, null }; //$NON-NLS-1$ + + // Format the core message + String formattedMessage = NLS.bind(template, new String[] { splittedMsg[0], + context.getContextName(), + ConnectStrategyStepper.getConnectStrategy(data).getLabel(), + step.getLabel() + }); + + // Get the context information + String contextInfo = formatContextInfo(context); + if (contextInfo != null) { + formattedMessage += "\n\n" + contextInfo; //$NON-NLS-1$ + } + + // If we have more information available, append them + if (splittedMsg.length > 1 && splittedMsg[1] != null && !"".equals(splittedMsg[1])) { //$NON-NLS-1$ + formattedMessage += "\n\n" + splittedMsg[1]; //$NON-NLS-1$ + } + + // In debug mode, there is even more information to add + if (CoreBundleActivator.getTraceHandler().isSlotEnabled(1, null)) { + formattedMessage += "\n\n" + NLS.bind(Messages.ConnectStrategyStepExecutor_stepFailed_debugInfo, id.toString()); //$NON-NLS-1$ + } + + return formattedMessage; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.AbstractContextStepExecutor#isExceptionMessageFormatted(java.lang.String) + */ + @Override + protected boolean isExceptionMessageFormatted(String message) { + Assert.isNotNull(message); + return message.startsWith(Messages.ConnectStrategyStepExecutor_checkPoint_normalizationNeeded); + } + + /** + * Determines additional context information to show in the failure message. + * + * @param context The context. Must not be <code>null</code>. + * @return The additional context information string or <code>null</code>. + */ + protected String formatContextInfo(IContext context) { + Assert.isNotNull(context); + return context.getContextInfo(); + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepGroup.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepGroup.java new file mode 100644 index 000000000..7110a0a4a --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepGroup.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * 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.core.connection.strategy; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.tcf.te.runtime.extensions.ExecutableExtensionProxy; +import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepGroup; +import org.eclipse.tcf.te.runtime.stepper.extensions.ContextStepGroupable; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroupable; + +/** + * Connect strategy step group implementation. + */ +public class ConnectStrategyStepGroup extends AbstractContextStepGroup { + + private final List<ExecutableExtensionProxy<IContextStep>> steps = new ArrayList<ExecutableExtensionProxy<IContextStep>>(); + + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepGroup#doSetInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) + */ + @Override + public void doSetInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { + super.doSetInitializationData(config, propertyName, data); + + for (IConfigurationElement stepElement : config.getChildren("step")) { //$NON-NLS-1$ + ExecutableExtensionProxy<IContextStep> step = new ExecutableExtensionProxy<IContextStep>(stepElement); + steps.add(step); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup#getSteps(java.lang.String, java.lang.String) + */ + @Override + public IContextStepGroupable[] getSteps(String type, String subType) throws CoreException { + List<IContextStepGroupable> steps = new ArrayList<IContextStepGroupable>(); + for (ExecutableExtensionProxy<IContextStep> stepProxy : this.steps) { + IContextStep step = stepProxy.newInstance(); + if (step != null) { + IContextStepGroupable groupable = new ContextStepGroupable(step); + steps.add(groupable); + } + } + return !steps.isEmpty() ? steps.toArray(new IContextStepGroupable[steps.size()]) : NO_STEPS; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepper.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepper.java new file mode 100644 index 000000000..e9f6017b2 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/connection/strategy/ConnectStrategyStepper.java @@ -0,0 +1,141 @@ +/******************************************************************************* + * 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.core.connection.strategy; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.tcf.te.core.connection.interfaces.IConnectStrategy; +import org.eclipse.tcf.te.core.connection.managers.ConnectStrategyExtensionPointManager; +import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; +import org.eclipse.tcf.te.runtime.stepper.activator.CoreBundleActivator; +import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContext; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepExecutor; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId; +import org.eclipse.tcf.te.runtime.stepper.interfaces.IVariantDelegate; +import org.eclipse.tcf.te.runtime.stepper.interfaces.tracing.ITraceIds; + +/** + * A connect strategy stepper. + */ +@SuppressWarnings("restriction") +public class ConnectStrategyStepper extends AbstractContextStepper { + + public static final String PROPERTY_CONNECT_STRATEGY = "connectStrategy"; //$NON-NLS-1$ + + private final IContext context; + private final String stepGroupId; + + /** + * Constructor. + */ + public ConnectStrategyStepper(IContext context, String stepGroupId, boolean cancelable) { + super(); + this.context = context; + this.stepGroupId = stepGroupId; + setCancelable(cancelable); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper#initialize(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public void initialize(IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws IllegalStateException { + Assert.isNotNull(getConnectStrategy(data)); + super.initialize(data, fullQualifiedId, monitor); + } + + /** + * Get the connect strategy. + * + * @param data The data object. + * @return The connect strategy. + */ + public static final IConnectStrategy getConnectStrategy(IPropertiesContainer data) { + Assert.isNotNull(data); + Assert.isTrue(data.getProperty(PROPERTY_CONNECT_STRATEGY) instanceof IConnectStrategy); + return (IConnectStrategy)data.getProperty(PROPERTY_CONNECT_STRATEGY); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.extensions.ExecutableExtension#getId() + */ + @Override + public String getId() { + String id = super.getId(); + return id != null ? id : "org.eclipse.tcf.te.core.stepper.ConnectStrategyStepper"; //$NON-NLS-1$ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper#getType() + */ + @Override + protected String getType() { + return getData() != null ? getConnectStrategy(getData()).getId() : null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper#getSubType() + */ + @Override + protected String getSubType() { + return stepGroupId; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper#getName() + */ + @Override + protected String getName() { + return context.getContextName(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper#getVariantDelegate() + */ + @Override + protected IVariantDelegate getVariantDelegate() throws CoreException { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper#doCreateStepExecutor(org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep, java.lang.String, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId) + */ + @Override + protected IContextStepExecutor doCreateStepExecutor(IContextStep step, String secondaryId, IFullQualifiedId fullQualifiedStepId) { + return new ConnectStrategyStepExecutor(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper#getStepGroup(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public IContextStepGroup getStepGroup(String connectStrategyId, String stepGroupId, String variant) { + CoreBundleActivator.getTraceHandler().trace("ConnectStrategyStepper#getStepGroup:" //$NON-NLS-1$ + + " connectStrategyId = '" + connectStrategyId + "'" //$NON-NLS-1$ //$NON-NLS-2$ + + ", stepGroupId = '" + stepGroupId + "'" //$NON-NLS-1$ //$NON-NLS-2$ + + (variant != null && variant.length() > 0 ? ", variant = '" + variant + "'" : ""), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + 0, ITraceIds.TRACE_STEPPING, IStatus.WARNING, this); + + return ConnectStrategyExtensionPointManager.getInstance().getStepGroup(connectStrategyId, stepGroupId); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.runtime.stepper.AbstractContextStepper#getContexts() + */ + @Override + protected IContext[] getContexts() { + return new IContext[] { context }; + } +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/model/interfaces/IConnectable.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/model/interfaces/IConnectable.java new file mode 100644 index 000000000..2ee795ee3 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/model/interfaces/IConnectable.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * 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.core.model.interfaces; + + +/** + * Interface to be implemented by model nodes which can be connected. + */ +public interface IConnectable { + + /** + * Property: Connect state. + */ + public static final String PROPERTY_CONNECT_STATE = "connectstate.transient"; //$NON-NLS-1$ + + /** + * Property: Connect sub state. + */ + public static final String PROPERTY_CONNECT_SUB_STATE = "connectSubState.transient"; //$NON-NLS-1$ + + public static final int STATE_UNREACHABLE = -1; + public static final int STATE_UNCONNECTED = 0; + public static final int STATE_DISCONNECTING = 1; + public static final int STATE_CONNECTING = 2; + public static final int STATE_CONNECTED = 3; + + public static final int SUB_STATE_NORMAL = 0; + public static final int SUB_STATE_CONNECT_SEND = 1; + public static final int SUB_STATE_DISCONNECT_SEND = 2; + public static final int SUB_STATE_REBOOT_MANUAL = 3; + + public static final int USER_SUB_STATE_BASE = 10; + + /** + * Returns whether or not this context is connectable. + * + * @return <code>true</code> if this context is connectable. + */ + public boolean isConnectable(); + + /** + * Returns the connect state of this context. + * + * @return The connect state. + */ + public int getConnectState(); + + /** + * Set the connect state of for this context. + * + * @param connectState The new connect state. + * @return <code>true</code> if the state has changed. + */ + public boolean setConnectState(int connectState); + + /** + * Check the current state. + * + * @param connectState The connect state to check. + * @return <code>true</code> if the current connect state equals the given one. + */ + public boolean isConnectState(int connectState); + + /** + * Returns the connect sub state of this context. + * + * @return The connect sub state. + */ + public int getConnectSubState(); + + /** + * Set the connect sub state of for this context. + * + * @param connectSubState The connect sub state to check. + * @return <code>true</code> if the state has changed. + */ + public boolean setConnectSubState(int connectSubState); + + /** + * Check the current sub state. + * + * @param connectSubState The connect sub state to check. + * @return <code>true</code> if the current connect sub state equals the given one. + */ + public boolean isConnectSubState(int connectSubState); +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nls/Messages.java new file mode 100644 index 000000000..a4ae19eb1 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nls/Messages.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * 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.core.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Target Explorer Core plugin externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.core.nls.Messages"; //$NON-NLS-1$ + + /** + * Static constructor. + */ + static { + // Load message values from bundle file + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + // **** Declare externalized string id's down here ***** + + public static String ConnectStrategyStepExecutor_checkPoint_normalizationNeeded; + public static String ConnectStrategyStepExecutor_info_stepFailed; + public static String ConnectStrategyStepExecutor_warning_stepFailed; + public static String ConnectStrategyStepExecutor_error_stepFailed; + public static String ConnectStrategyStepExecutor_stepFailed_debugInfo; +} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nls/Messages.properties new file mode 100644 index 000000000..b727f8639 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/nls/Messages.properties @@ -0,0 +1,19 @@ +# +# org.eclipse.tcf.te.core +# Externalized Strings. +# + +ConnectStrategyStepExecutor_checkPoint_normalizationNeeded=Step finished with this +ConnectStrategyStepExecutor_info_stepFailed=Step finished with this information: {0}\n\n\ +Context: {1}\n\ +Connect Strategy: {2}\n\ +Connect Step: {3} +ConnectStrategyStepExecutor_warning_stepFailed=Step finished with this warning: {0}\n\n\ +Context: {1}\n\ +Connect Strategy: {2}\n\ +Connect Step: {3} +ConnectStrategyStepExecutor_error_stepFailed=Step finished with this error: {0}\n\n\ +Context: {1}\n\ +Connect Strategy: {2}\n\ +Connect Step: {3} +ConnectStrategyStepExecutor_stepFailed_debugInfo=Debug info:\n{0} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/utils/text/StringUtil.java b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/utils/text/StringUtil.java new file mode 100644 index 000000000..0f78e3ad1 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tcf.te.core/src/org/eclipse/tcf/te/core/utils/text/StringUtil.java @@ -0,0 +1,193 @@ +/******************************************************************************* + * 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.core.utils.text; + +import java.io.IOException; +import java.io.StreamTokenizer; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +import org.eclipse.core.runtime.Assert; + +/** + * A class providing useful static method to manipulate strings. + */ +public final class StringUtil { + + /** + * Tokenize a list of whitespace-separated arguments into a list. + * <p> + * <b>Note:</b> <i>This method has been designed for the specific needs of tokenizing + * command line arguments to launch external application from Java!</i> + * <p> + * Arguments may be quoted by double quotes. Quotes must not appear + * inside words, or they will lead to new tokens. + * <p> + * Example:<pre><code> a"bc"d --> tokenized into a,bc,d</code></pre> + * <p> + * If <code>maxArgs</code> is greater than 0, then a maximum of <code>maxArgs</code> + * tokens is returned and the resulting array is filled to the given number of arguments + * with empty strings. + * <p> + * If <code>maxArgs</code> is less than or equal 0, the original number of arguments is tokenized. + * + * @param arguments The space separated arguments string. Must not be <code>null</code>. + * @param maxArgs The maximum number of returned tokens or <code>0</code>. + * @param keepQuotes If <code>true</code>, the original arguments quotes are retained, <code>false</code> otherwise. + * + * @return The tokenized string or an empty list. + */ + public static String[] tokenize(String arguments, int maxArgs, boolean keepQuotes) { + Assert.isNotNull(arguments); + + // Create the result list + List<String> result = maxArgs > 0 ? new ArrayList<String>(maxArgs) : new ArrayList<String>(); + + // Arguments sent separately + StreamTokenizer tok = new StreamTokenizer(new StringReader(arguments)); + tok.resetSyntax(); + // whitespace is everything from 0 to 32 (space) + tok.whitespaceChars(0, 32); + // everything from 33 to 255 is treated as word character + tok.wordChars(33, 255); + // except the 0xa0, is an whitespace too. + tok.whitespaceChars(0xa0, 0xa0); + // the quoting character is the double-quote + tok.quoteChar('"'); + + // extract only the number of arguments request or unlimited if maxArgs == 0 + int nArgs = 0; + while (maxArgs <= 0 || nArgs < maxArgs) { + try { + // get the next token from the stream + int ttype = tok.nextToken(); + // if reached end of file, leave the loop + if (ttype == StreamTokenizer.TT_EOF) { + break; + } + + if (keepQuotes && ttype == 34) { //quoted word + String quoted = enQuote(tok.sval); + if (quoted.length() < 2 || quoted.charAt(0) != '"' || + quoted.charAt(quoted.length() - 1) != '"') { + quoted = '"' + quoted + '"'; + } + result.add(quoted); + } + else { + result.add(tok.sval); + } + nArgs++; + } + catch (IOException e) { + // on any IO exception, break the loop + break; + } + } + return result.toArray(new String[result.size()]); + } + + private final static Pattern ALLOWED_STRING_PATTERN = Pattern.compile("[a-zA-Z0-9_@.-]*"); //$NON-NLS-1$ + + /** + * Enquote the given string if necessary by putting double quotes around it. + * <p> + * <b>Note:</b> <i>This method has been designed for the specific needs of enquoting + * command line arguments to launch external application from Java!</i> + * <p> + * Characters that require quoting are: + * <dl> + * <dt>/\:;</dt><dd>Because they are file or path separators respectively</dd> + * <dt>\s</dt><dd>All whitespace characters, naturally</dd> + * <dt>|<>{}()$^~</dt><dd>Because they have shell or TCL special meaning</dd> + * <dt>*%?&</dt><dd>Because they are commonly used as wildcard's</dd> + * <dt>#</dt><dd>Because it is commonly used to start comments</dd> + * <dt>'"`</dt><dd>Because they are quoting characters</dd> + * </dl> + * To make a long story short, we only allow ASCII characters, numbers, + * the underscore and <code>@.-</code> to go unquoted. + * + * @param unqouted The string to quote or <code>null</code>. + * + * @return The quoted string or "\"\"". + */ + public static String enQuote(String unqouted) { + if (unqouted == null) { + return "\"\""; //$NON-NLS-1$ + } + else if (unqouted.length() == 0) { + return "\"\""; //$NON-NLS-1$ + } + else if (ALLOWED_STRING_PATTERN.matcher(unqouted).matches()) { + return unqouted; + } + else { + StringReader r = new StringReader(unqouted); + StringBuffer buf = new StringBuffer(unqouted.length() + 16); + boolean containsWhitespaces = + Pattern.compile("\\s").matcher(unqouted).find(); //$NON-NLS-1$ + if (containsWhitespaces) { + buf.append('\"'); + } + try { + int c = r.read(); + while (c >= 0) { + switch (c) { + // case '\\': + case '\'': + case '\"': + buf.append('\\'); + buf.append((char)c); + break; + case '\b': + buf.append("\\b");break; //$NON-NLS-1$ + case '\f': + buf.append("\\f");break; //$NON-NLS-1$ + case '\n': + buf.append("\\n");break; //$NON-NLS-1$ + case '\r': + buf.append("\\r");break; //$NON-NLS-1$ + case '\t': + buf.append("\\t");break; //$NON-NLS-1$ + default: + if (c > 0xff) { // Unicode + buf.append('\\'); + buf.append('u'); + String hexString = Integer.toHexString(c); + if (hexString.length() < 4) { + buf.append('0'); + } + buf.append(hexString); + } + else if (c < 0x20 || c > '~') { + // octal escape sequence + buf.append('\\'); + buf.append(Integer.toOctalString(c)); + } + else { + buf.append((char)c); + } + } + c = r.read(); + } + } + catch (IOException e) { /* ignore */ + } + r.close(); + if (containsWhitespaces) { + buf.append('\"'); + } + return buf.toString(); + } + } + +} |