diff options
Diffstat (limited to 'terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial')
22 files changed, 2747 insertions, 0 deletions
diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.classpath new file mode 100644 index 000000000..ad32c83a7 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.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/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options new file mode 100644 index 000000000..9d8591b76 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.options @@ -0,0 +1,2 @@ +org.eclipse.tcf.te.ui.terminals.serial/debugmode = 0 +org.eclipse.tcf.te.ui.terminals.serial/trace/serialLinePanel = false diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project new file mode 100644 index 000000000..e4317e21b --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.tcf.te.ui.terminals.serial</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..4754bba05 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,362 @@ +#Wed Oct 19 12:10:57 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/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 000000000..88bb9570e --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs new file mode 100644 index 000000000..cf80c8bc5 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/.settings/org.eclipse.pde.prefs @@ -0,0 +1,32 @@ +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.build.bin.includes=1 +compilers.p.build.encodings=2 +compilers.p.build.java.compiler=2 +compilers.p.build.java.compliance=1 +compilers.p.build.missing.output=2 +compilers.p.build.output.library=1 +compilers.p.build.source.library=1 +compilers.p.build.src.includes=1 +compilers.p.deprecated=1 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=1 +compilers.p.missing-version-export-package=2 +compilers.p.missing-version-import-package=1 +compilers.p.missing-version-require-bundle=1 +compilers.p.no-required-att=0 +compilers.p.not-externalized-att=2 +compilers.p.unknown-attribute=1 +compilers.p.unknown-class=1 +compilers.p.unknown-element=1 +compilers.p.unknown-identifier=1 +compilers.p.unknown-resource=1 +compilers.p.unresolved-ex-points=0 +compilers.p.unresolved-import=0 +compilers.s.create-docs=false +compilers.s.doc-folder=doc +compilers.s.open-tags=1 +eclipse.preferences.version=1 diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF new file mode 100644 index 000000000..579f425ed --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.tcf.te.ui.terminals.serial;singleton:=true +Bundle-Version: 1.3.0.qualifier +Bundle-Activator: org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400", + org.eclipse.core.runtime;bundle-version="3.8.0", + org.eclipse.equinox.security;bundle-version="1.1.100", + org.eclipse.tcf.te.core.terminals;bundle-version="1.3.0", + org.eclipse.tcf.te.ui.terminals;bundle-version="1.3.0", + org.eclipse.tm.terminal;bundle-version="3.2.300", + org.eclipse.tm.terminal.serial;bundle-version="2.1.200", + org.eclipse.ui;bundle-version="3.8.0", + org.eclipse.ui.forms;bundle-version="3.5.200" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.tcf.te.ui.terminals.serial.activator;x-internal:=true, + org.eclipse.tcf.te.ui.terminals.serial.controls, + org.eclipse.tcf.te.ui.terminals.serial.interfaces, + org.eclipse.tcf.te.ui.terminals.serial.launcher, + org.eclipse.tcf.te.ui.terminals.serial.nls;x-internal:=true +Import-Package: gnu.io;resolution:=optional diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html new file mode 100644 index 000000000..0f07cf034 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>May 24, 2012</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties new file mode 100644 index 000000000..221a2d955 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/build.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2012 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 +############################################################################### +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.properties,\ + plugin.xml,\ + about.html diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties new file mode 100644 index 000000000..a471a57b6 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.properties @@ -0,0 +1,16 @@ +################################################################################## +# Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +################################################################################## + +pluginName = Target Explorer, Serial Terminals Extensions +providerName = Eclipse.org - Target Explorer + +# ----- Terminal Launcher Delegates ----- + +SerialLauncherDelegate.label=Serial Terminal
\ No newline at end of file diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml new file mode 100644 index 000000000..31552a2a7 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/plugin.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + +<!-- Terminals launcher delegate contributions --> + <extension point="org.eclipse.tcf.te.ui.terminals.launcherDelegates"> + <delegate + class="org.eclipse.tcf.te.ui.terminals.serial.launcher.SerialLauncherDelegate" + id="org.eclipse.tcf.te.ui.terminals.serial.launcher.serial" + label="%SerialLauncherDelegate.label"> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate operator="and" ifEmpty="false"> + <test + forcePluginActivation="true" + property="org.eclipse.tcf.te.runtime.services.hasService" + value="org.eclipse.tcf.te.runtime.services.interfaces.IPropertiesAccessService"/> + </iterate> + </with> + </enablement> + </delegate> + </extension> +</plugin> diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/pom.xml new file mode 100644 index 000000000..5014b6d9f --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/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>org.eclipse.tcf.maven-build</artifactId> + <version>1.3.0-SNAPSHOT</version> + <relativePath>../../../admin/pom-build.xml</relativePath> + </parent> + + <version>1.3.0.qualifier</version> + <artifactId>org.eclipse.tcf.te.ui.terminals.serial</artifactId> + <packaging>eclipse-plugin</packaging> +</project> diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java new file mode 100644 index 000000000..19ac52a26 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/activator/UIPlugin.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tcf.te.core.terminals.tracing.TraceHandler; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class UIPlugin extends AbstractUIPlugin { + // The shared instance + private static UIPlugin plugin; + // The trace handler instance + private static volatile TraceHandler traceHandler; + + /** + * The constructor + */ + public UIPlugin() { + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static UIPlugin getDefault() { + return plugin; + } + + /** + * Convenience method which returns the unique identifier of this plugin. + */ + public static String getUniqueIdentifier() { + if (getDefault() != null && getDefault().getBundle() != null) { + return getDefault().getBundle().getSymbolicName(); + } + return "org.eclipse.tcf.te.ui.terminals.serial"; //$NON-NLS-1$ + } + + /** + * 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.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the <code>Image</code> object instance. + * + * @param key The key the image is registered with. + * @return The <code>Image</code> object instance or <code>null</code>. + */ + public static Image getImage(String key) { + return getDefault().getImageRegistry().get(key); + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the <code>ImageDescriptor</code> object instance. + * + * @param key The key the image is registered with. + * @return The <code>ImageDescriptor</code> object instance or <code>null</code>. + */ + public static ImageDescriptor getImageDescriptor(String key) { + return getDefault().getImageRegistry().getDescriptor(key); + } +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java new file mode 100644 index 000000000..d5aac3b96 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialConfigurationPanel.java @@ -0,0 +1,134 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.controls; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel; +import org.eclipse.ui.forms.widgets.FormToolkit; + +/** + * Serial wizard configuration panel implementation. + */ +public class SerialConfigurationPanel extends AbstractExtendedConfigurationPanel { + + private SerialLinePanel serialSettingsPage; + + /** + * Constructor. + * + * @param container The configuration panel container or <code>null</code>. + */ + public SerialConfigurationPanel(IConfigurationPanelContainer container) { + super(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit) + */ + @Override + public void setupPanel(Composite parent, FormToolkit toolkit) { + Composite panel = new Composite(parent, SWT.NONE); + panel.setLayout(new GridLayout()); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + panel.setLayoutData(data); + + // Create the host selection combo + if (isWithoutSelection()) createHostsUI(panel, true); + + serialSettingsPage = new SerialLinePanel(getContainer()); + serialSettingsPage.setupPanel(panel, toolkit); + + // Create the encoding selection combo + createEncodingUI(panel, true); + + setControl(panel); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map<String, Object> data) { + // set the terminal connector id for serial + data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID, "org.eclipse.tm.internal.terminal.serial.SerialConnector"); //$NON-NLS-1$ + + serialSettingsPage.extractData(data); + data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#fillSettingsForHost(java.lang.String) + */ + @Override + protected void fillSettingsForHost(String host){ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#saveSettingsForHost(boolean) + */ + @Override + protected void saveSettingsForHost(boolean add){ + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#isValid() + */ + @Override + public boolean isValid(){ + return serialSettingsPage.isValid(); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + serialSettingsPage.doSaveWidgetValues(settings, idPrefix); + // Save the encodings widget values + doSaveEncodingsWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + serialSettingsPage.doRestoreWidgetValues(settings, idPrefix); + // Restore the encodings widget values + doRestoreEncodingsWidgetValues(settings, idPrefix); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#getHostFromSettings() + */ + @Override + protected String getHostFromSettings() { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractExtendedConfigurationPanel#isWithHostList() + */ + @Override + public boolean isWithHostList() { + return false; + } +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java new file mode 100644 index 000000000..b5009244c --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialLinePanel.java @@ -0,0 +1,789 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.controls; + +import gnu.io.CommPortIdentifier; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.serial.interfaces.ITraceIds; +import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.forms.widgets.FormToolkit; + +/** + * Serial line terminal launcher configuration panel implementation. + */ +public class SerialLinePanel extends AbstractConfigurationPanel { + public static final String fcDefaultTTYSpeed = "9600"; //$NON-NLS-1$ + public static final String fcDefaultTTYDeviceWin32 = "COM1"; //$NON-NLS-1$ + public static final String fcDefaultTTYDeviceSolaris = "/dev/cua/a"; //$NON-NLS-1$ + public static final String fcDefaultTTYDeviceLinux = "/dev/ttyS0"; //$NON-NLS-1$ + public static final String fcDefaultTTYDatabits = "8"; //$NON-NLS-1$ + public static final String fcDefaultTTYParity = "None"; //$NON-NLS-1$ + public static final String fcDefaultTTYStopbits = "1"; //$NON-NLS-1$ + public static final String fcDefaultTTYFlowControl = "None"; //$NON-NLS-1$ + public static final String fcDefaultTTYTimeout = "5"; //$NON-NLS-1$ + public static final String fcEditableTTYOther = "Other..."; //$NON-NLS-1$ + + private static final String[] fcTTYSpeedRates = { "600", //$NON-NLS-1$ + "1200", //$NON-NLS-1$ + "2400", //$NON-NLS-1$ + "4800", //$NON-NLS-1$ + "9600", //$NON-NLS-1$ + "14400", //$NON-NLS-1$ + "19200", //$NON-NLS-1$ + "38400", //$NON-NLS-1$ + "57600", //$NON-NLS-1$ + "115200" //$NON-NLS-1$ + }; + + private static final String[] fcTTYDatabits = { + "8", "7" //$NON-NLS-1$ //$NON-NLS-2$ + }; + + private static final String[] fcTTYParity = { + "None", "Odd", "Even" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }; + + private static final String[] fcTTYStopbits = { + "1", "2" //$NON-NLS-1$ //$NON-NLS-2$ + }; + + private static final String[] fcTTYFlowControl = { + "None", "Hardware", "Software" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }; + + Label hostTTYDeviceLabel; + Combo hostTTYDeviceCombo; + Label hostTTYSpeedLabel; + Combo hostTTYSpeedCombo; + Label hostTTYBitsLabel; + Combo hostTTYBitsCombo; + Label hostTTYParityLabel; + Combo hostTTYParityCombo; + Label hostTTYStopbitsLabel; + Combo hostTTYStopbitsCombo; + Label hostTTYFlowControlLabel; + Combo hostTTYFlowControlCombo; + Label hostTTYTimeoutLabel; + Text hostTTYTimeoutText; + + // Keep the fInputValidator protected! + protected IInputValidator inputValidatorBaud; + + int lastSelected = -1; + int lastSelectedBaud = -1; + + /** + * Constructor. + * + * @param container The configuration panel container or <code>null</code>. + */ + public SerialLinePanel(IConfigurationPanelContainer container) { + super(container); + } + + protected class CustomSerialBaudRateInputValidator implements IInputValidator { + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String) + */ + @Override + public String isValid(String newText) { + if (newText != null && newText.trim().length() > 0) { + if (!newText.matches("[0-9]*")) { //$NON-NLS-1$ + return Messages.SerialLinePanel_error_invalidCharactesBaudRate; + } + } else if (newText != null) { + // Empty string is an error without message (see interface)! + return ""; //$NON-NLS-1$ + } + return null; + } + } + + /** + * Returns the input validator to be used for checking the custom serial + * baud rate for basic plausibility. + */ + protected IInputValidator getCustomSerialBaudRateInputValidator() { + if (inputValidatorBaud == null) { + inputValidatorBaud = new CustomSerialBaudRateInputValidator(); + } + return inputValidatorBaud; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.interfaces.IWizardConfigurationPanel#setupPanel(org.eclipse.swt.widgets.Composite, org.eclipse.ui.forms.widgets.FormToolkit) + */ + @Override + public void setupPanel(Composite parent, FormToolkit toolkit) { + Assert.isNotNull(parent); + Assert.isNotNull(toolkit); + + Composite panel = toolkit.createComposite(parent); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + panel.setBackground(parent.getBackground()); + + setControl(panel); + + final Composite client = toolkit.createComposite(panel); + Assert.isNotNull(client); + client.setLayout(new GridLayout(2, false)); + client.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + client.setBackground(panel.getBackground()); + + // Host TTY settings + hostTTYDeviceLabel = new Label(client, SWT.NONE); + hostTTYDeviceLabel.setText(Messages.SerialLinePanel_hostTTYDevice_label); + + hostTTYDeviceCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYDeviceCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYDeviceCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // if the user selected the special editable device, show a dialog asking for the device name + if (fcEditableTTYOther.equals(hostTTYDeviceCombo.getText())) { + List<String> tty = new ArrayList<String>(); + List<String> tcp = new ArrayList<String>(); + String selected = hostTTYDeviceCombo.getItem(lastSelected); + for (String device : hostTTYDeviceCombo.getItems()) { + if (!device.equalsIgnoreCase(fcEditableTTYOther)) { + if (device.toUpperCase().startsWith("TCP:")) { //$NON-NLS-1$ + tcp.add(device); + } + else { + tty.add(device); + } + } + } + SerialPortAddressDialog dialog = new SerialPortAddressDialog(client.getShell(), selected, tty, tcp); + if (dialog.open() == Window.OK) { + // retrieve the custom serial device name and set it to the combobox drop + String device = dialog.getData(); + if (device != null && device.trim().length() > 0) { + hostTTYDeviceCombo.add(device.trim()); + hostTTYDeviceCombo.setText(device.trim()); + } else if (lastSelected != -1) { + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(lastSelected)); + } + } else if (lastSelected != -1){ + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(lastSelected)); + } + } + lastSelected = hostTTYDeviceCombo.getSelectionIndex(); + + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + hostTTYSpeedLabel = new Label(client, SWT.NONE); + hostTTYSpeedLabel.setText(Messages.SerialLinePanel_hostTTYSpeed_label); + + hostTTYSpeedCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYSpeedCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYSpeedCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // if the user selected the special editable baud rate, show a dialog asking for the baud rate + if (fcEditableTTYOther.equals(hostTTYSpeedCombo.getText())) { + InputDialog dialog = new InputDialog(getControl().getShell(), + Messages.SerialLinePanel_customSerialBaudRate_title, + Messages.SerialLinePanel_customSerialBaudRate_message, + "", //$NON-NLS-1$ + getCustomSerialBaudRateInputValidator()); + if (dialog.open() == Window.OK) { + // retrieve the custom serial device name and set it to the combobox drop + String device = dialog.getValue(); + if (device != null && device.trim().length() > 0) { + int index = hostTTYSpeedCombo.indexOf(fcEditableTTYOther); + if (index != -1 && index == hostTTYSpeedCombo.getItemCount() - 1) { + hostTTYSpeedCombo.add(device.trim()); + } else if (index != -1) { + hostTTYSpeedCombo.setItem(index + 1, device.trim()); + } + hostTTYSpeedCombo.setText(device.trim()); + } else if (lastSelectedBaud != -1) { + hostTTYSpeedCombo.setText(hostTTYSpeedCombo.getItem(lastSelectedBaud)); + } + } else if (lastSelectedBaud != -1){ + hostTTYSpeedCombo.setText(hostTTYSpeedCombo.getItem(lastSelectedBaud)); + } + } + lastSelectedBaud = hostTTYSpeedCombo.getSelectionIndex(); + + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + // Query the list of available serial port interfaces. + UIPlugin.getTraceHandler().trace("SerialLinePanel: Start quering the available comm ports.", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ + + // Query the serial devices now. + BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { + @Override + public void run() { + queryAvailableSerialDevices(); + } + }); + + // add a special device which is being the editable one if requested at the end of the list + hostTTYDeviceCombo.add(fcEditableTTYOther); + + if (hostTTYDeviceCombo.indexOf(getDefaultHostTTYDevice()) != -1) { + hostTTYDeviceCombo.setText(getDefaultHostTTYDevice()); + } else { + if ("".equals(hostTTYDeviceCombo.getText()) && hostTTYDeviceCombo.getItemCount() > 0) { //$NON-NLS-1$ + // USI: For SWT-GTK we need the special empty entry as well. Otherwise we will have problems + // getting the selection changed event! + if (hostTTYDeviceCombo.getItemCount() == 1 + && fcEditableTTYOther.equals(hostTTYDeviceCombo.getItem(0))) { + hostTTYDeviceCombo.add("", 0); //$NON-NLS-1$ + } + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(0)); + } + } + + if (hostTTYDeviceCombo.getItemCount() > 0) { + hostTTYDeviceCombo.setEnabled(true); + } else { + hostTTYDeviceCombo.setEnabled(false); + } + lastSelected = hostTTYDeviceCombo.getSelectionIndex(); + + for (String fcTTYSpeedRate : fcTTYSpeedRates) { + hostTTYSpeedCombo.add(fcTTYSpeedRate); + } + hostTTYSpeedCombo.add(fcEditableTTYOther); + + hostTTYSpeedCombo.setText(fcDefaultTTYSpeed); + lastSelectedBaud = hostTTYSpeedCombo.getSelectionIndex(); + + // add the advanced serial options + hostTTYBitsLabel = new Label(client, SWT.NONE); + hostTTYBitsLabel.setText(Messages.SerialLinePanel_hostTTYDatabits_label); + hostTTYBitsCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYBitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYBitsCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String fcTTYDatabit : fcTTYDatabits) { + hostTTYBitsCombo.add(fcTTYDatabit); + } + hostTTYBitsCombo.setText(fcDefaultTTYDatabits); + + hostTTYParityLabel = new Label(client, SWT.NONE); + hostTTYParityLabel.setText(Messages.SerialLinePanel_hostTTYParity_label); + hostTTYParityCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYParityCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYParityCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String element : fcTTYParity) { + hostTTYParityCombo.add(element); + } + hostTTYParityCombo.setText(fcDefaultTTYParity); + + hostTTYStopbitsLabel = new Label(client, SWT.NONE); + hostTTYStopbitsLabel.setText(Messages.SerialLinePanel_hostTTYStopbits_label); + hostTTYStopbitsCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYStopbitsCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYStopbitsCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String fcTTYStopbit : fcTTYStopbits) { + hostTTYStopbitsCombo.add(fcTTYStopbit); + } + hostTTYStopbitsCombo.setText(fcDefaultTTYStopbits); + + hostTTYFlowControlLabel = new Label(client, SWT.NONE); + hostTTYFlowControlLabel.setText(Messages.SerialLinePanel_hostTTYFlowControl_label); + hostTTYFlowControlCombo = new Combo(client, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); + hostTTYFlowControlCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYFlowControlCombo.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + + for (String element : fcTTYFlowControl) { + hostTTYFlowControlCombo.add(element); + } + hostTTYFlowControlCombo.setText(fcDefaultTTYFlowControl); + + hostTTYTimeoutLabel = new Label(client, SWT.NONE); + hostTTYTimeoutLabel.setText(Messages.SerialLinePanel_hostTTYTimeout_label); + hostTTYTimeoutText = new Text(client, SWT.SINGLE | SWT.BORDER); + hostTTYTimeoutText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + hostTTYTimeoutText.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + IConfigurationPanelContainer container = SerialLinePanel.this.getContainer(); + if (container != null) container.validate(); + } + }); + hostTTYTimeoutText.setText(fcDefaultTTYTimeout); + } + + /** + * Query the list of serial devices. + */ + protected void queryAvailableSerialDevices() { + // Avoid printing the library version output to stdout if the platform + // is not in debug mode. + String prop = System.getProperty("gnu.io.rxtx.NoVersionOutput"); //$NON-NLS-1$ + if (prop == null && !Platform.inDebugMode()) { + System.setProperty("gnu.io.rxtx.NoVersionOutput", "true"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + // java.lang.UnsatisfiedLinkError: ../plugins/gnu.io.rxtx.solaris.sparc_2.1.7.200702281917/os/solaris/sparc/librxtxSerial.so: + // Can't load Sparc 32-bit .so on a Sparc 32-bit platform + // May happen in CommPortIdentifier static constructor! + try { + Enumeration<CommPortIdentifier> ttyPortIds = CommPortIdentifier.getPortIdentifiers(); + if (!ttyPortIds.hasMoreElements()) { + UIPlugin.getTraceHandler().trace("SerialLinePanel: NO comm ports available at all!", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ + } + final List<String> ports = new ArrayList<String>(); + while (ttyPortIds.hasMoreElements()) { + CommPortIdentifier port = ttyPortIds.nextElement(); + String type = "unknown"; //$NON-NLS-1$ + if (port.getPortType() == CommPortIdentifier.PORT_PARALLEL) { + type = "parallel"; //$NON-NLS-1$ + } + if (port.getPortType() == CommPortIdentifier.PORT_SERIAL) { + type = "serial"; //$NON-NLS-1$ + } + UIPlugin.getTraceHandler().trace("SerialLinePanel: Found comm port: name='" + port.getName() + "', type='" + type, ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ //$NON-NLS-2$ + // only add serial ports + if (port.getPortType() == CommPortIdentifier.PORT_SERIAL) { + UIPlugin.getTraceHandler().trace("SerialLinePanel: Adding found serial comm port to combo!", ITraceIds.TRACE_SERIAL_LINE_PANEL, this); //$NON-NLS-1$ + if (!ports.contains(port.getName())) { + ports.add(port.getName()); + } + } + } + if (!ports.isEmpty()) { + Collections.sort(ports); + // This method may executed in a separate thread. We must spawn back + // into the UI thread to execute the adding of the ports to the control. + PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { + @Override + public void run() { + for (String port : ports) { + hostTTYDeviceCombo.add(port); + } + } + }); + } + } catch (UnsatisfiedLinkError e) { + IStatus status = new Status(IStatus.WARNING, UIPlugin.getUniqueIdentifier(), + Messages.SerialLinePanel_warning_FailedToLoadSerialPorts, e); + UIPlugin.getDefault().getLog().log(status); + } catch (NoClassDefFoundError e) { + // The NoClassDefFoundError happens the second time if the load of the library + // failed once! We do ignore this error completely! + } + } + + /** + * Enables or disables the configuration panels controls. + * + * @param enabled Specify <code>true</code> to enable the controls, <code>false</code> otherwise. + */ + @Override + public void setEnabled(boolean enabled) { + hostTTYDeviceLabel.setEnabled(enabled); + hostTTYDeviceCombo.setEnabled(enabled); + hostTTYSpeedLabel.setEnabled(enabled); + hostTTYSpeedCombo.setEnabled(enabled); + hostTTYBitsLabel.setEnabled(enabled); + hostTTYBitsCombo.setEnabled(enabled); + hostTTYParityLabel.setEnabled(enabled); + hostTTYParityCombo.setEnabled(enabled); + hostTTYStopbitsLabel.setEnabled(enabled); + hostTTYStopbitsCombo.setEnabled(enabled); + hostTTYFlowControlLabel.setEnabled(enabled); + hostTTYFlowControlCombo.setEnabled(enabled); + } + + /** + * The name of the serial ports differ between the host platforms, so we have to + * detect the default host TTY device based on the host platform. + */ + public String getDefaultHostTTYDevice() { + String osName = System.getProperty("os.name"); //$NON-NLS-1$ + // Linux ? + if (osName.equalsIgnoreCase("Linux")) { //$NON-NLS-1$ + return fcDefaultTTYDeviceLinux; + } + // Solaris ? + if (osName.equalsIgnoreCase("SunOS")) { //$NON-NLS-1$ + return fcDefaultTTYDeviceSolaris; + } + // Windows ? + if (osName.toLowerCase().startsWith("windows")) { //$NON-NLS-1$ + return fcDefaultTTYDeviceWin32; + } + return ""; //$NON-NLS-1$ + } + + /** + * Returns the default value for the serial port speed setting in bit/s + */ + public String getDefaultHostTTYSpeed() { + return fcDefaultTTYSpeed; + } + + /** + * Returns the default value for the serial port data bits setting + */ + public String getDefaultHostTTYDatabits() { + return fcDefaultTTYDatabits; + } + + /** + * Returns the default value for the serial port parity setting + */ + public String getDefaultHostTTYParity() { + return fcDefaultTTYParity; + } + + /** + * Returns the default value for the serial port stop bits setting + */ + public String getDefaultHostTTYStopbits() { + return fcDefaultTTYStopbits; + } + + /** + * Returns the default value for the serial port flow control setting + */ + public String getDefaultHostTTYFlowControl() { + return fcDefaultTTYFlowControl; + } + + /** + * Returns the default value for the serial port timeout setting. + */ + public String getDefaultHostTTYTimeout() { + return fcDefaultTTYTimeout; + } + + /** + * Set the text to the combo if available as selectable option. + * + * @param combo The combo box control. Must not be <code>null</code>. + * @param value The value to set. Must not be <code>null</code>. + */ + protected void doSetTextInCombo(Combo combo, String value) { + Assert.isNotNull(combo); + Assert.isNotNull(value); + if (combo.indexOf(value) != 1) { + combo.setText(value); + } + } + + /** + * Select the given tty device if available. + * + * @param value The tty device to select. Must not be <code>null</code>. + */ + public void setSelectedTTYDevice(String value) { + doSetTextInCombo(hostTTYDeviceCombo, value); + } + + /** + * Select the given tty device if available. The method + * will do nothing if the specified index is invalid. + * + * @param index The index of the tty device to select. + */ + public void setSelectedTTYDevice(int index) { + if (index >= 0 && index < hostTTYDeviceCombo.getItemCount()) { + hostTTYDeviceCombo.setText(hostTTYDeviceCombo.getItem(index)); + } + } + + /** + * Select the given tty device speed if available. + * + * @param value The tty device speed to select. Must not be <code>null</code>. + */ + public void setSelectedTTYSpeed(String value) { + doSetTextInCombo(hostTTYSpeedCombo, value); + } + + /** + * Select the given tty device data bit configuration if available. + * + * @param value The tty device data bit configuration to select. Must not be <code>null</code>. + */ + public void setSelectedTTYDatabits(String value) { + doSetTextInCombo(hostTTYBitsCombo, value); + } + + /** + * Select the given tty device parity configuration if available. + * + * @param value The tty device parity configuration to select. Must not be <code>null</code>. + */ + public void setSelectedTTYParity(String value) { + doSetTextInCombo(hostTTYParityCombo, value); + } + + /** + * Select the given tty device stop bit configuration if available. + * + * @param value The tty device stop bit configuration to select. Must not be <code>null</code>. + */ + public void setSelectedTTYStopbits(String value) { + doSetTextInCombo(hostTTYStopbitsCombo, value); + } + + /** + * Select the given tty device flow control configuration if available. + * + * @param value The tty device flow control configuration to select. Must not be <code>null</code>. + */ + public void setSelectedTTYFlowControl(String value) { + doSetTextInCombo(hostTTYFlowControlCombo, value); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#isValid() + */ + @Override + public boolean isValid() { + String selectedTTYDevice = hostTTYDeviceCombo.getText(); + if (selectedTTYDevice == null || selectedTTYDevice.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYDevice, IMessageProvider.ERROR); + return false; + } + + if (fcEditableTTYOther.equals(selectedTTYDevice)) { + setMessage(Messages.SerialLinePanel_info_editableTTYDeviceSelected, IMessageProvider.INFORMATION); + return false; + } + + String selectedTTYSpeedRate = hostTTYSpeedCombo.getText(); + if (selectedTTYSpeedRate == null || selectedTTYSpeedRate.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYSpeedRate, IMessageProvider.ERROR); + return false; + } + + if (fcEditableTTYOther.equals(selectedTTYSpeedRate)) { + setMessage(Messages.SerialLinePanel_info_editableTTYBaudRateSelected, IMessageProvider.INFORMATION); + return false; + } + + String option = hostTTYBitsCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYDatabits, IMessageProvider.ERROR); + return false; + } + + option = hostTTYParityCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYParity, IMessageProvider.ERROR); + return false; + } + + option = hostTTYStopbitsCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYStopbits, IMessageProvider.ERROR); + return false; + } + + option = hostTTYFlowControlCombo.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR); + return false; + } + + option = hostTTYTimeoutText.getText(); + if (option == null || option.trim().length() == 0) { + setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR); + return false; + } + + return true; + } + + private final String fcSelectedTTYDeviceSlotId = "SerialLinePanel.selectedTTYDevice." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYSpeedRateSlotId = "SerialLinePanel.selectedTTYSpeedRate." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYDatabitsSlotId = "SerialLinePanel.selectedTTYDatabits." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYParitySlotId = "SerialLinePanel.selectedTTYParity." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYStopbitsSlotId = "SerialLinePanel.selectedTTYStopbits." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYFlowControlSlotId = "SerialLinePanel.selectedTTYFlowControl." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + private final String fcSelectedTTYTimeoutSlotId = "SerialLinePanel.selectedTTYTimeout." + System.getProperty("os.name"); //$NON-NLS-1$ //$NON-NLS-2$ + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doRestoreWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doRestoreWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + String selectedTTYDevice = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix)); + if (selectedTTYDevice != null && selectedTTYDevice.trim().length() > 0) { + if (hostTTYDeviceCombo.indexOf(selectedTTYDevice) != -1) { + hostTTYDeviceCombo.setText(selectedTTYDevice); + } + } + + String selectedTTYSpeedRate = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix)); + if (selectedTTYSpeedRate != null && selectedTTYSpeedRate.trim().length() > 0) { + if (hostTTYSpeedCombo.indexOf(selectedTTYSpeedRate) != -1) { + hostTTYSpeedCombo.setText(selectedTTYSpeedRate); + } + } + + String option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYBitsCombo.indexOf(option) != -1) { + hostTTYBitsCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYParityCombo.indexOf(option) != -1) { + hostTTYParityCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYStopbitsCombo.indexOf(option) != -1) { + hostTTYStopbitsCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && hostTTYFlowControlCombo.indexOf(option) != -1) { + hostTTYFlowControlCombo.setText(option); + } + + option = settings.get(prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix)); + if (option != null && option.trim().length() > 0 && !option.equals(hostTTYTimeoutText.getText())) { + hostTTYTimeoutText.setText(option); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.controls.panels.AbstractWizardConfigurationPanel#doSaveWidgetValues(org.eclipse.jface.dialogs.IDialogSettings, java.lang.String) + */ + @Override + public void doSaveWidgetValues(IDialogSettings settings, String idPrefix) { + Assert.isNotNull(settings); + + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYDeviceSlotId, idPrefix), hostTTYDeviceCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYSpeedRateSlotId, idPrefix), hostTTYSpeedCombo.getText()); + + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYDatabitsSlotId, idPrefix), hostTTYBitsCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYParitySlotId, idPrefix), hostTTYParityCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYStopbitsSlotId, idPrefix), hostTTYStopbitsCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYFlowControlSlotId, idPrefix), hostTTYFlowControlCombo.getText()); + settings.put(prefixDialogSettingsSlotId(fcSelectedTTYTimeoutSlotId, idPrefix), hostTTYTimeoutText.getText()); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#setupData(java.util.Map) + */ + @Override + public void setupData(Map<String, Object> data) { + if (data == null) return; + + hostTTYDeviceCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE)); + hostTTYSpeedCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE)); + + hostTTYBitsCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS)); + hostTTYParityCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY)); + hostTTYStopbitsCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS)); + hostTTYFlowControlCombo.setText((String)data.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL)); + + Object value = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + if (value instanceof Integer) { + hostTTYTimeoutText.setText(((Integer)value).toString()); + } + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.panels.AbstractConfigurationPanel#extractData(java.util.Map) + */ + @Override + public void extractData(Map<String, Object> data) { + if (data == null) return; + + data.put(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, hostTTYDeviceCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, hostTTYSpeedCombo.getText()); + + data.put(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, hostTTYBitsCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, hostTTYParityCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, hostTTYStopbitsCombo.getText()); + data.put(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, hostTTYFlowControlCombo.getText()); + + if (hostTTYTimeoutText.getText() != null) { + Integer timeout = null; + try { + timeout = Integer.decode(hostTTYTimeoutText.getText()); + } catch (NumberFormatException e) { /* ignored on purpose */ } + if (timeout != null) data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, timeout); + else data.remove(ITerminalsConnectorConstants.PROP_TIMEOUT); + } + } +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java new file mode 100644 index 000000000..1e5632c42 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/controls/SerialPortAddressDialog.java @@ -0,0 +1,689 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.controls; + +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.tcf.te.ui.terminals.serial.activator.UIPlugin; +import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages; +import org.eclipse.ui.PlatformUI; + +/** + * Serial line port or address dialog. + */ +public class SerialPortAddressDialog extends TitleAreaDialog implements IMessageProvider { + private String contextHelpId = null; + + private String message; + private int messageType; + private String errorMessage; + private String title; + + // The default message is shown to the user if no other message is set + private String defaultMessage; + private int defaultMessageType; + + Button ttyControlSelector; + Combo ttyControl; + Button tcpControlSelector; + Combo addressControl; + Combo portControl; + Label portLabel; + + List<String> ttyHistory; + List<String> tcpHistory; + + String data = null; + + // regular expressions for validator + /* default */ static final String IP_CHARACTERS_REGEX = "[0-9][0-9\\.]*"; //$NON-NLS-1$ + /* default */ static final String IP_FRAGMENT_REGEX = "([0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])"; //$NON-NLS-1$ + /* default */ static final String IP_REGEX = IP_FRAGMENT_REGEX + "(\\." + IP_FRAGMENT_REGEX + "){3}[ ]*"; //$NON-NLS-1$ //$NON-NLS-2$ + + // RFC 1034 - ftp://ftp.rfc-editor.org/in-notes/std/std13.txt + /* default */ static final String NAME_CHARACTERS_REGEX = "[a-zA-Z][0-9a-zA-Z\\-_\\.]*"; //$NON-NLS-1$ + // characters that can be set at the beginning + /* default */ static final String NAME_START_REGEX = "[a-zA-Z]"; //$NON-NLS-1$ + // characters that can be set after the starting character + /* default */ static final String NAME_FOLLOW_REGEX = "[a-zA-Z0-9-_]"; //$NON-NLS-1$ + // characters that can be set at the end + /* default */ static final String NAME_END_REGEX = "[a-zA-Z0-9]"; //$NON-NLS-1$ + // single name fragment + /* default */ static final String NAME_FRAGMENT_REGEX = "(" + NAME_START_REGEX + "(" + NAME_FOLLOW_REGEX + "*" + NAME_END_REGEX + ")?)"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + /* default */ static final String NAME_REGEX = NAME_FRAGMENT_REGEX + "(\\." + NAME_FRAGMENT_REGEX + ")*[ ]*"; //$NON-NLS-1$ //$NON-NLS-2$ + + /** + * Constructor. + * @param parentShell + */ + public SerialPortAddressDialog(Shell parentShell, String selected, List<String> ttyHistory, List<String> tcpHistory) { + super(parentShell); + this.ttyHistory = ttyHistory; + this.tcpHistory = tcpHistory; + this.data = selected; + + this.contextHelpId = UIPlugin.getUniqueIdentifier() + ".SerialPortAddressDialog"; //$NON-NLS-1$ + setHelpAvailable(true); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#isResizable() + */ + @Override + protected boolean isResizable() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#create() + */ + @Override + public void create() { + super.create(); + + // If the dialog got set a message, make sure the message is really shown + // to the user from the beginning. + if (isMessageSet()) { + if (errorMessage != null) { + super.setErrorMessage(errorMessage); + } + else { + super.setMessage(message, messageType); + } + } else if (defaultMessage != null) { + // Default message set + super.setMessage(defaultMessage, defaultMessageType); + } + + // If the dialog got set a title, make sure the title is shown + if (title != null) { + super.setTitle(title); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + @Override + protected final Control createDialogArea(Composite parent) { + if (contextHelpId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, contextHelpId); + } + + // Let the super implementation create the dialog area control + Control control = super.createDialogArea(parent); + // Setup the inner panel as scrollable composite + if (control instanceof Composite) { + ScrolledComposite sc = new ScrolledComposite((Composite)control, SWT.V_SCROLL); + + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; layout.marginWidth = 0; + layout.verticalSpacing = 0; layout.horizontalSpacing = 0; + + sc.setLayout(layout); + sc.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + + sc.setExpandHorizontal(true); + sc.setExpandVertical(true); + + Composite composite = new Composite(sc, SWT.NONE); + composite.setLayout(new GridLayout()); + + // Setup the dialog area content + createDialogAreaContent(composite); + + sc.setContent(composite); + sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + // Return the scrolled composite as new dialog area control + control = sc; + } + + return control; + } + + /** + * Creates the dialog area content. + * + * @param parent The parent composite. Must not be <code>null</code>. + */ + protected void createDialogAreaContent(Composite parent) { + Assert.isNotNull(parent); + + setDialogTitle(Messages.SerialPortAddressDialog_dialogtitle); + setTitle(Messages.SerialPortAddressDialog_title); + + Composite ttyComp = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + ttyComp.setLayout(layout); + GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + layoutData.widthHint = 250; + ttyComp.setLayoutData(layoutData); + + Composite panel = new Composite(ttyComp, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginHeight = 0; layout.marginWidth = 0; + panel.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + panel.setLayoutData(layoutData); + + ttyControlSelector = new Button(panel, SWT.RADIO); + ttyControlSelector.setText(Messages.SerialLinePanel_hostTTYDevice_label); + layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false); + ttyControlSelector.setLayoutData(layoutData); + ttyControlSelector.setSelection(true); + ttyControlSelector.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean selected = ttyControlSelector.getSelection(); + setTTYControlEnabled(selected); + setTCPControlEnabled(!selected); + onModify(); + } + }); + + ttyControl = new Combo(panel, SWT.DROP_DOWN); + layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + ttyControl.setLayoutData(layoutData); + ttyControl.addModifyListener(new ModifyListener(){ + @Override + public void modifyText(ModifyEvent e) { + onModify(); + } + }); + + parent.getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + boolean enable = ttyHistory != null && ttyHistory.contains(data); + setTTYControlEnabled(enable); + setTCPControlEnabled(!enable); + onModify(); + } + }); + + Composite tcpComp = new Composite(parent, SWT.NONE); + layout = new GridLayout(2, true); + tcpComp.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + tcpComp.setLayoutData(layoutData); + + Composite tcpAddrComp = new Composite(tcpComp, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginWidth = 0; layout.marginHeight = 0; + tcpAddrComp.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + tcpAddrComp.setLayoutData(layoutData); + + tcpControlSelector = new Button(tcpAddrComp, SWT.RADIO); + tcpControlSelector.setText(Messages.SerialPortAddressDialog_address); + layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false); + tcpControlSelector.setLayoutData(layoutData); + tcpControlSelector.setSelection(false); + tcpControlSelector.addSelectionListener(new SelectionAdapter(){ + @Override + public void widgetSelected(SelectionEvent e) { + boolean selected = tcpControlSelector.getSelection(); + setTTYControlEnabled(!selected); + setTCPControlEnabled(selected); + onModify(); + } + }); + + addressControl = new Combo(tcpAddrComp, SWT.DROP_DOWN); + layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + addressControl.setLayoutData(layoutData); + addressControl.addModifyListener(new ModifyListener(){ + @Override + public void modifyText(ModifyEvent e) { + onModify(); + } + }); + + Composite tcpPortComp = new Composite(tcpComp, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginWidth = 0; layout.marginHeight = 0; + tcpPortComp.setLayout(layout); + layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false); + tcpPortComp.setLayoutData(layoutData); + + portLabel = new Label(tcpPortComp, SWT.HORIZONTAL); + portLabel.setText(Messages.SerialPortAddressDialog_port); + layoutData = new GridData(SWT.LEAD, SWT.CENTER, false, false); + portLabel.setLayoutData(layoutData); + + portControl = new Combo(tcpPortComp, SWT.DROP_DOWN); + layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + portControl.setLayoutData(layoutData); + portControl.addVerifyListener(new VerifyListener() { + @Override + public void verifyText(VerifyEvent e) { + StringBuilder buffer = new StringBuilder(((Combo)e.widget).getText()); + + try { + if (e.end > e.start) { + buffer.replace(e.start, e.end, e.text); + } else if (e.end >= 0) { + buffer.insert(e.end, e.text); + } + } catch (StringIndexOutOfBoundsException exc) { /* ignored on purpose */ } + + String fulltext = buffer.toString(); + e.doit = fulltext.matches("([0-9]{0,5})|(0((x|X)[0-9a-fA-F]{0,4})?)"); //$NON-NLS-1$ + + if (e.doit && fulltext.length() > 0 && !fulltext.equalsIgnoreCase("0x")) { //$NON-NLS-1$ + try { + int value = Integer.decode(fulltext).intValue(); + if (value < 0 || value > 65535) { + e.doit = false; + } + } + catch (Exception ex) { + e.doit = false; + } + } + } + }); + portControl.addModifyListener(new ModifyListener(){ + @Override + public void modifyText(ModifyEvent e) { + onModify(); + } + }); + + // Trigger the runnable after having created all controls! + parent.getDisplay().asyncExec(new Runnable() { + @Override + public void run() { + boolean enable = tcpHistory != null && tcpHistory.contains(data); + setTTYControlEnabled(!enable); + setTCPControlEnabled(enable); + onModify(); + } + }); + + applyDialogFont(ttyComp); + applyDialogFont(tcpComp); + + setupData(); + } + + private void setupData() { + setTTYControlEnabled(true); + setTCPControlEnabled(false); + if (ttyHistory != null && !ttyHistory.isEmpty()) { + for (String tty : ttyHistory) { + if (tty != null && tty.trim().length() > 0 && ttyControl.indexOf(tty) == -1) { + ttyControl.add(tty.trim()); + } + if (tty != null && tty.equals(data)) { + ttyControl.setText(tty.trim()); + } + } + } + if (tcpHistory != null && !tcpHistory.isEmpty()) { + for (String tcp : tcpHistory) { + String[] data = tcp.split(":"); //$NON-NLS-1$ + if (data.length > 1) { + if (data[1] != null && data[1].trim().length() > 0 && ttyControl.indexOf(data[1]) == -1) { + addressControl.add(data[1].trim()); + } + } + if (data.length > 2) { + if (data[2] != null && data[2].trim().length() > 0 && ttyControl.indexOf(data[2]) == -1) { + addressControl.add(data[2].trim()); + } + } + if (tcp.equals(this.data)) { + setTTYControlEnabled(false); + setTCPControlEnabled(true); + if (data.length > 1) { + addressControl.setText(data[1]); + } + if (data.length > 2) { + portControl.setText(data[2]); + } + } + } + } + onModify(); + } + + void setTTYControlEnabled(boolean enable) { + ttyControlSelector.setSelection(enable); + ttyControl.setEnabled(enable); + } + + void setTCPControlEnabled(boolean enable) { + tcpControlSelector.setSelection(enable); + addressControl.setEnabled(enable); + portControl.setEnabled(enable); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TrayDialog#createButtonBar(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createButtonBar(Composite parent) { + Control control = super.createButtonBar(parent); + setButtonEnabled(OK, false); + return control; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.dialogs.CustomTitleAreaDialog#okPressed() + */ + @Override + protected void okPressed() { + if (ttyControlSelector.getSelection()) { + data = ttyControl.getText(); + } + else { + data = "tcp:" + addressControl.getText() + ":" + portControl.getText(); //$NON-NLS-1$ //$NON-NLS-2$ + } + super.okPressed(); + } + + /** + * Called from the single controls if the content of the controls changed. + */ + protected void onModify() { + setMessage(null); + + boolean valid = false; + + if (ttyControlSelector.getSelection()) { + valid = isTtyControlValid(); + } else { + valid = isAddressControlValid(); + valid &= isPortControlValid(); + } + + if (getMessage() == null) { + setDefaultMessage(Messages.SerialPortAddressDialog_message, IMessageProvider.INFORMATION); + } + + setButtonEnabled(OK, valid); + } + + private static final Pattern validCharacters = Platform.OS_WIN32.equals(Platform.getOS()) ? Pattern.compile("[\\w]+") : Pattern.compile("[\\w/]+"); //$NON-NLS-1$ //$NON-NLS-2$ + + /** + * Validates the tty device control. + * + * @return <code>True</code> if the control is valid, <code>false</code> otherwise. + */ + protected boolean isTtyControlValid() { + if (ttyControl == null || ttyControl.isDisposed()) return false; + + boolean valid = true; + + String m = null; + int mt = IMessageProvider.NONE; + + String newText = ttyControl.getText(); + Assert.isNotNull(newText); + if (newText.trim().length() > 0) { + Matcher matcher = validCharacters.matcher(newText); + if (!matcher.matches()) { + m = Messages.SerialLinePanel_error_invalidCharactes; + mt = IMessageProvider.ERROR; + } + } + else { + m = Messages.SerialLinePanel_error_emptyHostTTYDevice; + mt = IMessageProvider.INFORMATION; + } + + valid = mt != IMessageProvider.ERROR; + if (mt > getMessageType()) setMessage(m, mt); + + return valid; + } + + /** + * Validates the address control. + * + * @return <code>True</code> if the control is valid, <code>false</code> otherwise. + */ + protected boolean isAddressControlValid() { + if (addressControl == null || addressControl.isDisposed()) return false; + + boolean valid = true; + + String m = null; + int mt = IMessageProvider.NONE; + + String ipOrHostName = addressControl.getText(); + + // info message when value is empty + if (ipOrHostName == null || ipOrHostName.trim().length() == 0) { + m = Messages.SerialPortAddressDialog_Information_MissingTargetNameAddress; + mt = IMessageProvider.INFORMATION; + } else { + ipOrHostName = ipOrHostName.trim(); + // check IP address when only numeric values and '.' are entered + if (ipOrHostName.matches(IP_CHARACTERS_REGEX)) { + if (!ipOrHostName.matches(IP_REGEX)) { + m = Messages.SerialPortAddressDialog_Error_InvalidTargetIpAddress; + mt = IMessageProvider.ERROR; + } + } + else if (ipOrHostName.matches(NAME_CHARACTERS_REGEX)) { + if (!ipOrHostName.matches(NAME_REGEX)) { + m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress; + mt = IMessageProvider.ERROR; + } + } + else { + m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress; + mt = IMessageProvider.ERROR; + } + } + + valid = mt != IMessageProvider.ERROR; + if (mt > getMessageType()) setMessage(m, mt); + + return valid; + } + + /** + * Validates the port control. + * + * @return <code>True</code> if the control is valid, <code>false</code> otherwise. + */ + protected boolean isPortControlValid() { + if (portControl == null || portControl.isDisposed()) return false; + + boolean valid = true; + + String m = null; + int mt = IMessageProvider.NONE; + + String newText = portControl.getText(); + Assert.isNotNull(newText); + if (newText.trim().length() > 0) { + if (!newText.matches("([0-9]{0,5})|(0((x|X)[0-9a-fA-F]{0,4})?)")) { //$NON-NLS-1$ + m = Messages.SerialPortAddressDialog_Error_InvalidPort; + mt = IMessageProvider.ERROR; + } else { + try { + int value = Integer.decode(newText).intValue(); + if (value < 0 || value > 65535) { + m = Messages.SerialPortAddressDialog_Error_InvalidPortRange; + mt = IMessageProvider.ERROR; + } + } + catch (Exception ex) { /* ignored on purpose */ } + } + } + else { + m = Messages.SerialPortAddressDialog_Information_MissingPort; + mt = IMessageProvider.INFORMATION; + } + + valid = mt != IMessageProvider.ERROR; + if (mt > getMessageType()) setMessage(m, mt); + + return valid; + } + + /** + * Return the new name after OK was pressed. + * Unless OK was pressed, the old name is returned. + */ + public String getData() { + return data; + } + + /** + * Cleanup when dialog is closed. + */ + protected void dispose() { + message = null; + messageType = IMessageProvider.NONE; + errorMessage = null; + title = null; + defaultMessage = null; + defaultMessageType = IMessageProvider.NONE; + } + + /** + * Cleanup the Dialog and close it. + */ + @Override + public boolean close() { + dispose(); + return super.close(); + } + + /** + * Set the enabled state of the dialog button specified by the given id (@see <code>IDialogConstants</code>) + * to the given state. + * + * @param buttonId The button id for the button to change the enabled state for. + * @param enabled The new enabled state to set for the button. + */ + public void setButtonEnabled(int buttonId, boolean enabled) { + Button button = getButton(buttonId); + if (button != null) { + button.setEnabled(enabled); + } + } + + /** + * Sets the title for this dialog. + * + * @param title The title. + */ + public void setDialogTitle(String title) { + if (getShell() != null && !getShell().isDisposed()) { + getShell().setText(title); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TitleAreaDialog#setTitle(java.lang.String) + */ + @Override + public void setTitle(String newTitle) { + title = newTitle; + super.setTitle(newTitle); + } + + /** + * Set the default message. The default message is shown within the + * dialogs message area if no other message is set. + * + * @param message The default message or <code>null</code>. + * @param type The default message type. See {@link IMessageProvider}. + */ + public void setDefaultMessage(String message, int type) { + defaultMessage = message; + defaultMessageType = type; + // Push the default message to the dialog if no other message is set + if (!isMessageSet() && getContents() != null) { + super.setMessage(defaultMessage, defaultMessageType); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TitleAreaDialog#setMessage(java.lang.String, int) + */ + @Override + public void setMessage(String newMessage, int newType) { + // To be able to implement IMessageProvider, we have to remember the + // set message ourselfs. There is no access to these information by the + // base class. + message = newMessage; messageType = newType; + // Only pass on to super implementation if the control has been created yet + if (getContents() != null) { + super.setMessage(message != null ? message : defaultMessage, message != null ? messageType : defaultMessageType); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.TitleAreaDialog#setErrorMessage(java.lang.String) + */ + @Override + public void setErrorMessage(String newErrorMessage) { + // See setMessage(...) + errorMessage = newErrorMessage; + super.setErrorMessage(newErrorMessage); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage() + */ + @Override + public String getMessage() { + return errorMessage != null ? errorMessage : message; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType() + */ + @Override + public int getMessageType() { + return errorMessage != null ? IMessageProvider.ERROR : messageType; + } + + /** + * Returns if or if not an message is set to the dialog. + * + * @return <code>True</code> if a message has been set, <code>false</code> otherwise. + */ + public boolean isMessageSet() { + return errorMessage != null || message != null; + } +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java new file mode 100644 index 000000000..9f0df469e --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/ITraceIds.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.interfaces; + +/** + * Trace slot identifiers. + */ +public interface ITraceIds { + + /** + * If activated, trace information about serial device discovery is printed out. + */ + public static final String TRACE_SERIAL_LINE_PANEL = "trace/serialLinePanel"; //$NON-NLS-1$ + +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java new file mode 100644 index 000000000..a8da2a84f --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/interfaces/IWireTypeSerial.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.interfaces; + +/** + * The properties specific to the wire type "serial". + */ +public interface IWireTypeSerial { + + /** + * The data container. + */ + public static String PROPERTY_CONTAINER_NAME = "serial"; //$NON-NLS-1$ + + /** + * The serial device name. + */ + public static final String PROPERTY_SERIAL_DEVICE = "device"; //$NON-NLS-1$ + + /** + * The baud rate. + */ + public static final String PROPERTY_SERIAL_BAUD_RATE = "baudrate"; //$NON-NLS-1$ + + /** + * The data bits + */ + public static final String PROPERTY_SERIAL_DATA_BITS = "databits"; //$NON-NLS-1$ + + /** + * The parity + */ + public static final String PROPERTY_SERIAL_PARITY = "parity"; //$NON-NLS-1$ + + /** + * The stop bits + */ + public static final String PROPERTY_SERIAL_STOP_BITS = "stopbits"; //$NON-NLS-1$ + + /** + * The flow control + */ + public static final String PROPERTY_SERIAL_FLOW_CONTROL = "flowcontrol"; //$NON-NLS-1$ +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java new file mode 100644 index 000000000..6a8dd00a4 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialLauncherDelegate.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.launcher; + +import java.text.DateFormat; +import java.util.Date; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.osgi.util.NLS; +import org.eclipse.tcf.te.core.terminals.TerminalServiceFactory; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService; +import org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; +import org.eclipse.tcf.te.ui.terminals.launcher.AbstractLauncherDelegate; +import org.eclipse.tcf.te.ui.terminals.serial.controls.SerialConfigurationPanel; +import org.eclipse.tcf.te.ui.terminals.serial.nls.Messages; +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; +import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; +import org.eclipse.tm.internal.terminal.serial.SerialSettings; + +/** + * Serial launcher delegate implementation. + */ +@SuppressWarnings("restriction") +public class SerialLauncherDelegate extends AbstractLauncherDelegate { + // The serial terminal connection memento handler + private final IMementoHandler mementoHandler = new SerialMementoHandler(); + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#needsUserConfiguration() + */ + @Override + public boolean needsUserConfiguration() { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#getPanel(org.eclipse.tcf.te.ui.terminals.interfaces.IConfigurationPanelContainer) + */ + @Override + public IConfigurationPanel getPanel(IConfigurationPanelContainer container) { + return new SerialConfigurationPanel(container); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#execute(java.util.Map, org.eclipse.tcf.te.core.terminals.interfaces.ITerminalService.Done) + */ + @Override + public void execute(Map<String, Object> properties, Done done) { + Assert.isNotNull(properties); + + // Set the terminal tab title + String terminalTitle = getTerminalTitle(properties); + if (terminalTitle != null) { + properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle); + } + + // Serial terminals do have a disconnect button + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) { + properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE); + } + + // Get the terminal service + ITerminalService terminal = TerminalServiceFactory.getService(); + // If not available, we cannot fulfill this request + if (terminal != null) { + terminal.openConsole(properties, done); + } + } + + /** + * Returns the terminal title string. + * <p> + * The default implementation constructs a title like "Serial <port> (Start time) ". + * + * @return The terminal title string or <code>null</code>. + */ + private String getTerminalTitle(Map<String, Object> properties) { + String device = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE); + + if (device != null) { + DateFormat format = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + String date = format.format(new Date(System.currentTimeMillis())); + return NLS.bind(Messages.SerialLauncherDelegate_terminalTitle, new String[]{device, date}); + } + return Messages.SerialLauncherDelegate_terminalTitle_default; + } + + /* (non-Javadoc) + * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) + */ + @Override + public Object getAdapter(Class adapter) { + if (IMementoHandler.class.equals(adapter)) { + return mementoHandler; + } + return super.getAdapter(adapter); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.ILauncherDelegate#createTerminalConnector(java.util.Map) + */ + @Override + public ITerminalConnector createTerminalConnector(Map<String, Object> properties) { + Assert.isNotNull(properties); + + // Check for the terminal connector id + String connectorId = (String)properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID); + if (connectorId == null) connectorId = "org.eclipse.tm.internal.terminal.serial.SerialConnector"; //$NON-NLS-1$ + + String port = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE); + String baud = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE); + Object value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + String timeout = value instanceof Integer ? ((Integer)value).toString() : null; + String databits = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS); + String stopbits = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS); + String parity = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY); + String flowcontrol = (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL); + + // Construct the terminal settings store + ISettingsStore store = new SettingsStore(); + + // Construct the serial settings + SerialSettings serialSettings = new SerialSettings(); + serialSettings.setSerialPort(port); + serialSettings.setBaudRate(baud); + serialSettings.setTimeout(timeout); + serialSettings.setDataBits(databits); + serialSettings.setStopBits(stopbits); + serialSettings.setParity(parity); + serialSettings.setFlowControl(flowcontrol); + + // And save the settings to the store + serialSettings.save(store); + + // Construct the terminal connector instance + ITerminalConnector connector = TerminalConnectorExtension.makeTerminalConnector(connectorId); + if (connector != null) { + // Apply default settings + connector.makeSettingsPage(); + // And load the real settings + connector.load(store); + } + + return connector; + } +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java new file mode 100644 index 000000000..47615d288 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/launcher/SerialMementoHandler.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.launcher; + +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants; +import org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler; +import org.eclipse.ui.IMemento; + +/** + * Serial terminal connection memento handler implementation. + */ +public class SerialMementoHandler implements IMementoHandler { + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#saveState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void saveState(IMemento memento, Map<String, Object> properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Do not write the terminal title to the memento -> needs to + // be recreated at the time of restoration. + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_PARITY)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS)); + memento.putString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, (String)properties.get(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL)); + Object value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT); + memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT, value instanceof Integer ? ((Integer)value).intValue() : -1); + memento.putString(ITerminalsConnectorConstants.PROP_ENCODING, (String)properties.get(ITerminalsConnectorConstants.PROP_ENCODING)); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.te.ui.terminals.interfaces.IMementoHandler#restoreState(org.eclipse.ui.IMemento, java.util.Map) + */ + @Override + public void restoreState(IMemento memento, Map<String, Object> properties) { + Assert.isNotNull(memento); + Assert.isNotNull(properties); + + // Restore the terminal properties from the memento + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DEVICE)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_BAUD_RATE)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_DATA_BITS)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_PARITY, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_PARITY)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_STOP_BITS)); + properties.put(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL, memento.getString(ITerminalsConnectorConstants.PROP_SERIAL_FLOW_CONTROL)); + Integer timeout = memento.getInteger(ITerminalsConnectorConstants.PROP_TIMEOUT); + if (timeout != null && timeout.intValue() != -1) properties.put(ITerminalsConnectorConstants.PROP_TIMEOUT, timeout); + properties.put(ITerminalsConnectorConstants.PROP_ENCODING, memento.getString(ITerminalsConnectorConstants.PROP_ENCODING)); + } +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java new file mode 100644 index 000000000..530171509 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tcf.te.ui.terminals.serial.nls; + +import org.eclipse.osgi.util.NLS; + +/** + * Externalized strings management. + */ +public class Messages extends NLS { + + // The plug-in resource bundle name + private static final String BUNDLE_NAME = "org.eclipse.tcf.te.ui.terminals.serial.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 SerialLauncherDelegate_terminalTitle; + public static String SerialLauncherDelegate_terminalTitle_default; + + public static String SerialLinePanel_hostTTYDevice_label; + public static String SerialLinePanel_hostTTYSpeed_label; + public static String SerialLinePanel_hostTTYDatabits_label; + public static String SerialLinePanel_hostTTYParity_label; + public static String SerialLinePanel_hostTTYStopbits_label; + public static String SerialLinePanel_hostTTYFlowControl_label; + public static String SerialLinePanel_hostTTYTimeout_label; + public static String SerialLinePanel_customSerialBaudRate_title; + public static String SerialLinePanel_customSerialBaudRate_message; + public static String SerialLinePanel_error_invalidCharactes; + public static String SerialLinePanel_error_invalidCharactesBaudRate; + public static String SerialLinePanel_error_emptyHostTTYDevice; + public static String SerialLinePanel_error_emptyHostTTYSpeedRate; + public static String SerialLinePanel_error_emptyHostTTYDatabits; + public static String SerialLinePanel_error_emptyHostTTYParity; + public static String SerialLinePanel_error_emptyHostTTYStopbits; + public static String SerialLinePanel_error_emptyHostTTYFlowControl; + public static String SerialLinePanel_error_emptyHostTTYTimeout; + public static String SerialLinePanel_info_editableTTYDeviceSelected; + public static String SerialLinePanel_info_editableTTYBaudRateSelected; + public static String SerialLinePanel_warning_FailedToLoadSerialPorts; + + public static String SerialPortAddressDialog_dialogtitle; + public static String SerialPortAddressDialog_title; + public static String SerialPortAddressDialog_message; + public static String SerialPortAddressDialog_address; + public static String SerialPortAddressDialog_port; + public static String SerialPortAddressDialog_Information_MissingTargetNameAddress; + public static String SerialPortAddressDialog_Error_InvalidTargetNameAddress; + public static String SerialPortAddressDialog_Error_InvalidTargetIpAddress; + public static String SerialPortAddressDialog_Information_MissingPort; + public static String SerialPortAddressDialog_Error_InvalidPort; + public static String SerialPortAddressDialog_Error_InvalidPortRange; +} diff --git a/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties new file mode 100644 index 000000000..2b89c1009 --- /dev/null +++ b/terminals/plugins/org.eclipse.tcf.te.ui.terminals.serial/src/org/eclipse/tcf/te/ui/terminals/serial/nls/Messages.properties @@ -0,0 +1,46 @@ +############################################################################### +# Copyright (c) 2012, 2015 Wind River Systems, Inc. and others. All rights reserved. +# This program and the accompanying materials are made available under the terms +# of the Eclipse Public License v1.0 which accompanies this distribution, and is +# available at http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Wind River Systems - initial API and implementation +############################################################################### + +SerialLauncherDelegate_terminalTitle=Serial {0} ({1}) +SerialLauncherDelegate_terminalTitle_default=Serial Terminal + +SerialLinePanel_hostTTYDevice_label=Port: +SerialLinePanel_hostTTYSpeed_label=Baud Rate: +SerialLinePanel_hostTTYDatabits_label=Data Bits: +SerialLinePanel_hostTTYParity_label=Parity: +SerialLinePanel_hostTTYStopbits_label=Stop Bits: +SerialLinePanel_hostTTYFlowControl_label=Flow Control: +SerialLinePanel_hostTTYTimeout_label=Timeout (sec): +SerialLinePanel_customSerialBaudRate_title=Configure Custom Serial Baud Rate +SerialLinePanel_customSerialBaudRate_message=Please enter the custom serial baud rate: +SerialLinePanel_error_invalidCharactes=The device name you've entered contains invalid characters. +SerialLinePanel_error_invalidCharactesBaudRate=The baud rate you've entered contains invalid characters. +SerialLinePanel_error_emptyHostTTYDevice=Please select a valid host serial device. +SerialLinePanel_error_emptyHostTTYSpeedRate=Please select a valid serial device speed. +SerialLinePanel_error_emptyHostTTYDatabits=Please select a valid number of data bits. +SerialLinePanel_error_emptyHostTTYParity=Please select a valid parity. +SerialLinePanel_error_emptyHostTTYStopbits=Please select a valid number of stop bits. +SerialLinePanel_error_emptyHostTTYFlowControl=Please select a valid flow control. +SerialLinePanel_error_emptyHostTTYTimeout=Please select a valid timeout. +SerialLinePanel_info_editableTTYDeviceSelected=Please re-select ''Other...'' again to activate the custom serial device input dialog. +SerialLinePanel_info_editableTTYBaudRateSelected=Please re-select ''Other...'' again to activate the custom serial baud rate input dialog. +SerialLinePanel_warning_FailedToLoadSerialPorts=Failed to enumerate the systems serial ports. + +SerialPortAddressDialog_dialogtitle=Other... +SerialPortAddressDialog_title=Configure Custom Serial Device +SerialPortAddressDialog_message=Select the type of the custom serial device and configure the device properties. +SerialPortAddressDialog_address=Address: +SerialPortAddressDialog_port=Port: +SerialPortAddressDialog_Information_MissingTargetNameAddress=Please enter a valid target name or IP address. +SerialPortAddressDialog_Error_InvalidTargetNameAddress=Target name or IP address is not valid. +SerialPortAddressDialog_Error_InvalidTargetIpAddress=Target IP address is not valid. +SerialPortAddressDialog_Information_MissingPort=Please enter a valid port number. +SerialPortAddressDialog_Error_InvalidPort=Target port number must be a valid number in the range of 0 to 65535. +SerialPortAddressDialog_Error_InvalidPortRange=Target port number must be in the range of 0 to 65535. |