diff options
author | Pascal Rapicault | 2010-12-06 22:10:52 +0000 |
---|---|---|
committer | Pascal Rapicault | 2010-12-06 22:10:52 +0000 |
commit | fbb4f5902cade92cc1689e73209c60a6413a5ef7 (patch) | |
tree | ace0fb107bafe980fc14fd7f3429e5c9aac2d795 /org.eclipse.m2e.launching | |
parent | a9c878c2624b33d8c74062717bf75302f0ae1fa7 (diff) | |
download | m2e-core-fbb4f5902cade92cc1689e73209c60a6413a5ef7.tar.gz m2e-core-fbb4f5902cade92cc1689e73209c60a6413a5ef7.tar.xz m2e-core-fbb4f5902cade92cc1689e73209c60a6413a5ef7.zip |
Initial commit at Eclipse
Diffstat (limited to 'org.eclipse.m2e.launching')
34 files changed, 3504 insertions, 0 deletions
diff --git a/org.eclipse.m2e.launching/.classpath b/org.eclipse.m2e.launching/.classpath new file mode 100644 index 00000000..798048dd --- /dev/null +++ b/org.eclipse.m2e.launching/.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/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src/"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/org.eclipse.m2e.launching/.gitignore b/org.eclipse.m2e.launching/.gitignore new file mode 100644 index 00000000..ea8c4bf7 --- /dev/null +++ b/org.eclipse.m2e.launching/.gitignore @@ -0,0 +1 @@ +/target diff --git a/org.eclipse.m2e.launching/.project b/org.eclipse.m2e.launching/.project new file mode 100644 index 00000000..52e707b7 --- /dev/null +++ b/org.eclipse.m2e.launching/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.m2e.launching</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> + <buildCommand> + <name>org.maven.ide.eclipse.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.maven.ide.eclipse.maven2Nature</nature> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.m2e.launching/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.m2e.launching/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..ed1100b1 --- /dev/null +++ b/org.eclipse.m2e.launching/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,338 @@ +#Thu Feb 04 10:56:11 EST 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +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=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +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=ignore +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=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.5 +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_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_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=2 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=1 +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=1 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=2 +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=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=false +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=false +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=120 +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.format_guardian_clause_on_one_line=false +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=true +org.eclipse.jdt.core.formatter.indentation.size=2 +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_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=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=do not 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=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=do not 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=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not 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=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not 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.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=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +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=space +org.eclipse.jdt.core.formatter.tabulation.size=2 +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/org.eclipse.m2e.launching/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.m2e.launching/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000..76adeec1 --- /dev/null +++ b/org.eclipse.m2e.launching/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,10 @@ +#Tue Nov 30 18:52:25 EST 2010 +eclipse.preferences.version=1 +formatter_profile=_m2 plugin +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=ex +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=false +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\n * Copyright (c) 2010 Sonatype, Inc.\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * Sonatype, Inc. - initial API and implementation\n *******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> diff --git a/org.eclipse.m2e.launching/.settings/org.eclipse.mylyn.tasks.ui.prefs b/org.eclipse.m2e.launching/.settings/org.eclipse.mylyn.tasks.ui.prefs new file mode 100644 index 00000000..954ec19d --- /dev/null +++ b/org.eclipse.m2e.launching/.settings/org.eclipse.mylyn.tasks.ui.prefs @@ -0,0 +1,4 @@ +#Fri Oct 17 19:35:37 EDT 2008 +eclipse.preferences.version=1 +project.repository.kind=jira +project.repository.url=http\://jira.codehaus.org diff --git a/org.eclipse.m2e.launching/.settings/org.eclipse.mylyn.team.ui.prefs b/org.eclipse.m2e.launching/.settings/org.eclipse.mylyn.team.ui.prefs new file mode 100644 index 00000000..397560fc --- /dev/null +++ b/org.eclipse.m2e.launching/.settings/org.eclipse.mylyn.team.ui.prefs @@ -0,0 +1,3 @@ +#Fri Oct 17 19:35:37 EDT 2008 +commit.comment.template=${task.key}\: ${task.description} +eclipse.preferences.version=1 diff --git a/org.eclipse.m2e.launching/.settings/org.eclipse.pde.prefs b/org.eclipse.m2e.launching/.settings/org.eclipse.pde.prefs new file mode 100644 index 00000000..86f0a2f7 --- /dev/null +++ b/org.eclipse.m2e.launching/.settings/org.eclipse.pde.prefs @@ -0,0 +1,22 @@ +#Fri Oct 17 19:33:03 EDT 2008 +compilers.f.unresolved-features=1 +compilers.f.unresolved-plugins=1 +compilers.incompatible-environment=1 +compilers.p.build=1 +compilers.p.deprecated=2 +compilers.p.discouraged-class=1 +compilers.p.internal=1 +compilers.p.missing-packages=2 +compilers.p.no-required-att=1 +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=1 +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/org.eclipse.m2e.launching/.settings/org.maven.ide.eclipse.prefs b/org.eclipse.m2e.launching/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 00000000..ac87b894 --- /dev/null +++ b/org.eclipse.m2e.launching/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Tue Nov 16 11:32:18 EST 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/org.eclipse.m2e.launching/META-INF/MANIFEST.MF b/org.eclipse.m2e.launching/META-INF/MANIFEST.MF new file mode 100644 index 00000000..2b972fcd --- /dev/null +++ b/org.eclipse.m2e.launching/META-INF/MANIFEST.MF @@ -0,0 +1,32 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.m2e.launching;singleton:=true +Bundle-Version: 0.13.0.qualifier +Bundle-Localization: plugin +Require-Bundle: org.eclipse.core.resources, + org.eclipse.core.runtime, + org.eclipse.core.variables, + org.eclipse.jface, + org.eclipse.jface.text, + org.eclipse.ui.externaltools, + org.eclipse.ui.console, + org.eclipse.ui.editors, + org.eclipse.ui.workbench, + org.eclipse.ui.ide, + org.eclipse.debug.core, + org.eclipse.debug.ui, + org.eclipse.jdt.core, + org.eclipse.jdt.launching, + org.eclipse.jdt.ui, + org.eclipse.jdt.debug.ui, + org.eclipse.jdt.junit, + org.eclipse.m2e.maven.runtime;bundle-version="[0.13.0,0.14.0)", + org.eclipse.m2e.core;bundle-version="[0.13.0,0.14.0)", + com.ibm.icu;bundle-version="4.0.1" +Eclipse-LazyStart: true +Bundle-RequiredExecutionEnvironment: J2SE-1.5, + JavaSE-1.6 +Bundle-Vendor: %Bundle-Vendor +Export-Package: org.eclipse.m2e.actions;x-internal:=true +Bundle-Activator: org.eclipse.m2e.internal.launch.MavenLaunchPlugin diff --git a/org.eclipse.m2e.launching/about.html b/org.eclipse.m2e.launching/about.html new file mode 100644 index 00000000..70e4b67c --- /dev/null +++ b/org.eclipse.m2e.launching/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>October 29, 2010</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> diff --git a/org.eclipse.m2e.launching/build.properties b/org.eclipse.m2e.launching/build.properties new file mode 100644 index 00000000..76e37f3e --- /dev/null +++ b/org.eclipse.m2e.launching/build.properties @@ -0,0 +1,22 @@ +# +# Copyright (c) 2008-2010 Sonatype, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Sonatype, Inc. - initial API and implementation +# + +bin.includes = META-INF/,\ + plugin.xml,\ + .,\ + plugin.properties,\ + icons/,\ + org.eclipse.m2e.cliresolver.jar,\ + org.eclipse.m2e.cliresolver30.jar,\ + about.html +jars.compile.order = . +source.. = src/ +output.. = target/classes/ diff --git a/org.eclipse.m2e.launching/icons/m2.gif b/org.eclipse.m2e.launching/icons/m2.gif Binary files differnew file mode 100644 index 00000000..4b0c0589 --- /dev/null +++ b/org.eclipse.m2e.launching/icons/m2.gif diff --git a/org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver.jar b/org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver.jar Binary files differnew file mode 100644 index 00000000..ee932519 --- /dev/null +++ b/org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver.jar diff --git a/org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver30.jar b/org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver30.jar Binary files differnew file mode 100644 index 00000000..84445d39 --- /dev/null +++ b/org.eclipse.m2e.launching/org.eclipse.m2e.cliresolver30.jar diff --git a/org.eclipse.m2e.launching/plugin.properties b/org.eclipse.m2e.launching/plugin.properties new file mode 100644 index 00000000..526b2dfa --- /dev/null +++ b/org.eclipse.m2e.launching/plugin.properties @@ -0,0 +1,32 @@ +# +# Copyright (c) 2007, 2008 Sonatype, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# + +m2.popup.pomFile.label=Maven build +m2.popup.pomFileWithDialog.label=Maven build... + +m2.popup.lifecycle.package=Maven package +m2.popup.lifecycle.install=Maven install +m2.popup.lifecycle.source=Maven source:jar +m2.popup.lifecycle.clean=Maven clean +m2.popup.lifecycle.test=Maven test +m2.popup.lifecycle.generate-sources=Maven generate-sources +m2.popup.lifecycle.assembly=Maven assembly:assembly + +m2.shortcut.description.run=Run Maven Build +m2.shortcut.description.install=Run Maven Install +m2.shortcut.description.clean=Run Maven Clean +m2.shortcut.description.test=Run Maven Test +m2.shortcut.description.generate-sources=Run Maven Generate Sources + +m2.launch.type.name=Maven Build +m2.launch.type.builder.name=Maven Build + + +Bundle-Vendor = Sonatype, Inc. +Bundle-Name = Maven Integration for Eclipse Launching +sourceLocator.name = Maven source locator
\ No newline at end of file diff --git a/org.eclipse.m2e.launching/plugin.xml b/org.eclipse.m2e.launching/plugin.xml new file mode 100644 index 00000000..68cbb39a --- /dev/null +++ b/org.eclipse.m2e.launching/plugin.xml @@ -0,0 +1,220 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2007, 2008 Sonatype, Inc. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html +--> +<?eclipse version="3.0"?> +<plugin> + + <extension point="org.eclipse.ui.commands"> + <command id="org.eclipse.m2e.core.pomFileAction.run" + categoryId="org.eclipse.debug.ui.category.run" + name="%m2.shortcut.description.run" + description="%m2.shortcut.description.run"/> + <command id="org.eclipse.m2e.actions.LifeCycleInstall.run" + categoryId="org.eclipse.debug.ui.category.run" + name="%m2.shortcut.description.install" + description="%m2.shortcut.description.install"/> + <command id="org.eclipse.m2e.actions.LifeCycleClean.run" + categoryId="org.eclipse.debug.ui.category.run" + name="%m2.shortcut.description.clean" + description="%m2.shortcut.description.clean"/> + <command id="org.eclipse.m2e.actions.LifeCycleTest.run" + categoryId="org.eclipse.debug.ui.category.run" + name="%m2.shortcut.description.test" + description="%m2.shortcut.description.test"/> + <command id="org.eclipse.m2e.actions.LifeCycleGenerateSources.run" + name="%m2.shortcut.description.generate-sources" + description="%m2.shortcut.description.generate-sources" + categoryId="org.eclipse.debug.ui.category.run"/> + </extension> + + <extension point="org.eclipse.ui.bindings"> + <key sequence="M3+M2+X M" + contextId="org.eclipse.ui.contexts.window" + commandId="org.eclipse.m2e.core.pomFileAction.run" + schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> + <key sequence="M2+M3+P" + commandId="org.eclipse.m2e.core.ui.command.openPom" + schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> + </extension> + + <extension point="org.eclipse.debug.ui.launchShortcuts"> + <shortcut id="org.eclipse.m2e.core.pomFileAction" + class="org.eclipse.m2e.actions.ExecutePomAction" + icon="icons/m2.gif" + label="%m2.popup.pomFile.label" + modes="run,debug"> + <contextualLaunch> + <contextLabel label="%m2.popup.pomFile.label" mode="run"/> + <contextLabel label="%m2.popup.pomFile.label" mode="debug"/> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate> + <and> + <test property="org.eclipse.m2e.launchable"/> + <adapt type="org.eclipse.core.runtime.IAdaptable"/> + </and> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + <shortcut id="org.eclipse.m2e.core.pomFileActionWithDialog" + class="org.eclipse.m2e.actions.ExecutePomAction:WITH_DIALOG" + icon="icons/m2.gif" + label="%m2.popup.pomFileWithDialog.label" + modes="run,debug"> + <contextualLaunch> + <contextLabel label="%m2.popup.pomFileWithDialog.label" mode="run"/> + <contextLabel label="%m2.popup.pomFileWithDialog.label" mode="debug"/> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate> + <and> + <test property="org.eclipse.m2e.launchable"/> + <adapt type="org.eclipse.core.runtime.IAdaptable"/> + </and> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + <shortcut id="org.eclipse.m2e.actions.LifeCycleInstall" + class="org.eclipse.m2e.actions.ExecutePomAction:install" + icon="icons/m2.gif" + label="%m2.popup.lifecycle.install" + modes="run,debug"> + <contextualLaunch> + <contextLabel label="%m2.popup.lifecycle.install" mode="run"/> + <contextLabel label="%m2.popup.lifecycle.install" mode="debug"/> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate> + <and> + <test property="org.eclipse.m2e.launchable"/> + <adapt type="org.eclipse.core.runtime.IAdaptable"/> + </and> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + <shortcut id="org.eclipse.m2e.actions.LifeCycleTest" + class="org.eclipse.m2e.actions.ExecutePomAction:test" + icon="icons/m2.gif" + label="%m2.popup.lifecycle.test" + modes="run,debug"> + <contextualLaunch> + <contextLabel label="%m2.popup.lifecycle.test" mode="run"/> + <contextLabel label="%m2.popup.lifecycle.test" mode="debug"/> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate> + <and> + <test property="org.eclipse.m2e.launchable"/> + <adapt type="org.eclipse.core.runtime.IAdaptable"/> + </and> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + <shortcut id="org.eclipse.m2e.actions.LifeCycleGenerateSources" + class="org.eclipse.m2e.actions.ExecutePomAction:generate-sources" + icon="icons/m2.gif" + label="%m2.popup.lifecycle.generate-sources" + modes="run,debug"> + <contextualLaunch> + <contextLabel label="%m2.popup.lifecycle.generate-sources" mode="run"/> + <contextLabel label="%m2.popup.lifecycle.generate-sources" mode="debug"/> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate> + <and> + <test property="org.eclipse.m2e.launchable"/> + <adapt type="org.eclipse.core.runtime.IAdaptable"/> + </and> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + <shortcut id="org.eclipse.m2e.actions.LifeCycleClean" + class="org.eclipse.m2e.actions.ExecutePomAction:clean" + icon="icons/m2.gif" + label="%m2.popup.lifecycle.clean" + modes="run,debug"> + <contextualLaunch> + <contextLabel label="%m2.popup.lifecycle.clean" mode="run"/> + <contextLabel label="%m2.popup.lifecycle.clean" mode="debug"/> + <enablement> + <with variable="selection"> + <count value="1"/> + <iterate> + <and> + <test property="org.eclipse.m2e.launchable"/> + <adapt type="org.eclipse.core.runtime.IAdaptable"/> + </and> + </iterate> + </with> + </enablement> + </contextualLaunch> + </shortcut> + </extension> + + <!-- m2 LaunchGroup --> + <extension point="org.eclipse.debug.core.launchConfigurationTypes"> + <!-- careful when changing id, it's used to locate launch configuration from the java code! --> + <!-- category="org.eclipse.ui.externaltools" --> + <launchConfigurationType + id="org.eclipse.m2e.Maven2LaunchConfigurationType" + delegate="org.eclipse.m2e.internal.launch.MavenLaunchDelegate" + sourceLocatorId="org.eclipse.m2e.launching.MavenSourceLocator" + sourcePathComputerId="org.eclipse.m2e.launching.MavenSourceComputer" + name="%m2.launch.type.name" + modes="run,debug" public="true"/> + </extension> + + <extension point="org.eclipse.debug.core.sourceLocators"> + <sourceLocator + id="org.eclipse.m2e.launching.MavenSourceLocator" + class="org.eclipse.m2e.internal.launch.MavenSourceLocator" + name="%sourceLocator.name"/> + </extension> + + <extension point="org.eclipse.debug.core.sourcePathComputers"> + <sourcePathComputer + id="org.eclipse.m2e.launching.MavenSourceComputer" + class="org.eclipse.m2e.internal.launch.MavenSourcePathComputer"/> + </extension> + + <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups"> + <launchConfigurationTabGroup id="org.eclipse.m2e.LaunchConfigurationTabGroup" + type="org.eclipse.m2e.Maven2LaunchConfigurationType" + class="org.eclipse.m2e.ui.internal.launch.MavenLaunchConfigurationTabGroup"/> + </extension> + + <!-- Maven launcher configuration type image --> + <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages"> + <launchConfigurationTypeImage + icon="icons/m2.gif" + configTypeID="org.eclipse.m2e.Maven2LaunchConfigurationType" + id="org.eclipse.m2e.launch.Maven2LaunchConfigurationTypeImage"/> + </extension> + + <extension point="org.eclipse.debug.ui.consoleLineTrackers"> + <consoleLineTracker id="org.eclipse.m2e.console.MavenConsoleLineTracker" + class="org.eclipse.m2e.internal.launch.MavenConsoleLineTracker" + processType="java"/> + </extension> + +</plugin> diff --git a/org.eclipse.m2e.launching/pom.xml b/org.eclipse.m2e.launching/pom.xml new file mode 100644 index 00000000..b846bad2 --- /dev/null +++ b/org.eclipse.m2e.launching/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2008 Sonatype, Inc. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.m2e</groupId> + <artifactId>org.eclipse.m2e.parent</artifactId> + <version>0.13.0-SNAPSHOT</version> + <relativePath>../org.eclipse.m2e.parent</relativePath> + </parent> + + <artifactId>org.eclipse.m2e.launching</artifactId> + <packaging>eclipse-plugin</packaging> + + <name>Maven Integration for Eclipse Launching</name> + +</project> diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java new file mode 100644 index 00000000..894f4619 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/ExecutePomAction.java @@ -0,0 +1,374 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.actions; + +import java.util.ArrayList; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExecutableExtension; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugModelPresentation; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.debug.ui.ILaunchShortcut; +import org.eclipse.debug.ui.RefreshTab; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; + +import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.core.IMavenConstants; +import org.eclipse.m2e.core.core.MavenLogger; +import org.eclipse.m2e.internal.launch.Messages; +import org.eclipse.m2e.core.project.IMavenProjectFacade; +import org.eclipse.m2e.core.project.MavenProjectManager; +import org.eclipse.m2e.core.project.ResolverConfiguration; +import org.eclipse.m2e.ui.internal.launch.MavenLaunchMainTab; +import org.eclipse.m2e.core.util.Util; + + +/** + * Maven launch shortcut + * + * @author Dmitri Maximovich + * @author Eugene Kuleshov + */ +public class ExecutePomAction implements ILaunchShortcut, IExecutableExtension { + + private boolean showDialog = false; + + private String goalName = null; + + public void setInitializationData(IConfigurationElement config, String propertyName, Object data) { + if("WITH_DIALOG".equals(data)) { //$NON-NLS-1$ + this.showDialog = true; + } else { + this.goalName = (String) data; + } + } + + public void launch(IEditorPart editor, String mode) { + IEditorInput editorInput = editor.getEditorInput(); + if(editorInput instanceof IFileEditorInput) { + launch(((IFileEditorInput) editorInput).getFile().getParent(), mode); + } + } + + public void launch(ISelection selection, String mode) { + if(selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object object = structuredSelection.getFirstElement(); + + IContainer basedir = null; + if(object instanceof IProject || object instanceof IFolder) { + basedir = (IContainer) object; + } else if(object instanceof IFile) { + basedir = ((IFile) object).getParent(); + } else if(object instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) object; + Object adapter = adaptable.getAdapter(IProject.class); + if(adapter != null) { + basedir = (IContainer) adapter; + } else { + adapter = adaptable.getAdapter(IFolder.class); + if(adapter != null) { + basedir = (IContainer) adapter; + } else { + adapter = adaptable.getAdapter(IFile.class); + if(adapter != null) { + basedir = ((IFile) object).getParent(); + } + } + } + } + + launch(basedir, mode); + } + } + + @SuppressWarnings("deprecation") + private void launch(IContainer basecon, String mode) { + if(basecon == null) { + return; + } + + IContainer basedir = findPomXmlBasedir(basecon); + + ILaunchConfiguration launchConfiguration = getLaunchConfiguration(basedir, mode); + if(launchConfiguration == null) { + return; + } + + boolean openDialog = showDialog; + if(!openDialog) { + try { + // if no goals specified + String goals = launchConfiguration.getAttribute(MavenLaunchConstants.ATTR_GOALS, (String) null); + openDialog = goals == null || goals.trim().length() == 0; + } catch(CoreException ex) { + MavenLogger.log(ex); + } + } + + if(openDialog) { + DebugUITools.saveBeforeLaunch(); + // ILaunchGroup group = DebugUITools.getLaunchGroup(launchConfiguration, mode); + DebugUITools.openLaunchConfigurationDialog(getShell(), launchConfiguration, + MavenLaunchMainTab.ID_EXTERNAL_TOOLS_LAUNCH_GROUP, null); + } else { + DebugUITools.launch(launchConfiguration, mode); + } + } + + private Shell getShell() { + return MavenPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); + } + + private IContainer findPomXmlBasedir(IContainer dir) { + if(dir == null) { + return null; + } + + try { + // loop upwards through the parents as long as we do not cross the project boundary + while(dir.exists() && dir.getProject() != null && dir.getProject() != dir) { + // see if pom.xml exists + if(dir.getType() == IResource.FOLDER) { + IFolder folder = (IFolder) dir; + if(folder.findMember(IMavenConstants.POM_FILE_NAME) != null) { + return folder; + } + } else if(dir.getType() == IResource.FILE) { + if(((IFile) dir).getName().equals(IMavenConstants.POM_FILE_NAME)) { + return dir.getParent(); + } + } + dir = dir.getParent(); + } + } catch(Exception e) { + return dir; + } + return dir; + } + + private ILaunchConfiguration createLaunchConfiguration(IContainer basedir, String goal) { + try { + ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); + ILaunchConfigurationType launchConfigurationType = launchManager + .getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID); + + String launchSafeGoalName = goal.replace(':', '-'); + + ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, // + NLS.bind(Messages.ExecutePomAction_executing, launchSafeGoalName, basedir.getLocation().toString().replace('/', '-'))); + workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, basedir.getLocation().toOSString()); + workingCopy.setAttribute(MavenLaunchConstants.ATTR_GOALS, goal); + workingCopy.setAttribute(IDebugUIConstants.ATTR_PRIVATE, true); + workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_SCOPE, "${project}"); //$NON-NLS-1$ + workingCopy.setAttribute(RefreshTab.ATTR_REFRESH_RECURSIVE, true); + + setProjectConfiguration(workingCopy, basedir); + + IPath path = getJREContainerPath(basedir); + if(path != null) { + workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, path.toPortableString()); + } + + // TODO when launching Maven with debugger consider to add the following property + // -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" + + return workingCopy; + } catch(CoreException ex) { + MavenLogger.log(ex); + } + return null; + } + + private void setProjectConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IContainer basedir) { + MavenProjectManager projectManager = MavenPlugin.getDefault().getMavenProjectManager(); + IFile pomFile = basedir.getFile(new Path(IMavenConstants.POM_FILE_NAME)); + IMavenProjectFacade projectFacade = projectManager.create(pomFile, false, new NullProgressMonitor()); + if(projectFacade != null) { + ResolverConfiguration configuration = projectFacade.getResolverConfiguration(); + + String activeProfiles = configuration.getActiveProfiles(); + if(activeProfiles != null && activeProfiles.length() > 0) { + workingCopy.setAttribute(MavenLaunchConstants.ATTR_PROFILES, activeProfiles); + } + } + } + + // TODO ideally it should use MavenProject, but it is faster to scan IJavaProjects + private IPath getJREContainerPath(IContainer basedir) throws CoreException { + IProject project = basedir.getProject(); + if(project != null && project.hasNature(JavaCore.NATURE_ID)) { + IJavaProject javaProject = JavaCore.create(project); + IClasspathEntry[] entries = javaProject.getRawClasspath(); + for(int i = 0; i < entries.length; i++ ) { + IClasspathEntry entry = entries[i]; + if(JavaRuntime.JRE_CONTAINER.equals(entry.getPath().segment(0))) { + return entry.getPath(); + } + } + } + return null; + } + + private ILaunchConfiguration getLaunchConfiguration(IContainer basedir, String mode) { + if(goalName != null) { + return createLaunchConfiguration(basedir, goalName); + } + + ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); + ILaunchConfigurationType launchConfigurationType = launchManager + .getLaunchConfigurationType(MavenLaunchConstants.LAUNCH_CONFIGURATION_TYPE_ID); + + // scan existing launch configurations + IPath basedirLocation = basedir.getLocation(); + if(!showDialog) { + try { +// ILaunch[] launches = launchManager.getLaunches(); +// ILaunchConfiguration[] launchConfigurations = null; +// if(launches.length > 0) { +// for(int i = 0; i < launches.length; i++ ) { +// ILaunchConfiguration config = launches[i].getLaunchConfiguration(); +// if(config != null && launchConfigurationType.equals(config.getType())) { +// launchConfigurations = new ILaunchConfiguration[] {config}; +// } +// } +// } +// if(launchConfigurations == null) { +// launchConfigurations = launchManager.getLaunchConfigurations(launchConfigurationType); +// } + + ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(launchConfigurationType); + ArrayList<ILaunchConfiguration> matchingConfigs = new ArrayList<ILaunchConfiguration>(); + for(ILaunchConfiguration configuration : launchConfigurations) { + // substitute variables + String workDir = Util.substituteVar(configuration.getAttribute(MavenLaunchConstants.ATTR_POM_DIR, (String) null)); + if(workDir == null) { + continue; + } + IPath workPath = new Path(workDir); + if(basedirLocation.equals(workPath)) { + matchingConfigs.add(configuration); + } + } + + if(matchingConfigs.size()==1) { + MavenPlugin.getDefault().getConsole().logMessage("Using existing launch configuration"); + return matchingConfigs.get(0); + } else if(matchingConfigs.size()>1) { + final IDebugModelPresentation labelProvider = DebugUITools.newDebugModelPresentation(); + ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), // + new ILabelProvider() { + public Image getImage(Object element) { + return labelProvider.getImage(element); + } + + public String getText(Object element) { + if(element instanceof ILaunchConfiguration) { + ILaunchConfiguration configuration = (ILaunchConfiguration) element; + try { + return labelProvider.getText(element) + " : " + + configuration.getAttribute(MavenLaunchConstants.ATTR_GOALS, ""); + } catch(CoreException ex) { + // ignore + } + } + return labelProvider.getText(element); + } + + public boolean isLabelProperty(Object element, String property) { + return labelProvider.isLabelProperty(element, property); + } + + public void addListener(ILabelProviderListener listener) { + labelProvider.addListener(listener); + } + + public void removeListener(ILabelProviderListener listener) { + labelProvider.removeListener(listener); + } + + public void dispose() { + labelProvider.dispose(); + } + }); + dialog.setElements(matchingConfigs.toArray(new ILaunchConfiguration[matchingConfigs.size()])); + dialog.setTitle(Messages.ExecutePomAction_dialog_title); + if (mode.equals(ILaunchManager.DEBUG_MODE)) { + dialog.setMessage(Messages.ExecutePomAction_dialog_debug_message); + } else { + dialog.setMessage(Messages.ExecutePomAction_dialog_run_message); + } + dialog.setMultipleSelection(false); + int result = dialog.open(); + labelProvider.dispose(); + return result == Window.OK ? (ILaunchConfiguration) dialog.getFirstResult() : null; + } + + } catch(CoreException ex) { + MavenLogger.log(ex); + } + } + + MavenPlugin.getDefault().getConsole().logMessage("Creating new launch configuration"); + + String newName = launchManager.generateUniqueLaunchConfigurationNameFrom(basedirLocation.lastSegment()); + try { + ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, newName); + workingCopy.setAttribute(MavenLaunchConstants.ATTR_POM_DIR, basedirLocation.toString()); + + setProjectConfiguration(workingCopy, basedir); + + // set other defaults if needed + // MavenLaunchMainTab maintab = new MavenLaunchMainTab(); + // maintab.setDefaults(workingCopy); + // maintab.dispose(); + + return workingCopy.doSave(); + } catch(Exception ex) { + MavenLogger.log("Error creating new launch configuration", ex); + } + return null; + } + +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java new file mode 100644 index 00000000..0d48f535 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/actions/MavenLaunchConstants.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.actions; + +import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; + +public interface MavenLaunchConstants { + // this should correspond with launchConfigurationType.id attribute in plugin.xml! + public final String LAUNCH_CONFIGURATION_TYPE_ID = "org.eclipse.m2e.Maven2LaunchConfigurationType"; //$NON-NLS-1$ + public final String BUILDER_CONFIGURATION_TYPE_ID = "org.eclipse.m2e.Maven2BuilderConfigurationType"; //$NON-NLS-1$ + + // pom directory automatically became working directory for maven embedder launch + public final String ATTR_POM_DIR = IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY; + + public final String ATTR_GOALS = "M2_GOALS"; //$NON-NLS-1$ + public final String ATTR_GOALS_AUTO_BUILD = "M2_GOALS_AUTO_BUILD"; //$NON-NLS-1$ + public final String ATTR_GOALS_MANUAL_BUILD = "M2_GOALS_MANUAL_BUILD"; //$NON-NLS-1$ + public final String ATTR_GOALS_CLEAN = "M2_GOALS_CLEAN"; //$NON-NLS-1$ + public final String ATTR_GOALS_AFTER_CLEAN = "M2_GOALS_AFTER_CLEAN"; //$NON-NLS-1$ + + public final String ATTR_PROFILES = "M2_PROFILES"; //$NON-NLS-1$ + public final String ATTR_PROPERTIES = "M2_PROPERTIES"; //$NON-NLS-1$ + + public final String ATTR_OFFLINE = "M2_OFFLINE"; //$NON-NLS-1$ + public final String ATTR_UPDATE_SNAPSHOTS = "M2_UPDATE_SNAPSHOTS"; //$NON-NLS-1$ + public final String ATTR_DEBUG_OUTPUT = "M2_DEBUG_OUTPUT"; //$NON-NLS-1$ + public final String ATTR_SKIP_TESTS = "M2_SKIP_TESTS"; //$NON-NLS-1$ + public final String ATTR_NON_RECURSIVE = "M2_NON_RECURSIVE"; //$NON-NLS-1$ + public final String ATTR_WORKSPACE_RESOLUTION = "M2_WORKSPACE_RESOLUTION"; //$NON-NLS-1$ + + public final String ATTR_USER_SETTINGS = "M2_USER_SETTINGS"; //$NON-NLS-1$ + + public final String ATTR_RUNTIME = "M2_RUNTIME"; //$NON-NLS-1$ + + // hidden (for now) list of workspace components to be pushed into maven runtime + public final String ATTR_FORCED_COMPONENTS_LIST = "M2_FORCED_COMPONENTS_LIST"; //$NON-NLS-1$ +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java new file mode 100644 index 00000000..7023f497 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenConsoleLineTracker.java @@ -0,0 +1,281 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.codehaus.plexus.util.DirectoryScanner; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.core.model.IProcess; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.console.IConsole; +import org.eclipse.debug.ui.console.IConsoleLineTracker; +import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IRegion; +import org.eclipse.m2e.actions.MavenLaunchConstants; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.console.IHyperlink; +import org.eclipse.ui.ide.IDE; +import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.core.MavenLogger; +import org.eclipse.m2e.core.project.IMavenProjectFacade; +import org.eclipse.m2e.core.project.MavenProjectManager; + + +/** + * Maven Console line tracker + * + * @author Eugene Kuleshov + */ +public class MavenConsoleLineTracker implements IConsoleLineTracker { + + private static final String PLUGIN_ID = "org.eclipse.m2e.launching"; //$NON-NLS-1$ + + private static final String LISTENING_MARKER = "Listening for transport dt_socket at address: "; + + private static final String RUNNING_MARKER = "Running "; + + private static final String TEST_TEMPLATE = "(?: )test.+\\(([\\w\\.]+)\\)"; //$NON-NLS-1$ + + private static final Pattern PATTERN2 = Pattern.compile(TEST_TEMPLATE); + + private IConsole console; + + public void init(IConsole console) { + this.console = console; + } + + public void lineAppended(IRegion line) { + IProcess process = console.getProcess(); + ILaunch launch = process.getLaunch(); + ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration(); + + if(launchConfiguration!=null && isMavenProcess(launchConfiguration)) { + try { + int offset = line.getOffset(); + int length = line.getLength(); + + String text = console.getDocument().get(offset, length); + + String testName = null; + + int index = text.indexOf(RUNNING_MARKER); + if(index > -1) { + testName = text.substring(RUNNING_MARKER.length()); + offset += RUNNING_MARKER.length(); + + } else if(text.startsWith(LISTENING_MARKER)) { + // create and start remote Java app launch configuration + String baseDir = getBaseDir(launchConfiguration); + if(baseDir!=null) { + String portString = text.substring(LISTENING_MARKER.length()).trim(); + MavenDebugHyperLink link = new MavenDebugHyperLink(baseDir, portString); + console.addLink(link, offset, LISTENING_MARKER.length() + portString.length()); + // launchRemoteJavaApp(baseDir, portString); + } + + } else { + Matcher m = PATTERN2.matcher(text); + if(m.find()) { + testName = m.group(1); + offset += m.start(1); + } + } + + if(testName != null) { + String baseDir = getBaseDir(launchConfiguration); + if(baseDir!=null) { + MavenConsoleHyperLink link = new MavenConsoleHyperLink(baseDir, testName); + console.addLink(link, offset, testName.length()); + } + } + + } catch(BadLocationException ex) { + // ignore + } catch(CoreException ex) { + MavenLogger.log(ex); + } + } + } + + private String getBaseDir(ILaunchConfiguration launchConfiguration) throws CoreException { + return launchConfiguration.getAttribute(MavenLaunchConstants.ATTR_POM_DIR, (String) null); + } + + public void dispose() { + } + + private boolean isMavenProcess(ILaunchConfiguration launchConfiguration) { + try { + ILaunchConfigurationType type = launchConfiguration.getType(); + return PLUGIN_ID.equals(type.getPluginIdentifier()); + } catch(CoreException ex) { + MavenLogger.log(ex); + return false; + } + } + + static void launchRemoteJavaApp(String baseDir, String portString) throws CoreException { + ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager(); + ILaunchConfigurationType launchConfigurationType = launchManager + .getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_REMOTE_JAVA_APPLICATION); + + /* + <launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication"> + <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="foo-launch"/> + <stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/> + <booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="false"/> + <mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP"> + <mapEntry key="port" value="8000"/> + <mapEntry key="hostname" value="localhost"/> + </mapAttribute> + + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> + <listEntry value="/foo-launch"/> + </listAttribute> + <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> + <listEntry value="4"/> + </listAttribute> + + <listAttribute key="org.eclipse.debug.ui.favoriteGroups"> + <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/> + </listAttribute> + */ + + ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance(null, // + "Connecting debugger to port " + portString); + workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_ALLOW_TERMINATE, false); + workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_CONNECTOR, IJavaLaunchConfigurationConstants.ID_SOCKET_ATTACH_VM_CONNECTOR); + + Map<String, String> connectMap = new HashMap<String, String>(); + connectMap.put("port", portString); //$NON-NLS-1$ + connectMap.put("hostname", "localhost"); //$NON-NLS-1$ //$NON-NLS-2$ + workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CONNECT_MAP, connectMap); + + IProject project = getProject(baseDir); + if(project!=null) { + workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName()); + } + + DebugUITools.launch(workingCopy, "debug"); //$NON-NLS-1$ + } + + static IProject getProject(String baseDir) { + MavenProjectManager projectManager = MavenPlugin.getDefault().getMavenProjectManager(); + for(IMavenProjectFacade projectFacade : projectManager.getProjects()) { + IContainer base = projectFacade.getPom().getParent(); + String baseLocation = base.getLocation().toPortableString(); + if(baseDir.equals(baseLocation)) { + return projectFacade.getProject(); + } + } + return null; + } + + + /** + * Opens a text editor for Maven test report + */ + public class MavenConsoleHyperLink implements IHyperlink { + + private final String baseDir; + private final String testName; + + public MavenConsoleHyperLink(String baseDir, String testName) { + this.baseDir = baseDir; + this.testName = testName; + } + + public void linkActivated() { + DirectoryScanner ds = new DirectoryScanner(); + ds.setBasedir(baseDir); + ds.setIncludes(new String[] {"**/" + testName + ".txt"}); //$NON-NLS-1$ //$NON-NLS-2$ + ds.scan(); + String[] includedFiles = ds.getIncludedFiles(); + + // TODO show selection dialog when there is more then one result found + if(includedFiles != null && includedFiles.length > 0) { + IWorkbench workbench = PlatformUI.getWorkbench(); + IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); + IWorkbenchPage page = window.getActivePage(); + + IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor("foo.txt"); //$NON-NLS-1$ + + File reportFile = new File(baseDir, includedFiles[0]); + + try { + IDE.openEditor(page, new MavenFileEditorInput(reportFile.getAbsolutePath()), desc.getId()); + } catch(PartInitException ex) { + MavenLogger.log(ex); + } + } + } + + public void linkEntered() { + } + + public void linkExited() { + } + + } + + /** + * Creates debug launch configuration for remote Java application. For example, + * with surefire plugin the following property can be specified: + * -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" + */ + public class MavenDebugHyperLink implements IHyperlink { + + private final String baseDir; + private final String portString; + + public MavenDebugHyperLink(String baseDir, String portString) { + this.baseDir = baseDir; + this.portString = portString; + } + + public void linkActivated() { + try { + launchRemoteJavaApp(baseDir, portString); + } catch (CoreException ex) { + MavenLogger.log(ex); + } + } + + public void linkEntered() { + } + + public void linkExited() { + } + + } + +} + diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java new file mode 100644 index 00000000..56fffd5c --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenFileEditorInput.java @@ -0,0 +1,117 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; + +import org.eclipse.core.resources.IStorage; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.osgi.util.NLS; +import org.eclipse.ui.IPersistableElement; +import org.eclipse.ui.IStorageEditorInput; +import org.eclipse.ui.editors.text.ILocationProvider; + +import org.eclipse.m2e.core.core.IMavenConstants; + +/** + * Maven file editor input + * + * @author Eugene Kuleshov + */ +public class MavenFileEditorInput implements IStorageEditorInput { + final String fileName; + + public MavenFileEditorInput(String fileName) { + this.fileName = fileName; + } + + public boolean exists() { + return true; + } + + public ImageDescriptor getImageDescriptor() { + return null; + } + + public String getName() { + return new File(this.fileName).getName(); + } + + public String getToolTipText() { + return this.fileName; + } + + public IStorage getStorage() { + return new IStorage() { + + public InputStream getContents() throws CoreException { + try { + return new FileInputStream(fileName); + } catch(FileNotFoundException ex) { + throw new CoreException(new Status(IStatus.ERROR, // + IMavenConstants.PLUGIN_ID, -1, NLS.bind(Messages.MavenFileEditorInput_0, fileName), ex)); + } + } + + public IPath getFullPath() { + return Path.fromOSString(fileName); + } + + public String getName() { + return fileName; + } + + public boolean isReadOnly() { + return false; + } + + @SuppressWarnings("unchecked") + public Object getAdapter(Class adapter) { + return null; + } + }; + } + + public IPersistableElement getPersistable() { + return null; +// return new IPersistableElement() { +// +// public String getFactoryId() { +// return MavenEditorInputFactory.ID; +// } +// +// public void saveState(IMemento memento) { +// memento.putString("fileName", fileName); +// } +// }; + } + + @SuppressWarnings("unchecked") + public Object getAdapter(Class adapter) { + if(adapter==ILocationProvider.class) { + return new ILocationProvider() { + public IPath getPath(Object element) { + return Path.fromOSString(fileName); + } + }; + } + return null; + } +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java new file mode 100644 index 00000000..d8b1728e --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchDelegate.java @@ -0,0 +1,349 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.debug.core.DebugEvent; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.IDebugEventSetListener; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.model.IProcess; +import org.eclipse.debug.ui.RefreshTab; +import org.eclipse.jdt.launching.IVMRunner; +import org.eclipse.jdt.launching.JavaLaunchDelegate; +import org.eclipse.jdt.launching.VMRunnerConfiguration; +import org.eclipse.m2e.actions.MavenLaunchConstants; +import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.core.IMavenConstants; +import org.eclipse.m2e.core.core.MavenConsole; +import org.eclipse.m2e.core.core.MavenLogger; +import org.eclipse.m2e.core.embedder.IMavenConfiguration; +import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration; +import org.eclipse.m2e.core.util.Util; + + +public class MavenLaunchDelegate extends JavaLaunchDelegate implements MavenLaunchConstants { + + private static final String LAUNCHER_TYPE = "org.codehaus.classworlds.Launcher"; //$NON-NLS-1$ + private static final String LAUNCHER_TYPE3 = "org.codehaus.plexus.classworlds.launcher.Launcher"; // classwordls 2.0 //$NON-NLS-1$ + private static final String LAUNCH_M2CONF_FILE = "org.eclipse.m2e.internal.launch.M2_CONF"; //$NON-NLS-1$ + + private org.eclipse.m2e.core.embedder.MavenRuntime runtime; + private MavenLauncherConfigurationHandler m2conf; + private File confFile; + + public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) + throws CoreException { + MavenConsole console = MavenPlugin.getDefault().getConsole(); + console.logMessage("" + getWorkingDirectory(configuration)); //$NON-NLS-1$ + console.logMessage(" mvn" + getProgramArguments(configuration)); //$NON-NLS-1$ + + runtime = MavenLaunchUtils.getMavenRuntime(configuration); + + m2conf = new MavenLauncherConfigurationHandler(); + if (shouldResolveWorkspaceArtifacts(configuration)) { + m2conf.addArchiveEntry(MavenLaunchUtils.getCliResolver(runtime)); + } + MavenLaunchUtils.addUserComponents(configuration, m2conf); + runtime.createLauncherConfiguration(m2conf, new NullProgressMonitor()); + + File state = MavenPlugin.getDefault().getStateLocation().toFile(); + try { + File dir = new File(state, "launches"); //$NON-NLS-1$ + dir.mkdirs(); + confFile = File.createTempFile("m2conf", ".tmp", dir); //$NON-NLS-1$ //$NON-NLS-2$ + launch.setAttribute(LAUNCH_M2CONF_FILE, confFile.getCanonicalPath()); + OutputStream os = new FileOutputStream(confFile); + try { + m2conf.save(os); + } finally { + os.close(); + } + } catch (IOException e) { + throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, Messages.MavenLaunchDelegate_error_cannot_create_conf, e)); + } + + super.launch(configuration, mode, launch, monitor); + } + + public IVMRunner getVMRunner(final ILaunchConfiguration configuration, String mode) throws CoreException { + final IVMRunner runner = super.getVMRunner(configuration, mode); + + return new IVMRunner() { + public void run(VMRunnerConfiguration runnerConfiguration, ILaunch launch, IProgressMonitor monitor) + throws CoreException { + runner.run(runnerConfiguration, launch, monitor); + + IProcess[] processes = launch.getProcesses(); + if(processes!=null && processes.length>0) { + BackgroundResourceRefresher refresher = new BackgroundResourceRefresher(configuration, launch); + refresher.init(); + } else { + removeTempFiles(launch); + } + } + }; + } + + public String getMainTypeName(ILaunchConfiguration configuration) throws CoreException { + return runtime.getVersion().startsWith("3.0")? LAUNCHER_TYPE3: LAUNCHER_TYPE; //$NON-NLS-1$ + } + + public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException { + List<String> cp = m2conf.getRealmEntries(IMavenLauncherConfiguration.LAUNCHER_REALM); + return cp.toArray(new String[cp.size()]); + } + + public String getProgramArguments(ILaunchConfiguration configuration) throws CoreException { + return getProperties(configuration) + // + getPreferences(configuration) + " " + // //$NON-NLS-1$ + getGoals(configuration); + } + + public String getVMArguments(ILaunchConfiguration configuration) throws CoreException { + /* + * <pre> + * %MAVEN_JAVA_EXE% %MAVEN_OPTS% + * -classpath %CLASSWORLDS_JAR% + * "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" + * "-Dmaven.home=%M2_HOME%" + * org.codehaus.classworlds.Launcher + * %MAVEN_CMD_LINE_ARGS% + * </pre> + */ + + StringBuffer sb = new StringBuffer(); + + // workspace artifact resolution + if (shouldResolveWorkspaceArtifacts(configuration)) { + File state = MavenPlugin.getDefault().getMavenProjectManager().getWorkspaceStateFile(); + sb.append("-Dm2eclipse.workspace.state=").append(quote(state.getAbsolutePath())); //$NON-NLS-1$ + } + + // maven.home + String location = runtime.getLocation(); + if (location != null) { + sb.append(" -Dmaven.home=").append(quote(location)); //$NON-NLS-1$ + } + + // m2.conf + sb.append(" -Dclassworlds.conf=").append(quote(confFile.getAbsolutePath())); //$NON-NLS-1$ + + // user configured entries + sb.append(" ").append(super.getVMArguments(configuration)); //$NON-NLS-1$ + + return sb.toString(); + } + + private String quote(String string) { + return string.indexOf(' ') > -1 ? "\"" + string + "\"" : string; //$NON-NLS-1$ //$NON-NLS-2$ + } + + private boolean shouldResolveWorkspaceArtifacts(ILaunchConfiguration configuration) throws CoreException { + return configuration.getAttribute(ATTR_WORKSPACE_RESOLUTION, false); + } + + protected String getGoals(ILaunchConfiguration configuration) throws CoreException { + return configuration.getAttribute(MavenLaunchConstants.ATTR_GOALS, ""); //$NON-NLS-1$ + } + + public boolean buildForLaunch(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) { + return false; + } + + /** + * Construct string with properties to pass to JVM as system properties + */ + private String getProperties(ILaunchConfiguration configuration) { + StringBuffer sb = new StringBuffer(); + + try { + @SuppressWarnings("unchecked") + List<String> properties = configuration.getAttribute(ATTR_PROPERTIES, Collections.EMPTY_LIST); + for(String property : properties) { + int n = property.indexOf('='); + String name = property; + String value = null; + + if(n > -1) { + name = property.substring(0, n); + if(n > 1) { + value = Util.substituteVar(property.substring(n + 1)); + } + } + + sb.append(" -D").append(name); //$NON-NLS-1$ + if(value != null) { + sb.append('=').append(quote(value)); + } + } + } catch(CoreException e) { + String msg = "Exception while getting configuration attribute " + ATTR_PROPERTIES; + MavenLogger.log(msg, e); + } + + try { + String profiles = configuration.getAttribute(ATTR_PROFILES, (String) null); + if(profiles != null && profiles.trim().length() > 0) { + sb.append(" -P").append(profiles.replaceAll("\\s+", ",")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } catch(CoreException ex) { + String msg = "Exception while getting configuration attribute " + ATTR_PROFILES; + MavenLogger.log(msg, ex); + } + + return sb.toString(); + } + + /** + * Construct string with preferences to pass to JVM as system properties + */ + private String getPreferences(ILaunchConfiguration configuration) throws CoreException { + IMavenConfiguration mavenConfiguration = MavenPlugin.getDefault().getMavenConfiguration(); + + StringBuffer sb = new StringBuffer(); + + sb.append(" -B"); //$NON-NLS-1$ + + if(configuration.getAttribute(MavenLaunchConstants.ATTR_DEBUG_OUTPUT, mavenConfiguration.isDebugOutput())) { + sb.append(" -X").append(" -e"); //$NON-NLS-1$ //$NON-NLS-2$ + } + // sb.append(" -D").append(MavenPreferenceConstants.P_DEBUG_OUTPUT).append("=").append(debugOutput); + + if(configuration.getAttribute(MavenLaunchConstants.ATTR_OFFLINE, mavenConfiguration.isOffline())) { + sb.append(" -o"); //$NON-NLS-1$ + } + // sb.append(" -D").append(MavenPreferenceConstants.P_OFFLINE).append("=").append(offline); + + if(configuration.getAttribute(MavenLaunchConstants.ATTR_UPDATE_SNAPSHOTS, false)) { + sb.append(" -U"); //$NON-NLS-1$ + } + + if(configuration.getAttribute(MavenLaunchConstants.ATTR_NON_RECURSIVE, false)) { + sb.append(" -N"); //$NON-NLS-1$ + } + + if(configuration.getAttribute(MavenLaunchConstants.ATTR_SKIP_TESTS, false)) { + sb.append(" -Dmaven.test.skip=true"); //$NON-NLS-1$ + } + + String settings = configuration.getAttribute(MavenLaunchConstants.ATTR_USER_SETTINGS, (String) null); + if(settings == null || settings.trim().length() <= 0) { + settings = mavenConfiguration.getUserSettingsFile(); + if(settings != null && settings.trim().length() > 0 && !new File(settings.trim()).exists()) { + settings = null; + } + } + if(settings != null && settings.trim().length() > 0) { + sb.append(" -s ").append(quote(settings)); //$NON-NLS-1$ + } + + // boolean b = preferenceStore.getBoolean(MavenPreferenceConstants.P_CHECK_LATEST_PLUGIN_VERSION); + // sb.append(" -D").append(MavenPreferenceConstants.P_CHECK_LATEST_PLUGIN_VERSION).append("=").append(b); + + // b = preferenceStore.getBoolean(MavenPreferenceConstants.P_UPDATE_SNAPSHOTS); + // sb.append(" -D").append(MavenPreferenceConstants.P_UPDATE_SNAPSHOTS).append("=").append(b); + + // String s = preferenceStore.getString(MavenPreferenceConstants.P_GLOBAL_CHECKSUM_POLICY); + // if(s != null && s.trim().length() > 0) { + // sb.append(" -D").append(MavenPreferenceConstants.P_GLOBAL_CHECKSUM_POLICY).append("=").append(s); + // } + + return sb.toString(); + } + + static void removeTempFiles(ILaunch launch) { + String m2confName = launch.getAttribute(LAUNCH_M2CONF_FILE); + if (m2confName != null) { + new File(m2confName).delete(); + } + } + + /** + * Refreshes resources as specified by a launch configuration, when + * an associated process terminates. + * + * Adapted from org.eclipse.ui.externaltools.internal.program.launchConfigurations.BackgroundResourceRefresher + */ + public static class BackgroundResourceRefresher implements IDebugEventSetListener { + final ILaunchConfiguration configuration; + final IProcess process; + final ILaunch launch; + + public BackgroundResourceRefresher(ILaunchConfiguration configuration, ILaunch launch) { + this.configuration = configuration; + this.process = launch.getProcesses()[0]; + this.launch = launch; + } + + /** + * If the process has already terminated, resource refreshing is done + * immediately in the current thread. Otherwise, refreshing is done when the + * process terminates. + */ + public void init() { + synchronized (process) { + if (process.isTerminated()) { + processResources(); + } else { + DebugPlugin.getDefault().addDebugEventListener(this); + } + } + } + + /* (non-Javadoc) + * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) + */ + public void handleDebugEvents(DebugEvent[] events) { + for (int i = 0; i < events.length; i++) { + DebugEvent event = events[i]; + if (event.getSource() == process && event.getKind() == DebugEvent.TERMINATE) { + DebugPlugin.getDefault().removeDebugEventListener(this); + processResources(); + break; + } + } + } + + protected void processResources() { + removeTempFiles(launch); + + Job job = new Job(Messages.MavenLaunchDelegate_job_name) { + public IStatus run(IProgressMonitor monitor) { + try { + RefreshTab.refreshResources(configuration, monitor); + return Status.OK_STATUS; + } catch (CoreException e) { + MavenLogger.log(e); + return e.getStatus(); + } + } + }; + job.schedule(); + } + } + + +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java new file mode 100644 index 00000000..17fb637e --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchPlugin.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import org.eclipse.core.runtime.Plugin; + +public class MavenLaunchPlugin extends Plugin { + + private static MavenLaunchPlugin instance; + + public MavenLaunchPlugin() { + instance = this; + } + + public static MavenLaunchPlugin getDefault() { + return instance; + } +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java new file mode 100644 index 00000000..6b8e5532 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLaunchUtils.java @@ -0,0 +1,112 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import java.io.File; +import java.net.URI; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.m2e.actions.MavenLaunchConstants; +import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.core.IMavenConstants; +import org.eclipse.m2e.core.core.MavenLogger; +import org.eclipse.m2e.core.embedder.IMaven; +import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration; +import org.eclipse.m2e.core.embedder.MavenRuntime; +import org.eclipse.m2e.core.embedder.MavenRuntimeManager; +import org.eclipse.m2e.core.project.IMavenProjectFacade; +import org.eclipse.m2e.core.project.MavenProjectManager; +import org.eclipse.osgi.util.NLS; + +import com.ibm.icu.util.StringTokenizer; + +/** + * MavenLaunchUtils + * + * @author Igor Fedorenko + */ +public class MavenLaunchUtils { + + public static MavenRuntime getMavenRuntime(ILaunchConfiguration configuration) throws CoreException { + MavenRuntimeManager runtimeManager = MavenPlugin.getDefault().getMavenRuntimeManager(); + String location = configuration.getAttribute(MavenLaunchConstants.ATTR_RUNTIME, ""); //$NON-NLS-1$ + MavenRuntime runtime = runtimeManager.getRuntime(location); + if(runtime == null) { + throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, // + NLS.bind(Messages.MavenLaunchUtils_error_no_maven_install, location), null)); + } + return runtime; + } + + public static String getCliResolver(MavenRuntime runtime) throws CoreException { + String jarname; + String runtimeVersion = runtime.getVersion(); + if (runtimeVersion.startsWith("3.")) { //$NON-NLS-1$ + jarname = "org.eclipse.m2e.cliresolver30.jar"; //$NON-NLS-1$ + } else { + jarname = "org.eclipse.m2e.cliresolver.jar"; //$NON-NLS-1$ + } + URL url = MavenLaunchPlugin.getDefault().getBundle().getEntry(jarname); + try { + URL fileURL = FileLocator.toFileURL(url); + // MNGECLIPSE-804 workaround for spaces in the original path + URI fileURI = new URI(fileURL.getProtocol(), fileURL.getHost(), fileURL.getPath(), fileURL.getQuery()); + return new File(fileURI).getCanonicalPath(); + } catch(Exception ex) { + throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, -1, ex.getMessage(), ex)); + } + } + + public static void addUserComponents(ILaunchConfiguration configuration, IMavenLauncherConfiguration collector) + throws CoreException { + @SuppressWarnings("unchecked") + List<String> list = configuration.getAttribute(MavenLaunchConstants.ATTR_FORCED_COMPONENTS_LIST, new ArrayList()); + if(list == null) { + return; + } + + MavenProjectManager projectManager = MavenPlugin.getDefault().getMavenProjectManager(); + IMaven maven = MavenPlugin.getDefault().getMaven(); + for(String gav : list) { + // groupId:artifactId:version + StringTokenizer st = new StringTokenizer(gav, ":"); //$NON-NLS-1$ + String groupId = st.nextToken(); + String artifactId = st.nextToken(); + String version = st.nextToken(); + + IMavenProjectFacade facade = projectManager.getMavenProject(groupId, artifactId, version); + + if(facade != null) { + collector.addProjectEntry(facade); + } else { + String name = groupId + ":" + artifactId + ":" + version; //$NON-NLS-1$ //$NON-NLS-2$ + try { + Artifact artifact = maven.resolve(groupId, artifactId, version, "jar", null, null, null); //$NON-NLS-1$ + File file = artifact.getFile(); + if(file != null) { + collector.addArchiveEntry(file.getAbsolutePath()); + } + } catch(CoreException ex) { + MavenLogger.log("Artifact not found " + name, ex); + } + } + } + } +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java new file mode 100644 index 00000000..2bc6b171 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenLauncherConfigurationHandler.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration; +import org.eclipse.m2e.core.project.IMavenProjectFacade; +import org.eclipse.osgi.util.NLS; + +/** + * MavenLauncherConfigurationHandler + * + * @author Igor Fedorenko + */ +public class MavenLauncherConfigurationHandler implements IMavenLauncherConfiguration { + + private String mainType; + private String mainRealm; + private LinkedHashMap<String, List<String>> realms = new LinkedHashMap<String, List<String>>(); + private List<String> forcedEntries = new ArrayList<String>(); + private List<String> curEntries = forcedEntries; + + public void addArchiveEntry(String entry) { + curEntries.add(entry); + } + + public void addProjectEntry(IMavenProjectFacade facade) { + final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFolder output = root.getFolder(facade.getOutputLocation()); + if (output.isAccessible()) { + addArchiveEntry(output.getLocation().toFile().getAbsolutePath()); + } + } + + public void addRealm(String realm) { + if (!realms.containsKey(realm)) { + curEntries = new ArrayList<String>(); + realms.put(realm, curEntries); + } + } + + public void setMainType(String type, String realm) { + this.mainType = type; + this.mainRealm = realm; + } + + public void save(OutputStream os) throws IOException { + BufferedWriter out = new BufferedWriter(new OutputStreamWriter(os, "UTF-8")); //$NON-NLS-1$ + out.write(NLS.bind("main is {0} from {1}\n", mainType, mainRealm)); + for (Map.Entry<String, List<String>> realm : realms.entrySet()) { + if (LAUNCHER_REALM.equals(realm.getKey())) { + continue; + } + out.write(NLS.bind("[{0}]\n", realm.getKey())); + if (mainRealm.equals(realm.getKey())) { + for (String entry : forcedEntries) { + out.write(NLS.bind("load {0}\n", entry)); + } + } + for (String entry : realm.getValue()) { + out.write(NLS.bind("load {0}\n", entry)); + } + } + out.flush(); + } + + public String getMainReal() { + return mainRealm; + } + + public List<String> getRealmEntries(String realm) { + return realms.get(realm); + } +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourceLocator.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourceLocator.java new file mode 100644 index 00000000..581e969e --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourceLocator.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector; +import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant; +import org.eclipse.jdt.launching.sourcelookup.containers.JavaSourceLookupParticipant; + +/** + * @author Eugene Kuleshov + */ +public class MavenSourceLocator extends AbstractSourceLookupDirector { + + public void initializeParticipants() { + addParticipants(new ISourceLookupParticipant[] {new JavaSourceLookupParticipant()}); + } + +} + diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java new file mode 100644 index 00000000..bb317e82 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/MavenSourcePathComputer.java @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.internal.launch; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Properties; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; + +import org.apache.maven.artifact.Artifact; +import org.codehaus.plexus.util.DirectoryScanner; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.sourcelookup.ISourceContainer; +import org.eclipse.debug.core.sourcelookup.ISourcePathComputer; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.launching.IRuntimeClasspathEntry; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.embedder.IMaven; +import org.eclipse.m2e.core.embedder.IMavenLauncherConfiguration; +import org.eclipse.m2e.core.embedder.MavenRuntime; +import org.eclipse.m2e.core.project.IMavenProjectFacade; + + +/** + * Computes Maven launch configuration default source lookup path. + * + * Default source lookup includes Maven core libraries only. + * It does not (and cannot) include entries for any Maven plugins + * which are loaded dynamically at runtime. + * + * @author Eugene Kuleshov + */ +public class MavenSourcePathComputer implements ISourcePathComputer { + + public MavenSourcePathComputer() { + } + + public String getId() { + return "org.eclipse.m2e.launching.MavenSourceComputer"; //$NON-NLS-1$ + } + + public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) + throws CoreException { + final List<IRuntimeClasspathEntry> entries = new ArrayList<IRuntimeClasspathEntry>(); + + IRuntimeClasspathEntry jreEntry = JavaRuntime.computeJREEntry(configuration); + if(jreEntry != null) { + entries.add(jreEntry); + } + + MavenRuntime runtime = MavenLaunchUtils.getMavenRuntime(configuration); + IMavenLauncherConfiguration collector = new IMavenLauncherConfiguration() { + public void addArchiveEntry(String entry) throws CoreException { + addArchiveRuntimeClasspathEntry(entries, entry); + } + public void addProjectEntry(IMavenProjectFacade facade) { + IJavaProject javaProject = JavaCore.create(facade.getProject()); + if(javaProject != null) { + entries.add(JavaRuntime.newDefaultProjectClasspathEntry(javaProject)); + } + } + public void addRealm(String world) { + } + public void setMainType(String type, String world) { + } + }; + + collector.addArchiveEntry(MavenLaunchUtils.getCliResolver(runtime)); + MavenLaunchUtils.addUserComponents(configuration, collector); + runtime.createLauncherConfiguration(collector, monitor); + + IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath( // + entries.toArray(new IRuntimeClasspathEntry[entries.size()]), configuration); + return JavaRuntime.getSourceContainers(resolved); + } + + protected void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath) throws CoreException { + File entryFile = new File(entryPath); + + if (!entryFile.exists()) { + return; + } + + if (entryFile.isDirectory()) { + DirectoryScanner ds = new DirectoryScanner(); + ds.setBasedir(entryFile); + ds.setIncludes(new String[] { + "META-INF/maven/*/*/pom.properties", //$NON-NLS-1$ + }); + ds.scan(); + String[] files = ds.getIncludedFiles(); + for (String file : files) { + try { + BufferedInputStream is = new BufferedInputStream(new FileInputStream(new File(entryFile, file))); + try { + addArchiveRuntimeClasspathEntry(entries, entryPath, is); + } finally { + is.close(); + } + } catch (IOException e) { + // ignore it + } + + } + } else { + try { + JarFile jar = new JarFile(entryFile); + try { + Enumeration<JarEntry> zes = jar.entries(); + while (zes.hasMoreElements()) { + JarEntry ze = zes.nextElement(); + String name = ze.getName(); + if (!ze.isDirectory() && name.startsWith("META-INF/maven/") && name.endsWith("pom.properties")) { //$NON-NLS-1$ //$NON-NLS-2$ + addArchiveRuntimeClasspathEntry(entries, entryPath, jar.getInputStream(ze)); + } + } + } finally { + jar.close(); + } + } catch (IOException e) { + // ignore it + } + } + + } + + private void addArchiveRuntimeClasspathEntry(List<IRuntimeClasspathEntry> entries, String entryPath, InputStream is) throws IOException, CoreException { + Properties p = new Properties(); + p.load(is); + + String groupId = p.getProperty("groupId"); //$NON-NLS-1$ + String artifactId = p.getProperty("artifactId"); //$NON-NLS-1$ + String version = p.getProperty("version"); //$NON-NLS-1$ + + File sourcesJar = getSourcesJar(groupId, artifactId, version); + if (sourcesJar != null) { + IRuntimeClasspathEntry entry = null; + entry = JavaRuntime.newArchiveRuntimeClasspathEntry(Path.fromOSString(entryPath)); + entry.setSourceAttachmentPath(Path.fromOSString(sourcesJar.getAbsolutePath())); + entries.add(entry); + } + } + + private File getSourcesJar(String groupId, String artifactId, String version) { + if (groupId != null && artifactId != null && version != null) { + IMaven maven = MavenPlugin.getDefault().getMaven(); + + try { + Artifact artifact = maven.resolve(groupId, artifactId, version, "jar", "sources", null, null); //$NON-NLS-1$ //$NON-NLS-2$ + File file = artifact.getFile(); + + if (file != null && file.exists() && file.canRead()) { + return file; + } + } catch(CoreException ex) { + // artifact not found, most likely... + // TODO add special status code so it is possible to know for sure + } + } + + return null; + } + +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java new file mode 100644 index 00000000..0aac3eab --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/Messages.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + + +package org.eclipse.m2e.internal.launch; + +import org.eclipse.osgi.util.NLS; + + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.m2e.internal.launch.messages"; //$NON-NLS-1$ + + public static String ExecutePomAction_dialog_debug_message; + + public static String ExecutePomAction_dialog_run_message; + + public static String ExecutePomAction_dialog_title; + + public static String ExecutePomAction_executing; + + public static String MavenFileEditorInput_0; + + public static String MavenLaunchDelegate_error_cannot_create_conf; + + public static String MavenLaunchDelegate_job_name; + + public static String MavenLaunchMainTab_btnAfterClean; + + public static String MavenLaunchMainTab_btnAutoBuild; + + public static String MavenLaunchMainTab_btnCleanBuild; + + public static String MavenLaunchMainTab_btnConfigure; + + public static String MavenLaunchMainTab_btnDebugOutput; + + public static String MavenLaunchMainTab_btnManualBuild; + + public static String MavenLaunchMainTab_btnNotRecursive; + + public static String MavenLaunchMainTab_btnOffline; + + public static String MavenLaunchMainTab_btnResolveWorkspace; + + public static String MavenLaunchMainTab_btnSkipTests; + + public static String MavenLaunchMainTab_btnUpdateSnapshots; + + public static String MavenLaunchMainTab_lblAfterClean; + + public static String MavenLaunchMainTab_lblAutoBuildGoals; + + public static String MavenLaunchMainTab_lblCleanBuild; + + public static String MavenLaunchMainTab_lblManualGoals; + + public static String MavenLaunchMainTab_lblRuntime; + + public static String MavenLaunchMainTab_property_dialog_edit_title; + + public static String MavenLaunchMainTab_property_dialog_title; + + public static String MavenLaunchUtils_error_no_maven_install; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties new file mode 100644 index 00000000..dfa50c7a --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/internal/launch/messages.properties @@ -0,0 +1,26 @@ +ExecutePomAction_dialog_debug_message=Select a launch configuration to debug: +ExecutePomAction_dialog_run_message=Select a launch configuration to run: +ExecutePomAction_dialog_title=Select Configuration +ExecutePomAction_executing=Executing {0} in {1} +MavenFileEditorInput_0=Unable to open {0} +MavenLaunchDelegate_error_cannot_create_conf=Can't create m2.conf +MavenLaunchDelegate_job_name=Refreshing resources... +MavenLaunchMainTab_btnAfterClean=Selec&t... +MavenLaunchMainTab_btnAutoBuild=&Select... +MavenLaunchMainTab_btnCleanBuild=Se&lect... +MavenLaunchMainTab_btnConfigure=Configure... +MavenLaunchMainTab_btnDebugOutput=Debu&g Output +MavenLaunchMainTab_btnManualBuild=S&elect... +MavenLaunchMainTab_btnNotRecursive=Non-recursive +MavenLaunchMainTab_btnOffline=&Offline +MavenLaunchMainTab_btnResolveWorkspace=Resolve Workspace artifacts +MavenLaunchMainTab_btnSkipTests=S&kip Tests +MavenLaunchMainTab_btnUpdateSnapshots=&Update Snapshots +MavenLaunchMainTab_lblAfterClean=A&fter a Clean Goals: +MavenLaunchMainTab_lblAutoBuildGoals=Auto &Build Goals: +MavenLaunchMainTab_lblCleanBuild=&During a Clean Goals: +MavenLaunchMainTab_lblManualGoals=Ma&nual Build Goals: +MavenLaunchMainTab_lblRuntime=Maven Runt&ime: +MavenLaunchMainTab_property_dialog_edit_title=Edit Parameter +MavenLaunchMainTab_property_dialog_title=Add Parameter +MavenLaunchUtils_error_no_maven_install=Can't find Maven installation {0} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenBuilderConfigurationTabGroup.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenBuilderConfigurationTabGroup.java new file mode 100644 index 00000000..19e24ce9 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenBuilderConfigurationTabGroup.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.ui.internal.launch; + +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.CommonTab; +import org.eclipse.debug.ui.EnvironmentTab; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.RefreshTab; + +public class MavenBuilderConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup { + + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { + new MavenLaunchMainTab(true), + new MavenJRETab(), + new RefreshTab(), + new EnvironmentTab(), + new CommonTab()}; + setTabs(tabs); + } + +} + diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenJRETab.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenJRETab.java new file mode 100644 index 00000000..8c3022ae --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenJRETab.java @@ -0,0 +1,147 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.ui.internal.launch; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab; +import org.eclipse.jdt.internal.debug.ui.launcher.VMArgumentsBlock; +import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.JavaRuntime; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; + + +@SuppressWarnings("restriction") +public class MavenJRETab extends JavaJRETab { + + private VMArgumentsBlock vmArgumentsBlock = new VMArgumentsBlock(); + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) + */ + public void createControl(Composite parent) { + super.createControl(parent); + + Composite comp = (Composite) fJREBlock.getControl(); + ((GridData) comp.getLayoutData()).grabExcessVerticalSpace = true; + ((GridData) comp.getLayoutData()).verticalAlignment = SWT.FILL; + + vmArgumentsBlock.createControl(comp); + ((GridData) vmArgumentsBlock.getControl().getLayoutData()).horizontalSpan = 2; + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) + */ + public void performApply(ILaunchConfigurationWorkingCopy configuration) { + super.performApply(configuration); + vmArgumentsBlock.performApply(configuration); + setLaunchConfigurationWorkingCopy(configuration); + } + +// private boolean useDefaultSeparateJRE(ILaunchConfigurationWorkingCopy configuration) { +// boolean deflt = false; +// String vmInstallType = null; +// String jreContainerPath = null; +// try { +// vmInstallType = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String) null); +// jreContainerPath = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, +// (String) null); +// } catch(CoreException e) { +// } +// if(vmInstallType != null) { +// configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String) null); +// } +// if(jreContainerPath != null) { +// configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String) null); +// } +// IVMInstall defaultVMInstall = getDefaultVMInstall(configuration); +// if(defaultVMInstall != null) { +// IVMInstall vm = fJREBlock.getJRE(); +// deflt = defaultVMInstall.equals(vm); +// } +// +// if(vmInstallType != null) { +// configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, vmInstallType); +// } +// if(jreContainerPath != null) { +// configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, jreContainerPath); +// } +// return deflt; +// } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) + */ + public void initializeFrom(ILaunchConfiguration configuration) { + super.initializeFrom(configuration); + vmArgumentsBlock.initializeFrom(configuration); + // fVMArgumentsBlock.setEnabled(!fJREBlock.isDefaultJRE()); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setLaunchConfigurationDialog(org.eclipse.debug.ui.ILaunchConfigurationDialog) + */ + public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) { + super.setLaunchConfigurationDialog(dialog); + vmArgumentsBlock.setLaunchConfigurationDialog(dialog); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) + */ + public void activated(ILaunchConfigurationWorkingCopy workingCopy) { + setLaunchConfigurationWorkingCopy(workingCopy); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) + */ + public void setDefaults(ILaunchConfigurationWorkingCopy config) { + super.setDefaults(config); + IVMInstall defaultVMInstall = getDefaultVMInstall(config); + if(defaultVMInstall != null) { + setDefaultVMInstallAttributes(defaultVMInstall, config); + } + + } + + private IVMInstall getDefaultVMInstall(ILaunchConfiguration config) { + IVMInstall defaultVMInstall; + try { + defaultVMInstall = JavaRuntime.computeVMInstall(config); + } catch(CoreException e) { + //core exception thrown for non-Java project + defaultVMInstall = JavaRuntime.getDefaultVMInstall(); + } + return defaultVMInstall; + } + + @SuppressWarnings("deprecation") + private void setDefaultVMInstallAttributes(IVMInstall defaultVMInstall, ILaunchConfigurationWorkingCopy config) { + String vmName = defaultVMInstall.getName(); + String vmTypeID = defaultVMInstall.getVMInstallType().getId(); + config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, vmName); + config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, vmTypeID); + } + + /* (non-Javadoc) + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) + */ + public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { + } +} diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java new file mode 100644 index 00000000..0326c590 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchConfigurationTabGroup.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.ui.internal.launch; + +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.CommonTab; +import org.eclipse.debug.ui.EnvironmentTab; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; +import org.eclipse.debug.ui.RefreshTab; + +public class MavenLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup { + + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] { + new MavenLaunchMainTab(false), + new MavenJRETab(), + new RefreshTab(), + new EnvironmentTab(), + new CommonTab()}; + setTabs(tabs); + } + +} + diff --git a/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java new file mode 100644 index 00000000..697cdaa7 --- /dev/null +++ b/org.eclipse.m2e.launching/src/org/eclipse/m2e/ui/internal/launch/MavenLaunchMainTab.java @@ -0,0 +1,785 @@ +/******************************************************************************* + * Copyright (c) 2008-2010 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ + +package org.eclipse.m2e.ui.internal.launch; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.variables.VariablesPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; +import org.eclipse.debug.ui.StringVariableSelectionDialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.m2e.actions.MavenLaunchConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +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; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.ContainerSelectionDialog; +import org.eclipse.ui.dialogs.PreferencesUtil; +import org.eclipse.ui.externaltools.internal.model.IExternalToolConstants; +import org.eclipse.m2e.core.MavenImages; +import org.eclipse.m2e.core.MavenPlugin; +import org.eclipse.m2e.core.core.MavenLogger; +import org.eclipse.m2e.core.core.Messages; +import org.eclipse.m2e.core.embedder.IMavenConfiguration; +import org.eclipse.m2e.core.embedder.MavenRuntime; +import org.eclipse.m2e.core.embedder.MavenRuntimeManager; +import org.eclipse.m2e.core.ui.dialogs.MavenGoalSelectionDialog; +import org.eclipse.m2e.core.ui.dialogs.MavenPropertyDialog; +import org.eclipse.m2e.core.util.Util; + + +/** + * Maven Launch dialog Main tab + * + * @author Dmitri Maximovich + * @author Eugene Kuleshov + */ +@SuppressWarnings("restriction") +public class MavenLaunchMainTab extends AbstractLaunchConfigurationTab implements MavenLaunchConstants { + + public static final String ID_EXTERNAL_TOOLS_LAUNCH_GROUP = "org.eclipse.ui.externaltools.launchGroup"; //$NON-NLS-1$ + + private final boolean isBuilder; + + protected Text pomDirNameText; + + protected Text goalsText; + protected Text goalsAutoBuildText; + protected Text goalsManualBuildText; + protected Text goalsCleanText; + protected Text goalsAfterCleanText; + + protected Text profilesText; + protected Table propsTable; + + private Button offlineButton; + + private Button updateSnapshotsButton; + + private Button debugOutputButton; + + private Button skipTestsButton; + + private Button nonRecursiveButton; + + private Button enableWorkspaceResolution; + + private Button removePropButton; + + private Button editPropButton; + + ComboViewer runtimeComboViewer; + + + public MavenLaunchMainTab(boolean isBuilder) { + this.isBuilder = isBuilder; + } + + public Image getImage() { + return MavenImages.IMG_LAUNCH_MAIN; + } + + public void createControl(Composite parent) { + Composite mainComposite = new Composite(parent, SWT.NONE); + setControl(mainComposite); + //PlatformUI.getWorkbench().getHelpSystem().setHelp(mainComposite, IAntUIHelpContextIds.ANT_MAIN_TAB); + GridLayout layout = new GridLayout(); + layout.numColumns = 5; + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + mainComposite.setLayout(layout); + mainComposite.setLayoutData(gridData); + mainComposite.setFont(parent.getFont()); + + class Listener implements ModifyListener, SelectionListener { + public void modifyText(ModifyEvent e) { + entriesChanged(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + entriesChanged(); + } + + public void widgetSelected(SelectionEvent e) { + entriesChanged(); + } + } + Listener modyfyingListener = new Listener(); + + Label label = new Label(mainComposite, SWT.NONE); + label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 5, 1)); + label.setText(Messages.getString("launch.pomGroup")); + + this.pomDirNameText = new Text(mainComposite, SWT.BORDER); + this.pomDirNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 5, 1)); + this.pomDirNameText.addModifyListener(modyfyingListener); + + final Composite pomDirButtonsComposite = new Composite(mainComposite, SWT.NONE); + pomDirButtonsComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 5, 1)); + final GridLayout pomDirButtonsGridLayout = new GridLayout(); + pomDirButtonsGridLayout.marginWidth = 0; + pomDirButtonsGridLayout.marginHeight = 0; + pomDirButtonsGridLayout.numColumns = 3; + pomDirButtonsComposite.setLayout(pomDirButtonsGridLayout); + + final Button browseWorkspaceButton = new Button(pomDirButtonsComposite, SWT.NONE); + browseWorkspaceButton.setText(Messages.getString("launch.browseWorkspace")); //$NON-NLS-1$ + browseWorkspaceButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), // + ResourcesPlugin.getWorkspace().getRoot(), false, Messages.getString("launch.choosePomDir")); //$NON-NLS-1$ + dialog.showClosedProjects(false); + + int buttonId = dialog.open(); + if(buttonId == IDialogConstants.OK_ID) { + Object[] resource = dialog.getResult(); + if(resource != null && resource.length > 0) { + String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression( + "workspace_loc", ((IPath) resource[0]).toString()); //$NON-NLS-1$ + pomDirNameText.setText(fileLoc); + entriesChanged(); + } + } + } + }); + + final Button browseFilesystemButton = new Button(pomDirButtonsComposite, SWT.NONE); + browseFilesystemButton.setText(Messages.getString("launch.browseFs")); //$NON-NLS-1$ + browseFilesystemButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); + dialog.setFilterPath(pomDirNameText.getText()); + String text = dialog.open(); + if(text != null) { + pomDirNameText.setText(text); + entriesChanged(); + } + } + }); + + final Button browseVariablesButton = new Button(pomDirButtonsComposite, SWT.NONE); + browseVariablesButton.setText(Messages.getString("launch.browseVariables")); //$NON-NLS-1$ + browseVariablesButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); + dialog.open(); + String variable = dialog.getVariableExpression(); + if(variable != null) { + pomDirNameText.insert(variable); + } + } + }); + + // pom file + + // goals + + if(isBuilder) { + Label autoBuildGoalsLabel = new Label(mainComposite, SWT.NONE); + GridData gd_autoBuildGoalsLabel = new GridData(); + gd_autoBuildGoalsLabel.verticalIndent = 7; + autoBuildGoalsLabel.setLayoutData(gd_autoBuildGoalsLabel); + autoBuildGoalsLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblAutoBuildGoals); + goalsAutoBuildText = new Text(mainComposite, SWT.BORDER); + GridData gd_goalsAutoBuildText = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1); + gd_goalsAutoBuildText.verticalIndent = 7; + goalsAutoBuildText.setLayoutData(gd_goalsAutoBuildText); + goalsAutoBuildText.addModifyListener(modyfyingListener); + goalsAutoBuildText.addFocusListener(new GoalsFocusListener(goalsAutoBuildText)); + Button goalsAutoBuildButton = new Button(mainComposite, SWT.NONE); + GridData gd_goalsAutoBuildButton = new GridData(SWT.FILL, SWT.CENTER, false, false); + gd_goalsAutoBuildButton.verticalIndent = 7; + goalsAutoBuildButton.setLayoutData(gd_goalsAutoBuildButton); + goalsAutoBuildButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnAutoBuild); + goalsAutoBuildButton.addSelectionListener(new GoalSelectionAdapter(goalsAutoBuildText)); + + Label manualBuildGoalsLabel = new Label(mainComposite, SWT.NONE); + manualBuildGoalsLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblManualGoals); + goalsManualBuildText = new Text(mainComposite, SWT.BORDER); + goalsManualBuildText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + goalsManualBuildText.addModifyListener(modyfyingListener); + goalsManualBuildText.addFocusListener(new GoalsFocusListener(goalsManualBuildText)); + Button goalsManualBuildButton = new Button(mainComposite, SWT.NONE); + goalsManualBuildButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); + goalsManualBuildButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnManualBuild); + goalsManualBuildButton.addSelectionListener(new GoalSelectionAdapter(goalsManualBuildText)); + + Label cleanBuildGoalsLabel = new Label(mainComposite, SWT.NONE); + cleanBuildGoalsLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblCleanBuild); + goalsCleanText = new Text(mainComposite, SWT.BORDER); + goalsCleanText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + goalsCleanText.addModifyListener(modyfyingListener); + goalsCleanText.addFocusListener(new GoalsFocusListener(goalsCleanText)); + Button goalsCleanButton = new Button(mainComposite, SWT.NONE); + goalsCleanButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); + goalsCleanButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnCleanBuild); + goalsCleanButton.addSelectionListener(new GoalSelectionAdapter(goalsCleanText)); + + Label afterCleanGoalsLabel = new Label(mainComposite, SWT.NONE); + afterCleanGoalsLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblAfterClean); + goalsAfterCleanText = new Text(mainComposite, SWT.BORDER); + goalsAfterCleanText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + goalsAfterCleanText.addModifyListener(modyfyingListener); + goalsAfterCleanText.addFocusListener(new GoalsFocusListener(goalsAfterCleanText)); + Button goalsAfterCleanButton = new Button(mainComposite, SWT.NONE); + goalsAfterCleanButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); + goalsAfterCleanButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnAfterClean); + goalsAfterCleanButton.addSelectionListener(new GoalSelectionAdapter(goalsAfterCleanText)); + + } else { + Label goalsLabel = new Label(mainComposite, SWT.NONE); + GridData gd_goalsLabel = new GridData(); + gd_goalsLabel.verticalIndent = 7; + goalsLabel.setLayoutData(gd_goalsLabel); + goalsLabel.setText(Messages.getString("launch.goalsLabel")); //$NON-NLS-1$ + goalsText = new Text(mainComposite, SWT.BORDER); + goalsText.setData("name", "goalsText"); //$NON-NLS-1$ //$NON-NLS-2$ + GridData gd_goalsText = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1); + gd_goalsText.verticalIndent = 7; + goalsText.setLayoutData(gd_goalsText); + goalsText.addModifyListener(modyfyingListener); + goalsText.addFocusListener(new GoalsFocusListener(goalsText)); + + Button selectGoalsButton = new Button(mainComposite, SWT.NONE); + GridData gd_selectGoalsButton = new GridData(SWT.FILL, SWT.CENTER, false, false); + gd_selectGoalsButton.verticalIndent = 7; + selectGoalsButton.setLayoutData(gd_selectGoalsButton); + selectGoalsButton.setText(Messages.getString("launch.goals")); //$NON-NLS-1$ + selectGoalsButton.addSelectionListener(new GoalSelectionAdapter(goalsText)); + } + + Label profilesLabel = new Label(mainComposite, SWT.NONE); + profilesLabel.setText(Messages.getString("launch.profilesLabel")); //$NON-NLS-1$ + // profilesLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false)); + + profilesText = new Text(mainComposite, SWT.BORDER); + profilesText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1)); + profilesText.addModifyListener(modyfyingListener); + new Label(mainComposite, SWT.NONE); + + offlineButton = new Button(mainComposite, SWT.CHECK); + offlineButton.setToolTipText("-o"); //$NON-NLS-1$ + GridData gd_offlineButton = new GridData(); + offlineButton.setLayoutData(gd_offlineButton); + offlineButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnOffline); + offlineButton.addSelectionListener(modyfyingListener); + + updateSnapshotsButton = new Button(mainComposite, SWT.CHECK); + updateSnapshotsButton.setToolTipText("-U"); //$NON-NLS-1$ + updateSnapshotsButton.addSelectionListener(modyfyingListener); + GridData gd_updateSnapshotsButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1); + gd_updateSnapshotsButton.horizontalIndent = 10; + updateSnapshotsButton.setLayoutData(gd_updateSnapshotsButton); + updateSnapshotsButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnUpdateSnapshots); + new Label(mainComposite, SWT.NONE); + + debugOutputButton = new Button(mainComposite, SWT.CHECK); + debugOutputButton.setToolTipText("-X -e"); //$NON-NLS-1$ + debugOutputButton.addSelectionListener(modyfyingListener); + debugOutputButton.setLayoutData(new GridData()); + debugOutputButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnDebugOutput); + + skipTestsButton = new Button(mainComposite, SWT.CHECK); + skipTestsButton.setToolTipText("-Dmaven.test.skip=true"); //$NON-NLS-1$ + skipTestsButton.addSelectionListener(modyfyingListener); + GridData gd_skipTestsButton = new GridData(); + gd_skipTestsButton.horizontalIndent = 10; + skipTestsButton.setLayoutData(gd_skipTestsButton); + skipTestsButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnSkipTests); + + nonRecursiveButton = new Button(mainComposite, SWT.CHECK); + GridData gd_nonrecursiveButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1); + gd_nonrecursiveButton.horizontalIndent = 10; + nonRecursiveButton.setLayoutData(gd_nonrecursiveButton); + nonRecursiveButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnNotRecursive); + nonRecursiveButton.setToolTipText("-N"); //$NON-NLS-1$ + nonRecursiveButton.setData("name", "nonRecursiveButton"); //$NON-NLS-1$ //$NON-NLS-2$ + nonRecursiveButton.addSelectionListener(modyfyingListener); + + new Label(mainComposite, SWT.NONE); + + enableWorkspaceResolution = new Button(mainComposite, SWT.CHECK); + enableWorkspaceResolution.addSelectionListener(modyfyingListener); + enableWorkspaceResolution.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1)); + enableWorkspaceResolution.setData("name", "enableWorkspaceResolution"); //$NON-NLS-1$ //$NON-NLS-2$ + enableWorkspaceResolution.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnResolveWorkspace); + + TableViewer tableViewer = new TableViewer(mainComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + TableItem[] selection = propsTable.getSelection(); + if(selection.length == 1) { + editProperty(selection[0].getText(0), selection[0].getText(1)); + } + } + }); + tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){ + + public void selectionChanged(SelectionChangedEvent event) { + TableItem[] items = propsTable.getSelection(); + if(items == null || items.length == 0){ + editPropButton.setEnabled(false); + removePropButton.setEnabled(false); + } else if(items.length == 1){ + editPropButton.setEnabled(true); + removePropButton.setEnabled(true); + } else { + editPropButton.setEnabled(false); + removePropButton.setEnabled(true); + } + } + + }); + + this.propsTable = tableViewer.getTable(); + //this.tProps.setItemCount(10); + this.propsTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 3)); + this.propsTable.setLinesVisible(true); + this.propsTable.setHeaderVisible(true); + + final TableColumn propColumn = new TableColumn(this.propsTable, SWT.NONE, 0); + propColumn.setWidth(120); + propColumn.setText(Messages.getString("launch.propName")); //$NON-NLS-1$ + + final TableColumn valueColumn = new TableColumn(this.propsTable, SWT.NONE, 1); + valueColumn.setWidth(200); + valueColumn.setText(Messages.getString("launch.propValue")); //$NON-NLS-1$ + + final Button addPropButton = new Button(mainComposite, SWT.NONE); + addPropButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); + addPropButton.setText(Messages.getString("launch.propAddButton")); //$NON-NLS-1$ + addPropButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + addProperty(); + } + }); + editPropButton = new Button(mainComposite, SWT.NONE); + editPropButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); + editPropButton.setText(Messages.getString("launch.propEditButton")); //$NON-NLS-1$ + editPropButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if(propsTable.getSelectionCount() > 0) { + TableItem[] selection = propsTable.getSelection(); + if(selection.length == 1) { + editProperty(selection[0].getText(0), selection[0].getText(1)); + } + } + } + }); + editPropButton.setEnabled(false); + removePropButton = new Button(mainComposite, SWT.NONE); + removePropButton.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false)); + removePropButton.setText(Messages.getString("launch.propRemoveButton")); //$NON-NLS-1$ + removePropButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if(propsTable.getSelectionCount() > 0) { + propsTable.remove(propsTable.getSelectionIndices()); + entriesChanged(); + } + } + }); + removePropButton.setEnabled(false); + + { + Composite composite = new Composite(mainComposite, SWT.NONE); + composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1)); + GridLayout gridLayout = new GridLayout(2, false); + gridLayout.marginWidth = 0; + gridLayout.marginHeight = 0; + composite.setLayout(gridLayout); + + Label mavenRuntimeLabel = new Label(composite, SWT.NONE); + mavenRuntimeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); + mavenRuntimeLabel.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_lblRuntime); + + runtimeComboViewer = new ComboViewer(composite, SWT.BORDER | SWT.READ_ONLY); + runtimeComboViewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + runtimeComboViewer.setContentProvider(new IStructuredContentProvider() { + + public Object[] getElements(Object input) { + return ((List<?>) input).toArray(); + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + public void dispose() { + } + + }); + + runtimeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + entriesChanged(); + } + }); + + MavenRuntimeManager runtimeManager = MavenPlugin.getDefault().getMavenRuntimeManager(); + runtimeComboViewer.setInput(runtimeManager.getMavenRuntimes()); + runtimeComboViewer.setSelection(new StructuredSelection(runtimeManager.getDefaultRuntime())); + } + + Button configureRuntimesButton = new Button(mainComposite, SWT.NONE); + GridData gd_configureRuntimesButton = new GridData(SWT.FILL, SWT.CENTER, false, false); + configureRuntimesButton.setLayoutData(gd_configureRuntimesButton); + configureRuntimesButton.setText(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_btnConfigure); + configureRuntimesButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PreferencesUtil.createPreferenceDialogOn(getShell(), + "org.eclipse.m2e.preferences.MavenInstallationsPreferencePage", null, null).open(); //$NON-NLS-1$ + MavenRuntimeManager runtimeManager = MavenPlugin.getDefault().getMavenRuntimeManager(); + runtimeComboViewer.setInput(runtimeManager.getMavenRuntimes()); + runtimeComboViewer.setSelection(new StructuredSelection(runtimeManager.getDefaultRuntime())); + } + }); + + if(isBuilder) { + goalsAutoBuildText.setFocus(); + } else { + goalsText.setFocus(); + } + } + + protected Shell getShell() { + return super.getShell(); + } + + void addProperty() { + MavenPropertyDialog dialog = getMavenPropertyDialog(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_property_dialog_title, "", ""); //$NON-NLS-2$ //$NON-NLS-3$ + if(dialog.open() == IDialogConstants.OK_ID) { + TableItem item = new TableItem(propsTable, SWT.NONE); + item.setText(0, dialog.getName()); + item.setText(1, dialog.getValue()); + entriesChanged(); + } + } + + void editProperty(String name, String value) { + MavenPropertyDialog dialog = getMavenPropertyDialog(org.eclipse.m2e.internal.launch.Messages.MavenLaunchMainTab_property_dialog_edit_title, name, value); + if(dialog.open() == IDialogConstants.OK_ID) { + TableItem[] item = propsTable.getSelection(); + item[0].setText(0, dialog.getName()); + item[0].setText(1, dialog.getValue()); + entriesChanged(); + } + } + + private MavenPropertyDialog getMavenPropertyDialog(String title, String initName, String initValue) { + return new MavenPropertyDialog(getShell(), title, initName, initValue, null) { + protected Control createDialogArea(Composite parent) { + Composite comp = (Composite) super.createDialogArea(parent); + + Button variablesButton = new Button(comp, SWT.PUSH); + GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END); + gd.horizontalSpan = 2; + gd.widthHint = Math.max(convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH), // + variablesButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); + variablesButton.setLayoutData(gd); + variablesButton.setFont(comp.getFont()); + variablesButton.setText(Messages.getString("launch.propertyDialog.browseVariables")); //$NON-NLS-1$; + + variablesButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent se) { + StringVariableSelectionDialog variablesDialog = new StringVariableSelectionDialog(getShell()); + if(variablesDialog.open() == IDialogConstants.OK_ID) { + String variable = variablesDialog.getVariableExpression(); + if(variable != null) { + valueText.insert(variable.trim()); + } + } + } + }); + + return comp; + } + }; + } + + public void initializeFrom(ILaunchConfiguration configuration) { + String pomDirName = getAttribute(configuration, ATTR_POM_DIR, ""); //$NON-NLS-1$ + if(isBuilder && pomDirName.length()==0) { + pomDirName = "${workspace_loc:/" + configuration.getFile().getProject().getName() + "}"; //$NON-NLS-1$ //$NON-NLS-2$ + } + this.pomDirNameText.setText(pomDirName); + + if(isBuilder) { + this.goalsAutoBuildText.setText(getAttribute(configuration, ATTR_GOALS_AUTO_BUILD, "install")); //$NON-NLS-1$ + this.goalsManualBuildText.setText(getAttribute(configuration, ATTR_GOALS_MANUAL_BUILD, "install")); //$NON-NLS-1$ + this.goalsCleanText.setText(getAttribute(configuration, ATTR_GOALS_CLEAN, "clean")); //$NON-NLS-1$ + this.goalsAfterCleanText.setText(getAttribute(configuration, ATTR_GOALS_AFTER_CLEAN, "install")); //$NON-NLS-1$ + } else { + this.goalsText.setText(getAttribute(configuration, ATTR_GOALS, "")); //$NON-NLS-1$ + } + + this.profilesText.setText(getAttribute(configuration, ATTR_PROFILES, "")); //$NON-NLS-1$ + try { + + MavenPlugin plugin = MavenPlugin.getDefault(); + MavenRuntimeManager runtimeManager = plugin.getMavenRuntimeManager(); + IMavenConfiguration mavenConfiguration = MavenPlugin.getDefault().getMavenConfiguration(); + + this.offlineButton.setSelection(getAttribute(configuration, ATTR_OFFLINE, mavenConfiguration.isOffline())); + this.debugOutputButton.setSelection(getAttribute(configuration, ATTR_DEBUG_OUTPUT, mavenConfiguration.isDebugOutput())); + + this.updateSnapshotsButton.setSelection(getAttribute(configuration, ATTR_UPDATE_SNAPSHOTS, false)); + this.skipTestsButton.setSelection(getAttribute(configuration, ATTR_SKIP_TESTS, false)); + this.nonRecursiveButton.setSelection(getAttribute(configuration, ATTR_NON_RECURSIVE, false)); + this.enableWorkspaceResolution.setSelection(getAttribute(configuration, ATTR_WORKSPACE_RESOLUTION, false)); + + String location = getAttribute(configuration, ATTR_RUNTIME, ""); //$NON-NLS-1$ + MavenRuntime runtime = runtimeManager.getRuntime(location); + if(runtime != null){ + this.runtimeComboViewer.setSelection(new StructuredSelection(runtime)); + } + propsTable.removeAll(); + + @SuppressWarnings("unchecked") + List<String> properties = configuration.getAttribute(ATTR_PROPERTIES, Collections.EMPTY_LIST); + for(String property : properties) { + int n = property.indexOf('='); + String name = property; + String value = ""; //$NON-NLS-1$ + if(n > -1) { + name = property.substring(0, n); + if(n > 1) { + value = property.substring(n + 1); + } + } + + TableItem item = new TableItem(propsTable, SWT.NONE); + item.setText(0, name); + item.setText(1, value); + } + } catch(CoreException ex) { + // XXX should we at least log something here? + } + setDirty(false); + } + + private String getAttribute(ILaunchConfiguration configuration, String name, String defaultValue) { + try { + return configuration.getAttribute(name, defaultValue); + } catch(CoreException ex) { + MavenLogger.log(ex); + return defaultValue; + } + } + + private boolean getAttribute(ILaunchConfiguration configuration, String name, boolean defaultValue) { + try { + return configuration.getAttribute(name, defaultValue); + } catch(CoreException ex) { + return defaultValue; + } + } + + public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { + } + + public void performApply(ILaunchConfigurationWorkingCopy configuration) { + configuration.setAttribute(ATTR_POM_DIR, this.pomDirNameText.getText()); + + if(isBuilder) { + configuration.setAttribute(ATTR_GOALS_AUTO_BUILD, goalsAutoBuildText.getText()); + configuration.setAttribute(ATTR_GOALS_MANUAL_BUILD, this.goalsManualBuildText.getText()); + configuration.setAttribute(ATTR_GOALS_CLEAN, this.goalsCleanText.getText()); + configuration.setAttribute(ATTR_GOALS_AFTER_CLEAN, this.goalsAfterCleanText.getText()); + + StringBuffer sb = new StringBuffer(); + if(goalsAfterCleanText.getText().trim().length()>0) { + sb.append(IExternalToolConstants.BUILD_TYPE_FULL).append(','); + } + if(goalsManualBuildText.getText().trim().length()>0) { + sb.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(','); + } + if(goalsAutoBuildText.getText().trim().length()>0) { + sb.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(','); + } + if(goalsCleanText.getText().trim().length()>0) { + sb.append(IExternalToolConstants.BUILD_TYPE_CLEAN); + } + configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, sb.toString()); + + } else { + configuration.setAttribute(ATTR_GOALS, this.goalsText.getText()); + } + + configuration.setAttribute(ATTR_PROFILES, this.profilesText.getText()); + + configuration.setAttribute(ATTR_OFFLINE, this.offlineButton.getSelection()); + configuration.setAttribute(ATTR_UPDATE_SNAPSHOTS, this.updateSnapshotsButton.getSelection()); + configuration.setAttribute(ATTR_SKIP_TESTS, this.skipTestsButton.getSelection()); + configuration.setAttribute(ATTR_NON_RECURSIVE, this.nonRecursiveButton.getSelection()); + configuration.setAttribute(ATTR_WORKSPACE_RESOLUTION, this.enableWorkspaceResolution.getSelection()); + configuration.setAttribute(ATTR_DEBUG_OUTPUT, this.debugOutputButton.getSelection()); + + IStructuredSelection selection = (IStructuredSelection) runtimeComboViewer.getSelection(); + MavenRuntime runtime = (MavenRuntime) selection.getFirstElement(); + configuration.setAttribute(ATTR_RUNTIME, runtime.getLocation()); + + // store as String in "param=value" format + List<String> properties = new ArrayList<String>(); + for(TableItem item : this.propsTable.getItems()) { + String p = item.getText(0); + String v = item.getText(1); + if(p != null && p.trim().length() > 0) { + String prop = p.trim() + "=" + (v == null ? "" : v); //$NON-NLS-1$ //$NON-NLS-2$ + properties.add(prop); + } + } + configuration.setAttribute(ATTR_PROPERTIES, properties); + } + + public String getName() { + return Messages.getString("launch.mainTabName"); //$NON-NLS-1$ + } + + public boolean isValid(ILaunchConfiguration launchConfig) { + setErrorMessage(null); + + String pomFileName = this.pomDirNameText.getText(); + if(pomFileName == null || pomFileName.trim().length() == 0) { + setErrorMessage(Messages.getString("launch.pomDirectoryEmpty")); + return false; + } + if(!isDirectoryExist(pomFileName)) { + setErrorMessage(Messages.getString("launch.pomDirectoryDoesntExist")); + return false; + } + return true; + } + + protected boolean isDirectoryExist(String name) { + if(name == null || name.trim().length() == 0) { + return false; + } + String dirName = Util.substituteVar(name); + if(dirName == null) { + return false; + } + File pomDir = new File(dirName); + if(!pomDir.exists()) { + return false; + } + if(!pomDir.isDirectory()) { + return false; + } + return true; + } + + void entriesChanged() { + setDirty(true); + updateLaunchConfigurationDialog(); + } + + + private static final class GoalsFocusListener extends FocusAdapter { + private Text text; + + public GoalsFocusListener(Text text) { + this.text = text; + } + + public void focusGained(FocusEvent e) { + super.focusGained(e); + text.setData("focus"); //$NON-NLS-1$ + } + } + + + private final class GoalSelectionAdapter extends SelectionAdapter { + private Text text; + + public GoalSelectionAdapter(Text text) { + this.text = text; + } + + public void widgetSelected(SelectionEvent e) { +// String fileName = Util.substituteVar(fPomDirName.getText()); +// if(!isDirectoryExist(fileName)) { +// MessageDialog.openError(getShell(), Messages.getString("launch.errorPomMissing"), +// Messages.getString("launch.errorSelectPom")); //$NON-NLS-1$ //$NON-NLS-2$ +// return; +// } + MavenGoalSelectionDialog dialog = new MavenGoalSelectionDialog(getShell()); + int rc = dialog.open(); + if(rc == IDialogConstants.OK_ID) { + text.insert(""); // clear selected text //$NON-NLS-1$ + + String txt = text.getText(); + int len = txt.length(); + int pos = text.getCaretPosition(); + + StringBuffer sb = new StringBuffer(); + if((pos > 0 && txt.charAt(pos - 1) != ' ')) { + sb.append(' '); + } + + String sep = ""; //$NON-NLS-1$ + Object[] o = dialog.getResult(); + for(int i = 0; i < o.length; i++ ) { + if(o[i] instanceof MavenGoalSelectionDialog.Entry) { + if(dialog.isQualifiedName()) { + sb.append(sep).append(((MavenGoalSelectionDialog.Entry) o[i]).getQualifiedName()); + } else { + sb.append(sep).append(((MavenGoalSelectionDialog.Entry) o[i]).getName()); + } + } + sep = " "; //$NON-NLS-1$ + } + + if(pos < len && txt.charAt(pos) != ' ') { + sb.append(' '); + } + + text.insert(sb.toString()); + text.setFocus(); + entriesChanged(); + } + } + } + +} |