Author: adietish
Date: 2010-10-10 18:30:15 -0400 (Sun, 10 Oct 2010)
New Revision: 25677
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.ui.prefs
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/CompositeValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/JFaceUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudType.java
Log:
[JBIDE-7282] [JBIDE-7283] [JBIDE-7284] implementing complete validation/enablement
handling
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs 2010-10-10
22:27:57 UTC (rev 25676)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs 2010-10-10
22:30:15 UTC (rev 25677)
@@ -1,4 +1,4 @@
-#Tue Jul 20 18:00:15 EDT 2010
+#Fri Oct 08 12:10:35 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
@@ -6,3 +6,271 @@
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
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=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=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=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+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.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.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_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=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_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=do not
insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do
not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not
insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not
insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=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_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=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_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do
not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+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=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.ui.prefs
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.ui.prefs
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.ui.prefs 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,4 @@
+#Fri Oct 08 12:10:35 CEST 2010
+eclipse.preferences.version=1
+formatter_profile=_Eclipse [built-in] extended
+formatter_settings_version=11
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.ui.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-10-10
22:27:57 UTC (rev 25676)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-10-10
22:30:15 UTC (rev 25677)
@@ -12,6 +12,11 @@
org.eclipse.ui.views;bundle-version="3.4.1",
org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.0",
org.jboss.tools.deltacloud.core;bundle-version="0.0.1",
- org.eclipse.rse.core;bundle-version="3.1.1"
+ org.eclipse.rse.core;bundle-version="3.1.1",
+ org.eclipse.jface.databinding;bundle-version="1.4.0",
+ org.eclipse.core.databinding;bundle-version="1.3.100",
+ org.eclipse.core.databinding.observable;bundle-version="1.3.0",
+ org.eclipse.core.databinding.property;bundle-version="1.3.0",
+ org.eclipse.core.databinding.beans;bundle-version="1.2.100"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.deltacloud.ui.common.databinding;
+
+
+import java.util.Collection;
+
+import org.eclipse.core.databinding.Binding;
+
+public class DataBindingUtils
+{
+ private DataBindingUtils()
+ {
+ }
+
+ /**
+ * Disposes all bindings in a given collection an clears the collection.
+ *
+ * @param bindingCollection the binding collection
+ *
+ * @return the collection<binding>
+ */
+ public static Collection<Binding> disposeBindings( Collection<Binding>
bindingCollection )
+ {
+ if ( bindingCollection != null )
+ {
+ for ( Binding binding : bindingCollection )
+ {
+ binding.dispose();
+ }
+ bindingCollection.clear();
+ }
+ return bindingCollection;
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/DataBindingUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,40 @@
+package org.jboss.tools.deltacloud.ui.common.databinding;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.ValidationStatusProvider;
+import org.eclipse.core.databinding.observable.value.ComputedValue;
+import org.eclipse.core.runtime.IStatus;
+
+public class MaxSeverityValidationStatusProvider extends ComputedValue {
+
+ private Collection validationStatusProviders;
+
+ public MaxSeverityValidationStatusProvider(DataBindingContext dbc) {
+ super(ValidationStatusProvider.class);
+ this.validationStatusProviders = dbc.getValidationStatusProviders();
+ }
+
+ protected Object calculate() {
+ int maxSeverity = IStatus.OK;
+ ValidationStatusProvider maxSeverityProvider = null;
+ for (Iterator it = validationStatusProviders.iterator(); it.hasNext();) {
+ ValidationStatusProvider provider = (ValidationStatusProvider) it
+ .next();
+ IStatus status = (IStatus) provider.getValidationStatus()
+ .getValue();
+ if (status.getSeverity() > maxSeverity) {
+ maxSeverity = status.getSeverity();
+ maxSeverityProvider = provider;
+ }
+ }
+ return maxSeverityProvider;
+ }
+
+ public synchronized void dispose() {
+ validationStatusProviders = null;
+ super.dispose();
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/MaxSeverityValidationStatusProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.common.databinding;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+
+/**
+ * A POJO base class that may notify observers on behalf of
+ * {@link PropertyChangeSupport}
+ */
+public abstract class ObservablePojo {
+
+ private PropertyChangeSupport propertyChangeSupport;
+
+ public ObservablePojo() {
+ this.propertyChangeSupport = new PropertyChangeSupport(this);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener
listener) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener
listener) {
+ propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+ protected PropertyChangeSupport getPropertyChangeSupport() {
+ return propertyChangeSupport;
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/ObservablePojo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/CompositeValidator.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/CompositeValidator.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/CompositeValidator.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.common.databinding.validator;
+
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+public class CompositeValidator implements IValidator {
+
+ private final LogicOp operator;
+
+ private final IValidator[] validatorCollection;
+
+ public static enum LogicOp {
+ AND,
+ OR
+ };
+
+ public CompositeValidator(final IValidator... validators) {
+ this(LogicOp.AND, validators);
+ }
+
+ public CompositeValidator(final LogicOp operator, final IValidator... validators) {
+ Assert.isLegal(operator != null);
+ Assert.isLegal(validators != null);
+
+ this.operator = operator;
+ validatorCollection = validators;
+ }
+
+ public IStatus validate(final Object value) {
+ return LogicOp.AND.equals(operator) ? andValidate(value) : orValidate(value);
+ }
+
+ /**
+ * validates on behalf of all validators. The validation stops, as soon as
+ * there's one validator that does <tt>NOT</tt> return Status#OK_Status
+ *
+ * @param value
+ * the value
+ *
+ * @return the status of this validation process
+ */
+ private IStatus andValidate(final Object value) {
+ IStatus result = Status.OK_STATUS;
+ ;
+ for (int i = 0; i < validatorCollection.length && result.isOK(); i++) {
+ result = validatorCollection[i].validate(value);
+ }
+ return result;
+ }
+
+ /**
+ * validates on behalf of all validators. The validation stops, as soons as
+ * there's one validator that does return Status#OK_Status
+ *
+ * @param value
+ * the value
+ *
+ * @return the status of this validation process
+ */
+ private IStatus orValidate(final Object value) {
+ IStatus result = Status.OK_STATUS;
+ ;
+ for (int i = 0; i < validatorCollection.length && result.isOK(); i++) {
+ result = validatorCollection[i].validate(value);
+ }
+ return result;
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/CompositeValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.common.databinding.validator;
+
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * A {@link IValidator} that validates ok if the string it shall validate is not empty.
+ */
+public class MandatoryStringValidator implements IValidator {
+
+ private String errorMessage;
+
+ public MandatoryStringValidator(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ *
+ * validates the given string. Validation passes only if the given value is
+ * not <tt>null</tt> and it's length's larger than 0
+ *
+ */
+ public IStatus validate(Object value) {
+ if (!((value instanceof String) && ((String) value).length() > 0)) {
+ return ValidationStatus.error(errorMessage);
+ }
+ return ValidationStatus.ok();
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/databinding/validator/MandatoryStringValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/JFaceUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/JFaceUtils.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/JFaceUtils.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.common.swt;
+
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+
+public class JFaceUtils {
+
+ public static ControlDecoration createDecoration(Control control, String message) {
+ ControlDecoration controlDecoration = new ControlDecoration(control, SWT.LEFT |
SWT.TOP);
+ controlDecoration.setDescriptionText(message);
+ FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
+ .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
+ controlDecoration.setImage(fieldDecoration.getImage());
+ return controlDecoration;
+ }
+
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/common/swt/JFaceUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.internal.deltacloud.ui.wizards;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.databinding.conversion.IConverter;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.deltacloud.ui.common.databinding.ObservablePojo;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class CloudConnectionModel extends ObservablePojo {
+
+ public static final String PROPERTY_URL = "url";
+ public static final String PROPERTY_NAME = "name";
+ public static final String PROPERTY_PASSWORD = "password";
+ public static final String PROPERTY_USERNAME = "username";
+ public static final String PROPERTY_CLOUDTYPE = "cloudType";
+
+ public static final String UNKNOWN_TYPE_LABEL = "UnknownType.label";
//$NON-NLS-1$
+ public static final String INVALID_URL = "ErrorInvalidURL.text";
//$NON-NLS-1$
+ public static final String NONCLOUD_URL = "ErrorNonCloudURL.text";
//$NON-NLS-1$
+
+ private String name;
+ private String url;
+ private String username;
+
+ private String password;
+ private String cloudType;
+
+ public static class CloudTypeConverter implements IConverter {
+
+ private static final String HTTPHEADER_KEY_ACCEPT = "Accept"; //$NON-NLS-1$
+ private static final String HTTPHEADER_VALUE_ACCEPTXML =
"application/xml;q=1.0"; //$NON-NLS-1$
+ private static final String DOCUMENT_ELEMENT_DRIVER = "driver";
//$NON-NLS-1$
+ private static final String DOCUMENT_ELEMENT_API = "api"; //$NON-NLS-1$
+ private static final String URLCONNECTION_ENCODING = "UTF-8"; //$NON-NLS-1$
+
+ @Override
+ public Object getFromType() {
+ return String.class;
+ }
+
+ @Override
+ public Object getToType() {
+ return String.class;
+ }
+
+ @Override
+ public Object convert(final Object fromObject) {
+ return getCloudType((String) fromObject);
+ }
+
+ private String getCloudType(String url) {
+ String cloudType = UNKNOWN_TYPE_LABEL;
+ try {
+ Object o = getURLContent(url + "/api?format=xml"); //$NON-NLS-1$
+ if (o instanceof InputStream) {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document document = db.parse(
+ new InputSource(new StringReader(getXML((InputStream) o))));
+
+ NodeList elements = document.getElementsByTagName(DOCUMENT_ELEMENT_API);
//$NON-NLS-1$
+ if (elements.getLength() > 0) {
+ Node n = elements.item(0);
+ Node driver = n.getAttributes().getNamedItem(
+ DOCUMENT_ELEMENT_DRIVER); //$NON-NLS-1$
+ if (driver != null) {
+ String driverValue = driver.getNodeValue();
+ cloudType = driverValue.toUpperCase();
+ }
+ }
+ }
+ } catch (MalformedURLException e) {
+ cloudType = WizardMessages.getString(INVALID_URL);
+ } catch (IOException e) {
+ cloudType = WizardMessages.getString(NONCLOUD_URL);
+ } catch (ParserConfigurationException e) {
+ cloudType = WizardMessages.getString(NONCLOUD_URL);
+ } catch (SAXException e) {
+ cloudType = WizardMessages.getString(NONCLOUD_URL);
+ } catch (Exception e) {
+ cloudType = WizardMessages.getString(INVALID_URL);
+ }
+ return cloudType;
+ }
+
+ private String getXML(InputStream is) throws UnsupportedEncodingException, IOException
{
+ try {
+ if (is == null) {
+ return "";
+ }
+ StringBuilder sb = new StringBuilder();
+ String line = "";
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is,
URLCONNECTION_ENCODING));
+ while ((line = reader.readLine()) != null) {
+ sb.append(line).append("\n"); //$NON-NLS-1$
+ }
+ return sb.toString();
+ } finally {
+ is.close();
+ }
+ }
+
+ private Object getURLContent(String url) throws IOException {
+ URL u = new URL(url);
+ URLConnection connection = u.openConnection();
+ connection.setRequestProperty(HTTPHEADER_KEY_ACCEPT, HTTPHEADER_VALUE_ACCEPTXML);
//$NON-NLS-1$ $NON-NLS-2$
+ return connection.getContent();
+ }
+
+ }
+
+ public static class CloudTypeValidator implements IValidator {
+
+ @Override
+ public IStatus validate(Object value) {
+ Assert.isTrue(value instanceof String);
+ if (value != null
+ && !WizardMessages.getString(UNKNOWN_TYPE_LABEL).equals(value)
+ && !WizardMessages.getString(INVALID_URL).equals(value)
+ && !WizardMessages.getString(NONCLOUD_URL).equals(value)) {
+ return ValidationStatus.ok();
+ } else {
+ return ValidationStatus.error((String) value);
+ }
+ }
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_USERNAME, this.username,
this.username = username);
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_PASSWORD, this.password,
this.password = password);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_NAME, this.name, this.name =
name);
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_URL, this.url, this.url = url);
+ }
+
+ public String getCloudType() {
+ return cloudType;
+ }
+
+ public void setCloudType(String cloudType) {
+ getPropertyChangeSupport().firePropertyChange(PROPERTY_CLOUDTYPE, this.cloudType,
this.cloudType = cloudType);
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-10-10
22:27:57 UTC (rev 25676)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudConnectionPage.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -12,11 +12,19 @@
import java.net.URL;
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.databinding.wizard.WizardPageSupport;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
-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.SelectionListener;
@@ -26,16 +34,15 @@
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import
org.jboss.tools.deltacloud.ui.common.databinding.validator.MandatoryStringValidator;
public class CloudConnectionPage extends WizardPage {
@@ -53,42 +60,30 @@
private static final String TEST_SUCCESSFUL =
"NewCloudConnectionTest.success"; //$NON-NLS-1$
private static final String TEST_FAILURE = "NewCloudConnectionTest.failure";
//$NON-NLS-1$
-
+
private CloudConnection wizard;
-
- private Button testButton;
-
+
+ // private Button testButton;
+
private Text nameText;
private Text urlText;
- private Label typeText;
+ private Label typeLabel;
private Text usernameText;
private Text passwordText;
-
+
private String name;
private String url;
private String username;
private String password;
private String cloudTypeLabel;
-
+
private String defaultName = "";
private String defaultURL = "";
private String defaultUsername = "";
private String defaultPassword = "";
- private boolean urlValid;
-
- private class CheckURLThread extends Thread {
-
- @Override
- public void run() {
- try {
- checkURL();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
+ private CloudConnectionModel connectionModel;
+
private Listener linkListener = new Listener() {
public void handleEvent(Event event) {
@@ -99,39 +94,40 @@
Activator.log(e);
}
}
-
+
};
private SelectionListener buttonListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- boolean successful = false;
- if (getURLValid()) {
- successful = wizard.performTest();
- }
- if (successful) {
- setMessage(WizardMessages.getString(TEST_SUCCESSFUL));
- } else {
- setErrorMessage(WizardMessages.getString(TEST_FAILURE));
- }
+ // boolean successful = false;
+ // if (getURLValid()) {
+ // successful = wizard.performTest();
+ // }
+ // if (successful) {
+ // setMessage(WizardMessages.getString(TEST_SUCCESSFUL));
+ // } else {
+ // setErrorMessage(WizardMessages.getString(TEST_FAILURE));
+ // }
}
-
+
};
-
+
public CloudConnectionPage(String pageName, CloudConnection wizard) {
super(pageName);
- this.wizard= wizard;
+ this.wizard = wizard;
setDescription(WizardMessages.getString(DESCRIPTION));
setTitle(WizardMessages.getString(TITLE));
setImageDescriptor(SWTImagesFactory.DESC_DELTA_LARGE);
- setPageComplete(false);
+ // setPageComplete(false);
+ this.connectionModel = new CloudConnectionModel();
}
-
- public CloudConnectionPage(String pageName, String defaultName, String defaultURL,
- String defaultUsername, String defaultPassword, String defaultCloudType,
+
+ public CloudConnectionPage(String pageName, String defaultName, String defaultURL,
+ String defaultUsername, String defaultPassword, String defaultCloudType,
CloudConnection wizard) {
super(pageName);
- this.wizard= wizard;
+ this.wizard = wizard;
this.defaultName = defaultName;
this.defaultURL = defaultURL;
this.defaultUsername = defaultUsername;
@@ -143,193 +139,117 @@
setPageComplete(false);
}
- private ModifyListener textListener = new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- validate();
- }
- };
-
public String getName() {
- return name;
+ return connectionModel.getName();
}
-
+
public String getURL() {
- return url;
+ return connectionModel.getUrl();
}
-
+
public String getUsername() {
- return username;
+ return connectionModel.getUsername();
}
-
+
public String getPassword() {
- return password;
+ return connectionModel.getPassword();
}
-
+
public String getType() {
- return typeText.getText();
+ return connectionModel.getCloudType();
}
-
- private void validate() {
- boolean complete = true;
- boolean errorFree = true;
-
- setMessage(null);
-
- name = nameText.getText();
- if (name.length() > 0) {
- if (!name.equals(defaultName)) {
- if (DeltaCloudManager.getDefault().findCloud(name) != null) {
- errorFree = false;
- setErrorMessage(WizardMessages.getString(NAME_ALREADY_IN_USE));
- }
- }
- } else {
- complete = false;
- }
-
- // Run check for valid DeltaCloud URL in separate thread
- String urlValue = urlText.getText();
- if (urlValue.length() > 5) {
- CheckURLThread t = new CheckURLThread();
- t.start();
- } else if (urlValue.length() > 0){
- typeText.setText(WizardMessages.getString(CloudType.NONCLOUD_URL));
- complete = false;
- } else {
- typeText.setText(WizardMessages.getString(CloudType.UNKNOWN_TYPE_LABEL));
- complete = false;
- }
-
- username = usernameText.getText();
- if (username.length() <= 0) {
- complete = false;
- }
- password = passwordText.getText();
- if (password.length() <= 0) {
- complete = false;
- }
- if (errorFree)
- setErrorMessage(null);
- setPageComplete(complete & errorFree);
- }
-
- @Override
- public boolean isPageComplete() {
- return super.isPageComplete() & getURLValid();
- }
-
-
- // Method to check the URL for validity as Delta-cloud API specifier.
- // Since this is run in thread, it does not use the setErrorMessage()
- // method and instead writes error messages to the typeText label.
- private void checkURL() {
- String oldurl = url;
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- cloudTypeLabel = typeText.getText();
- url = urlText.getText();
- }
- });
- String oldCloudType = cloudTypeLabel;
- if (url.length() > 0) {
- if (!url.equals(oldurl)) {
- CloudType cloudType = new CloudType(url);
- cloudTypeLabel = cloudType.getLabel();
- setURLValid(cloudType.isValid());
- }
- if (!oldCloudType.equals(cloudTypeLabel)) {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- testButton.setEnabled(getURLValid());
- typeText.setText(cloudTypeLabel);
- }
-
- });
- }
- }
- }
-
- /**
- * Set whether the URL is a valid Delta-cloud API URL.
- *
- * @param value boolean to set
- */
- private synchronized void setURLValid(boolean value) {
- urlValid = value;
- }
-
- /**
- * Return the validity of the Delta-cloud URL.
- *
- * @return true if URL valid, false otherwise
- */
- private synchronized boolean getURLValid() {
- return urlValid;
- }
-
@Override
public void createControl(Composite parent) {
+ DataBindingContext dbc = new DataBindingContext();
+ WizardPageSupport.create(this, dbc);
+
final Composite container = new Composite(parent, SWT.NULL);
FormLayout layout = new FormLayout();
layout.marginHeight = 5;
layout.marginWidth = 5;
container.setLayout(layout);
-
+
Label dummyLabel = new Label(container, SWT.NULL);
- //
errorLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
-
+
Label nameLabel = new Label(container, SWT.NULL);
nameLabel.setText(WizardMessages.getString(NAME_LABEL));
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
nameText.setText(defaultName);
- nameText.addModifyListener(textListener);
-
+ Binding nameTextBinding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observe(nameText),
+ BeanProperties.value(CloudConnectionModel.class, CloudConnectionModel.PROPERTY_NAME)
+ .observe(connectionModel),
+ new UpdateValueStrategy().setBeforeSetValidator(new
MandatoryStringValidator("name must be defined")),
+ null);
+ ControlDecorationSupport.create(nameTextBinding, SWT.LEFT|SWT.TOP);
+
Label urlLabel = new Label(container, SWT.NULL);
urlLabel.setText(WizardMessages.getString(URL_LABEL));
Point p1 = urlLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
+
urlText = new Text(container, SWT.BORDER | SWT.SINGLE);
- urlText.setText(defaultURL);
- if (!defaultURL.equals(""))
- setURLValid(true);
- urlText.addModifyListener(textListener);
- Point p2 = urlText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Binding urlTextBinding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observeDelayed(500, urlText),
+ BeanProperties.value(CloudConnectionModel.class, CloudConnectionModel.PROPERTY_URL)
+ .observe(connectionModel));
+
+ final Label typeLabel = new Label(container, SWT.NULL);
+ UpdateValueStrategy url2TypeStrategy = new UpdateValueStrategy();
+ url2TypeStrategy.setConverter(new CloudConnectionModel.CloudTypeConverter());
+ url2TypeStrategy.setBeforeSetValidator(new CloudConnectionModel.CloudTypeValidator());
+ Binding urlBinding = dbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observeDelayed(100, urlText),
+ BeanProperties.value(CloudConnectionModel.PROPERTY_CLOUDTYPE).observe(connectionModel),
+ url2TypeStrategy,
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
+ urlBinding.getValidationStatus().addValueChangeListener(new IValueChangeListener() {
- int centering = (p2.y - p1.y + 1) / 2;
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ IStatus status = (IStatus) event.diff.getNewValue();
+ if (status.isOK()) {
+ typeLabel.setText(connectionModel.getCloudType());
+ } else {
+ typeLabel.setText("");
+ }
+ }
+ });
+ ControlDecorationSupport.create(urlBinding, SWT.LEFT|SWT.TOP);
- Label typeLabel = new Label(container, SWT.NULL);
- typeLabel.setText(WizardMessages.getString(TYPE_LABEL));
-
- typeText = new Label(container, SWT.NULL);
- if (cloudTypeLabel == null)
- cloudTypeLabel = WizardMessages.getString(CloudType.UNKNOWN_TYPE_LABEL);
- typeText.setText(cloudTypeLabel);
-
Label usernameLabel = new Label(container, SWT.NULL);
usernameLabel.setText(WizardMessages.getString(USERNAME_LABEL));
+ DataBindingContext credentialsDbc = new DataBindingContext();
+
usernameText = new Text(container, SWT.BORDER | SWT.SINGLE);
- usernameText.setText(defaultUsername);
- usernameText.addModifyListener(textListener);
+ credentialsDbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observe(usernameText),
+ BeanProperties.value(CloudConnectionModel.class,
CloudConnectionModel.PROPERTY_USERNAME).observe(
+ connectionModel));
Label passwordLabel = new Label(container, SWT.NULL);
passwordLabel.setText(WizardMessages.getString(PASSWORD_LABEL));
passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD | SWT.SINGLE);
- passwordText.setText(defaultPassword);
- passwordText.addModifyListener(textListener);
-
- testButton = new Button(container, SWT.NULL);
+ credentialsDbc.bindValue(
+ WidgetProperties.text(SWT.Modify).observe(passwordText),
+ BeanProperties.value(CloudConnectionModel.class,
CloudConnectionModel.PROPERTY_PASSWORD).observe(
+ connectionModel));
+
+ final Button testButton = new Button(container, SWT.NULL);
testButton.setText(WizardMessages.getString(TESTBUTTON_LABEL));
- testButton.setEnabled(!defaultName.equals(""));
+ testButton.setEnabled(false);
+ urlBinding.getValidationStatus().addValueChangeListener(new IValueChangeListener() {
+
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+ IStatus status = (IStatus) event.diff.getNewValue();
+ testButton.setEnabled(status.isOK());
+ }
+ });
testButton.addSelectionListener(buttonListener);
-
+
Link ec2userLink = new Link(container, SWT.NULL);
ec2userLink.setText(WizardMessages.getString(EC2_USER_INFO));
ec2userLink.addListener(SWT.Selection, linkListener);
@@ -337,12 +257,15 @@
Link ec2pwLink = new Link(container, SWT.NULL);
ec2pwLink.setText(WizardMessages.getString(EC2_PASSWORD_INFO));
ec2pwLink.addListener(SWT.Selection, linkListener);
-
+
FormData f = new FormData();
f.left = new FormAttachment(0, 0);
f.right = new FormAttachment(100, 0);
dummyLabel.setLayoutData(f);
-
+
+ Point p2 = urlText.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+
f = new FormData();
f.top = new FormAttachment(dummyLabel, 8 + centering);
nameLabel.setLayoutData(f);
@@ -352,11 +275,11 @@
f.left = new FormAttachment(usernameLabel, 5);
f.right = new FormAttachment(100, 0);
nameText.setLayoutData(f);
-
+
f = new FormData();
f.top = new FormAttachment(nameText, 5 + centering);
urlLabel.setLayoutData(f);
-
+
f = new FormData();
f.left = new FormAttachment(nameText, 0, SWT.LEFT);
f.top = new FormAttachment(nameText, 5);
@@ -366,23 +289,23 @@
f = new FormData();
f.top = new FormAttachment(urlText, 5 + centering);
typeLabel.setLayoutData(f);
-
+
f = new FormData();
f.left = new FormAttachment(urlText, 0, SWT.LEFT);
f.top = new FormAttachment(urlText, 5 + centering);
f.right = new FormAttachment(100, 0);
- typeText.setLayoutData(f);
+ typeLabel.setLayoutData(f);
f = new FormData();
- f.top = new FormAttachment(typeText, 10 + centering);
+ f.top = new FormAttachment(typeLabel, 10 + centering);
usernameLabel.setLayoutData(f);
-
+
f = new FormData();
- f.left = new FormAttachment(typeText, 0, SWT.LEFT);
- f.top = new FormAttachment(typeText, 10);
+ f.left = new FormAttachment(typeLabel, 0, SWT.LEFT);
+ f.top = new FormAttachment(typeLabel, 10);
f.right = new FormAttachment(100, -70);
usernameText.setLayoutData(f);
-
+
f = new FormData();
f.left = new FormAttachment(usernameText, 0, SWT.LEFT);
f.top = new FormAttachment(usernameText, 5);
@@ -397,23 +320,22 @@
f.top = new FormAttachment(ec2userLink, 5);
f.right = new FormAttachment(100, -70);
passwordText.setLayoutData(f);
-
+
f = new FormData();
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- Point minSize = testButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- f.width = Math.max(widthHint, minSize.x);
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = testButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
f.left = new FormAttachment(usernameText, 10);
f.top = new FormAttachment(usernameText, 0);
f.right = new FormAttachment(100, 0);
testButton.setLayoutData(f);
-
+
f = new FormData();
f.left = new FormAttachment(passwordText, 0, SWT.LEFT);
f.top = new FormAttachment(passwordText, 5);
ec2pwLink.setLayoutData(f);
-
+
setControl(container);
- validate();
+ // validate();
+ }
}
-
-}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudType.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudType.java 2010-10-10
22:27:57 UTC (rev 25676)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/CloudType.java 2010-10-10
22:30:15 UTC (rev 25677)
@@ -32,15 +32,19 @@
public class CloudType {
- private static final String DOCUMENT_ELEMENT_DRIVER = "driver";
- private static final String DOCUMENT_ELEMENT_API = "api";
- private static final String URLCONNECTION_ENCODING = "UTF-8";
+ private static final String HTTPHEADER_KEY_ACCEPT = "Accept"; //$NON-NLS-1$
+ private static final String HTTPHEADER_VALUE_ACCEPTXML =
"application/xml;q=1.0"; //$NON-NLS-1$
+ private static final String DOCUMENT_ELEMENT_DRIVER = "driver"; //$NON-NLS-1$
+ private static final String DOCUMENT_ELEMENT_API = "api"; //$NON-NLS-1$
+ private static final String URLCONNECTION_ENCODING = "UTF-8"; //$NON-NLS-1$
+
public static final String UNKNOWN_TYPE_LABEL = "UnknownType.label";
//$NON-NLS-1$
private static final String INVALID_URL = "ErrorInvalidURL.text";
//$NON-NLS-1$
- static final String NONCLOUD_URL = "ErrorNonCloudURL.text"; //$NON-NLS-1$
+ private static final String NONCLOUD_URL = "ErrorNonCloudURL.text";
//$NON-NLS-1$
- private String label;
+ private String label = WizardMessages.getString(UNKNOWN_TYPE_LABEL);
private boolean isValid;
+ private String url;
public CloudType(String url) {
init(url);
@@ -55,17 +59,16 @@
* the cloud instance url to connect to
*/
private void init(String url) {
+ this.url = url;
try {
Object o = getURLContent(url + "/api?format=xml"); //$NON-NLS-1$
if (o instanceof InputStream) {
- DocumentBuilderFactory dbf = DocumentBuilderFactory
- .newInstance();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
- Document document = db.parse(new InputSource(new StringReader(
- getXML((InputStream) o))));
+ Document document = db.parse(
+ new InputSource(new StringReader(getXML((InputStream) o))));
- NodeList elements = document
- .getElementsByTagName(DOCUMENT_ELEMENT_API); //$NON-NLS-1$
+ NodeList elements = document.getElementsByTagName(DOCUMENT_ELEMENT_API);
//$NON-NLS-1$
if (elements.getLength() > 0) {
Node n = elements.item(0);
Node driver = n.getAttributes().getNamedItem(
@@ -74,8 +77,6 @@
isValid = true;
String driverValue = driver.getNodeValue();
label = driverValue.toUpperCase();
- } else {
- label = WizardMessages.getString(UNKNOWN_TYPE_LABEL);
}
}
}
@@ -92,17 +93,14 @@
}
}
- private String getXML(InputStream is) throws UnsupportedEncodingException,
- IOException {
+ private String getXML(InputStream is) throws UnsupportedEncodingException, IOException
{
try {
if (is == null) {
return "";
}
StringBuilder sb = new StringBuilder();
- String line;
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- is, URLCONNECTION_ENCODING));
+ String line = "";
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is,
URLCONNECTION_ENCODING));
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n"); //$NON-NLS-1$
}
@@ -120,10 +118,14 @@
return label;
}
+ public String getUrl() {
+ return url;
+ }
+
private Object getURLContent(String url) throws IOException {
URL u = new URL(url);
URLConnection connection = u.openConnection();
- connection.setRequestProperty("Accept", "application/xml;q=1.0");
//$NON-NLS-1$ $NON-NLS-2$
+ connection.setRequestProperty(HTTPHEADER_KEY_ACCEPT, HTTPHEADER_VALUE_ACCEPTXML);
//$NON-NLS-1$ $NON-NLS-2$
return connection.getContent();
}
}