diff options
author | Igor Fedorenko | 2013-01-01 04:21:03 +0000 |
---|---|---|
committer | Igor Fedorenko | 2013-01-01 04:21:03 +0000 |
commit | a8b5512972ebd9a273b8955fd1306e039428d400 (patch) | |
tree | f6cd368f8ee88082c81eb7087dcbe3bfed3997f6 /org.eclipse.m2e.jdt | |
parent | cf04c93473bf354448dd453877b688643d4d5cf9 (diff) | |
download | m2e-core-a8b5512972ebd9a273b8955fd1306e039428d400.tar.gz m2e-core-a8b5512972ebd9a273b8955fd1306e039428d400.tar.xz m2e-core-a8b5512972ebd9a273b8955fd1306e039428d400.zip |
Code format, organize imports
... also enabled automatic code format and organize imports on file
save, hopefully this will help us keep formatting consistent in the
future.
Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
Diffstat (limited to 'org.eclipse.m2e.jdt')
28 files changed, 473 insertions, 369 deletions
diff --git a/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.core.prefs index adf868eb..80d9c54b 100644 --- a/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,3 @@ -#Sat Jul 30 19:02:00 MSD 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.builder.duplicateResourceTask=warning @@ -16,6 +15,8 @@ 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.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= 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 @@ -27,7 +28,7 @@ org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=warning +org.eclipse.jdt.core.compiler.problem.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 @@ -93,7 +94,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled -org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore @@ -110,6 +111,7 @@ org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 @@ -120,15 +122,18 @@ org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=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.alignment_for_union_type_in_multicatch=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 @@ -164,10 +169,16 @@ 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.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true @@ -185,6 +196,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert @@ -251,12 +263,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invoca org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert @@ -280,6 +294,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invoc org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert @@ -335,6 +350,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invoc 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_try=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 @@ -344,6 +360,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=inser org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -353,6 +370,8 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=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 @@ -365,7 +384,10 @@ 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_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error diff --git a/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.ui.prefs index a09d06cb..595d9975 100644 --- a/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.ui.prefs +++ b/org.eclipse.m2e.jdt/.settings/org.eclipse.jdt.ui.prefs @@ -1,6 +1,7 @@ eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_m2 plugin -formatter_settings_version=11 +formatter_settings_version=12 org.eclipse.jdt.ui.exception.name=ex org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.ignorelowercasenames=true @@ -10,4 +11,56 @@ org.eclipse.jdt.ui.keywordthis=true org.eclipse.jdt.ui.ondemandthreshold=99 org.eclipse.jdt.ui.overrideannotation=false org.eclipse.jdt.ui.staticondemandthreshold=99 -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 Returns 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">/*******************************************************************************&\#13;\n * Copyright (c) 2010 Sonatype, Inc.&\#13;\n * All rights reserved. This program and the accompanying materials&\#13;\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\n * which accompanies this distribution, and is available at&\#13;\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\n *&\#13;\n * Contributors\:&\#13;\n * Sonatype, Inc. - initial API and implementation&\#13;\n *******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${type_name}\n *\n * @author ${user}\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\="false" 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\="false" 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\nMavenLogger.log(${exception_var});</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 ${enclosing_method}\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\="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\="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\="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\="false" 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\nMavenLogger.log(${exception_var});</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> +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 Returns 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">/*******************************************************************************&\#13;\n * Copyright (c) 2010 Sonatype, Inc.&\#13;\n * All rights reserved. This program and the accompanying materials&\#13;\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\n * which accompanies this distribution, and is available at&\#13;\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\n *&\#13;\n * Contributors\:&\#13;\n * Sonatype, Inc. - initial API and implementation&\#13;\n *******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * ${type_name}\n *\n * @author ${user}\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\="false" 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\="false" 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\nlog.error(${exception_var}.getMessage(), ${exception_var});</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 ${enclosing_method}\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\="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\="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\="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\="false" 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\nlog.error(${exception_var}.getMessage(), ${exception_var});</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> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/AbstractJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/AbstractJavaProjectConfigurator.java index 19ff406b..b0de1358 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/AbstractJavaProjectConfigurator.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/AbstractJavaProjectConfigurator.java @@ -10,77 +10,67 @@ package org.eclipse.m2e.jdt; import java.io.File; -import org.apache.maven.plugin.MojoExecution; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.JavaCore; + +import org.apache.maven.plugin.MojoExecution; + import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.project.MavenProjectUtils; import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator; import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; -public abstract class AbstractJavaProjectConfigurator - extends AbstractProjectConfigurator - implements IJavaProjectConfigurator -{ - @Override - public void configure( ProjectConfigurationRequest request, IProgressMonitor monitor ) - throws CoreException - { - // TODO Auto-generated method stub - } +public abstract class AbstractJavaProjectConfigurator extends AbstractProjectConfigurator implements + IJavaProjectConfigurator { + @Override + public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { + // TODO Auto-generated method stub - public void configureClasspath( IMavenProjectFacade facade, IClasspathDescriptor classpath, IProgressMonitor monitor ) - throws CoreException - { - // TODO Auto-generated method stub + } - } + public void configureClasspath(IMavenProjectFacade facade, IClasspathDescriptor classpath, IProgressMonitor monitor) + throws CoreException { + // TODO Auto-generated method stub - public void configureRawClasspath( ProjectConfigurationRequest request, IClasspathDescriptor classpath, - IProgressMonitor monitor ) - throws CoreException - { - IMavenProjectFacade facade = request.getMavenProjectFacade(); + } - assertHasNature( request.getProject(), JavaCore.NATURE_ID ); + public void configureRawClasspath(ProjectConfigurationRequest request, IClasspathDescriptor classpath, + IProgressMonitor monitor) throws CoreException { + IMavenProjectFacade facade = request.getMavenProjectFacade(); - for ( MojoExecution mojoExecution : getMojoExecutions( request, monitor ) ) - { - File[] sources = getSourceFolders( request, mojoExecution ); + assertHasNature(request.getProject(), JavaCore.NATURE_ID); - for ( File source : sources ) - { - IPath sourcePath = getFullPath( facade, source ); + for(MojoExecution mojoExecution : getMojoExecutions(request, monitor)) { + File[] sources = getSourceFolders(request, mojoExecution); - if ( sourcePath != null ) - { - classpath.addSourceEntry( sourcePath, facade.getOutputLocation(), true ); - } - } - } - } - - protected IPath getFullPath( IMavenProjectFacade facade, File file ) - { - IProject project = facade.getProject(); - IPath path = MavenProjectUtils.getProjectRelativePath( project, file.getAbsolutePath() ); - return project.getFullPath().append( path ); - } + for(File source : sources) { + IPath sourcePath = getFullPath(facade, source); - protected File[] getSourceFolders( ProjectConfigurationRequest request, MojoExecution mojoExecution ) - throws CoreException - { - return new File[] { getParameterValue( getOutputFolderParameterName(), File.class, request.getMavenSession(), - mojoExecution ) }; - } - - protected String getOutputFolderParameterName() - { - return "outputDirectory"; + if(sourcePath != null) { + classpath.addSourceEntry(sourcePath, facade.getOutputLocation(), true); + } + } } + } + + protected IPath getFullPath(IMavenProjectFacade facade, File file) { + IProject project = facade.getProject(); + IPath path = MavenProjectUtils.getProjectRelativePath(project, file.getAbsolutePath()); + return project.getFullPath().append(path); + } + + protected File[] getSourceFolders(ProjectConfigurationRequest request, MojoExecution mojoExecution) + throws CoreException { + return new File[] {getParameterValue(getOutputFolderParameterName(), File.class, request.getMavenSession(), + mojoExecution)}; + } + + protected String getOutputFolderParameterName() { + return "outputDirectory"; + } } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java index 9633121d..4f033224 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathDescriptor.java @@ -47,7 +47,7 @@ public interface IClasspathDescriptor { /** * Adds project source folder to the classpath. The source folder must exist in the workspace unless generated is - * true. In the latter case, the source classpath entry will be marked as optional. + * true. In the latter case, the source classpath entry will be marked as optional. */ public IClasspathEntryDescriptor addSourceEntry(IPath sourcePath, IPath outputLocation, IPath[] inclusion, IPath[] exclusion, boolean generated); diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathEntryDescriptor.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathEntryDescriptor.java index c3710db7..b505651f 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathEntryDescriptor.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathEntryDescriptor.java @@ -133,7 +133,7 @@ public interface IClasspathEntryDescriptor { * All new classpath entries are marked as derived by default, however value of this flag is preserved when entry * descriptor is read from .classpath file. The intend is to make sure that custom classpath entries are not removed * automatically. Clients of IClasspathDescriptor API who prefer to manage cleanup of stale class classpath entries - * explicitly may set derived flag to <code>false</code>. + * explicitly may set derived flag to <code>false</code>. * <p> * Although not enforced, derived flag only applies to project 'raw' classpath entries. The flag is silently ignored * for classpath container entries. diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathManagerDelegate.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathManagerDelegate.java index 91f9fae3..2a1f80c4 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathManagerDelegate.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IClasspathManagerDelegate.java @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.m2e.core.project.IMavenProjectFacade; + public interface IClasspathManagerDelegate { public void populateClasspath(IClasspathDescriptor classpath, IMavenProjectFacade projectFacade, int kind, diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IJavaProjectConfigurator.java index bcbb8bc2..a29591b1 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IJavaProjectConfigurator.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/IJavaProjectConfigurator.java @@ -28,7 +28,8 @@ public interface IJavaProjectConfigurator { /** * Configures *Maven* project classpath, i.e. content of Maven Dependencies classpath container. */ - public void configureClasspath(IMavenProjectFacade facade, IClasspathDescriptor classpath, IProgressMonitor monitor) throws CoreException; + public void configureClasspath(IMavenProjectFacade facade, IClasspathDescriptor classpath, IProgressMonitor monitor) + throws CoreException; /** * Configures *JDT* project classpath, i.e. project-level entries like source folders, JRE and Maven Dependencies diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java index 43d7ead7..ec911e88 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java @@ -392,7 +392,7 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon for(Resource resource : resources) { String directory = resource.getDirectory(); - if (directory == null) { + if(directory == null) { continue; } File resourceDirectory = new File(directory); @@ -440,9 +440,9 @@ public abstract class AbstractJavaProjectConfigurator extends AbstractProjectCon private boolean isResourceDescriptor(IClasspathEntryDescriptor cped) { //How can we know for sure this is a resource folder? - if (cped != null) { + if(cped != null) { IPath[] exclusionPatterns = cped.getExclusionPatterns(); - if (exclusionPatterns != null && exclusionPatterns.length == 1) { + if(exclusionPatterns != null && exclusionPatterns.length == 1) { IPath excludeAllPattern = new Path("**"); return excludeAllPattern.equals(exclusionPatterns[0]); } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/BuildPathManager.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/BuildPathManager.java index 6377a4ce..4ea415a2 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/BuildPathManager.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/BuildPathManager.java @@ -85,6 +85,7 @@ import org.eclipse.m2e.jdt.IClasspathManager; import org.eclipse.m2e.jdt.IClasspathManagerDelegate; import org.eclipse.m2e.jdt.MavenJdtPlugin; + /** * This class is responsible for mapping Maven classpath to JDT and back. */ @@ -129,8 +130,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource private final DefaultClasspathManagerDelegate defaultDelegate; - public BuildPathManager(IMavenProjectRegistry projectManager, IndexManager indexManager, - BundleContext bundleContext, File stateLocationDir) { + public BuildPathManager(IMavenProjectRegistry projectManager, IndexManager indexManager, BundleContext bundleContext, + File stateLocationDir) { this.projectManager = projectManager; this.indexManager = indexManager; this.mavenConfiguration = MavenPlugin.getMavenConfiguration(); @@ -160,7 +161,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource IClasspathEntry[] entries = project.getRawClasspath(); for(int i = 0; i < entries.length; i++ ) { IClasspathEntry entry = entries[i]; - if(entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER && MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) { + if(entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER + && MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) { return JavaCore.getClasspathContainer(entry.getPath(), project); } } @@ -308,12 +310,12 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource desc.setJavadocUrl(javaDocUrl); ArtifactKey aKey = desc.getArtifactKey(); - if (aKey != null) { // maybe we should try to find artifactKey little harder here? + if(aKey != null) { // maybe we should try to find artifactKey little harder here? boolean downloadSources = desc.getSourceAttachmentPath() == null && srcPath == null && mavenConfiguration.isDownloadSources(); boolean downloadJavaDoc = desc.getJavadocUrl() == null && javaDocUrl == null && mavenConfiguration.isDownloadJavaDoc(); - + scheduleDownload(facade.getProject(), facade.getMavenProject(), aKey, downloadSources, downloadJavaDoc); } } @@ -321,7 +323,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource } private boolean isUnavailable(ArtifactKey a, List<ArtifactRepository> repositories) throws CoreException { - return maven.isUnavailable(a.getGroupId(), a.getArtifactId(), a.getVersion(), "jar" /*type*/, a.getClassifier(), repositories); //$NON-NLS-1$ + return maven.isUnavailable(a.getGroupId(), a.getArtifactId(), a.getVersion(), + "jar" /*type*/, a.getClassifier(), repositories); //$NON-NLS-1$ } // public void downloadSources(IProject project, ArtifactKey artifact, boolean downloadSources, boolean downloadJavaDoc) throws CoreException { @@ -340,7 +343,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource return getClasspath(project, scope, true, monitor); } - public IClasspathEntry[] getClasspath(IProject project, int scope, boolean uniquePaths, IProgressMonitor monitor) throws CoreException { + public IClasspathEntry[] getClasspath(IProject project, int scope, boolean uniquePaths, IProgressMonitor monitor) + throws CoreException { IMavenProjectFacade facade = projectManager.create(project, monitor); if(facade == null) { return new IClasspathEntry[0]; @@ -368,22 +372,16 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource } /** - * Downloads artifact sources using background job. - * - * If path is null, downloads sources for all classpath entries of the project, - * otherwise downloads sources for the first classpath entry with the - * given path. + * Downloads artifact sources using background job. If path is null, downloads sources for all classpath entries of + * the project, otherwise downloads sources for the first classpath entry with the given path. */ // public void downloadSources(IProject project, IPath path) throws CoreException { // downloadSourcesJob.scheduleDownload(project, path, findArtifacts(project, path), true, false); // } /** - * Downloads artifact JavaDocs using background job. - * - * If path is null, downloads sources for all classpath entries of the project, - * otherwise downloads sources for the first classpath entry with the - * given path. + * Downloads artifact JavaDocs using background job. If path is null, downloads sources for all classpath entries of + * the project, otherwise downloads sources for the first classpath entry with the given path. */ // public void downloadJavaDoc(IProject project, IPath path) throws CoreException { // downloadSourcesJob.scheduleDownload(project, path, findArtifacts(project, path), false, true); @@ -451,7 +449,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource private ArtifactKey findArtifactInIndex(IProject project, IClasspathEntry entry) throws CoreException { IFile jarFile = project.getWorkspace().getRoot().getFile(entry.getPath()); - File file = jarFile==null || jarFile.getLocation()==null ? entry.getPath().toFile() : jarFile.getLocation().toFile(); + File file = jarFile == null || jarFile.getLocation() == null ? entry.getPath().toFile() : jarFile.getLocation() + .toFile(); IndexedArtifactFile iaf = indexManager.getIndex(project).identify(file); if(iaf != null) { @@ -521,11 +520,13 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource if(IClasspathEntry.CPE_LIBRARY == entry.getEntryKind()) { String path = entry.getPath().toPortableString(); String value = (String) props.get(path + PROPERTY_SRC_PATH); - if (value != null && entry.getSourceAttachmentPath() != null && value.equals(entry.getSourceAttachmentPath().toPortableString())) { + if(value != null && entry.getSourceAttachmentPath() != null + && value.equals(entry.getSourceAttachmentPath().toPortableString())) { props.remove(path + PROPERTY_SRC_PATH); } value = (String) props.get(path + PROPERTY_SRC_ROOT); - if (value != null && entry.getSourceAttachmentRootPath() != null && value.equals(entry.getSourceAttachmentRootPath().toPortableString())) { + if(value != null && entry.getSourceAttachmentRootPath() != null + && value.equals(entry.getSourceAttachmentRootPath().toPortableString())) { props.remove(path + PROPERTY_SRC_ROOT); } } @@ -541,7 +542,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource os.close(); } } catch(IOException e) { - throw new CoreException(new Status(IStatus.ERROR, MavenJdtPlugin.PLUGIN_ID, -1, "Can't save classpath container changes", e)); + throw new CoreException(new Status(IStatus.ERROR, MavenJdtPlugin.PLUGIN_ID, -1, + "Can't save classpath container changes", e)); } // update classpath container. suboptimal as this will re-calculate classpath @@ -642,7 +644,7 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource } /** - * Resolves artifact from local repository. Returns null if the artifact is not available locally + * Resolves artifact from local repository. Returns null if the artifact is not available locally */ private File getAttachedArtifactFile(ArtifactKey a, String classifier) { // can't use Maven resolve methods since they mark artifacts as not-found even if they could be resolved remotely @@ -755,7 +757,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource MavenProject mavenProject = facade != null ? facade.getMavenProject() : null; if(mavenProject != null) { for(Artifact artifact : mavenProject.getArtifacts()) { - ArtifactKey artifactKey = new ArtifactKey(artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getClassifier()); + ArtifactKey artifactKey = new ArtifactKey(artifact.getGroupId(), artifact.getArtifactId(), + artifact.getBaseVersion(), artifact.getClassifier()); scheduleDownload(project, mavenProject, artifactKey, downloadSources, downloadJavadoc); } } else { @@ -768,16 +771,20 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource } } - private void scheduleDownload(IProject project, MavenProject mavenProject, ArtifactKey artifact, boolean downloadSources, boolean downloadJavadoc) throws CoreException { - ArtifactKey[] attached = getAttachedSourcesAndJavadoc(artifact, mavenProject.getRemoteArtifactRepositories(), downloadSources, downloadJavadoc); + private void scheduleDownload(IProject project, MavenProject mavenProject, ArtifactKey artifact, + boolean downloadSources, boolean downloadJavadoc) throws CoreException { + ArtifactKey[] attached = getAttachedSourcesAndJavadoc(artifact, mavenProject.getRemoteArtifactRepositories(), + downloadSources, downloadJavadoc); if(attached[0] != null || attached[1] != null) { downloadSourcesJob.scheduleDownload(project, artifact, downloadSources, downloadJavadoc); } } - ArtifactKey[] getAttachedSourcesAndJavadoc(ArtifactKey a, List<ArtifactRepository> repositories, boolean downloadSources, boolean downloadJavaDoc) throws CoreException { - ArtifactKey sourcesArtifact = new ArtifactKey(a.getGroupId(), a.getArtifactId(), a.getVersion(), getSourcesClassifier(a.getClassifier())); + ArtifactKey[] getAttachedSourcesAndJavadoc(ArtifactKey a, List<ArtifactRepository> repositories, + boolean downloadSources, boolean downloadJavaDoc) throws CoreException { + ArtifactKey sourcesArtifact = new ArtifactKey(a.getGroupId(), a.getArtifactId(), a.getVersion(), + getSourcesClassifier(a.getClassifier())); ArtifactKey javadocArtifact = new ArtifactKey(a.getGroupId(), a.getArtifactId(), a.getVersion(), CLASSIFIER_JAVADOC); if(repositories != null) { @@ -809,7 +816,8 @@ public class BuildPathManager implements IMavenProjectChangedListener, IResource for(int i = 0; i < cp.length; i++ ) { IClasspathEntry entry = cp[i]; if(IClasspathEntry.CPE_LIBRARY == entry.getEntryKind() && entry.equals(fragment.getRawClasspathEntry())) { - List<IClasspathAttribute> attributes = new ArrayList<IClasspathAttribute>(Arrays.asList(entry.getExtraAttributes())); + List<IClasspathAttribute> attributes = new ArrayList<IClasspathAttribute>(Arrays.asList(entry + .getExtraAttributes())); if(srcPath == null) { // configure javadocs if available diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java index 10188276..c3aacaef 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java @@ -27,8 +27,8 @@ import org.apache.maven.project.MavenProject; import org.eclipse.m2e.core.MavenPlugin; import org.eclipse.m2e.core.embedder.ArtifactKey; import org.eclipse.m2e.core.project.IMavenProjectFacade; -import org.eclipse.m2e.core.project.IProjectConfigurationManager; import org.eclipse.m2e.core.project.IMavenProjectRegistry; +import org.eclipse.m2e.core.project.IProjectConfigurationManager; import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator; import org.eclipse.m2e.core.project.configurator.ILifecycleMapping; import org.eclipse.m2e.jdt.IClasspathDescriptor; @@ -106,8 +106,8 @@ public class DefaultClasspathManagerDelegate implements IClasspathManagerDelegat } // project - IMavenProjectFacade dependency = projectManager - .getMavenProject(a.getGroupId(), a.getArtifactId(), a.getBaseVersion()); + IMavenProjectFacade dependency = projectManager.getMavenProject(a.getGroupId(), a.getArtifactId(), + a.getBaseVersion()); if(dependency != null && dependency.getProject().equals(facade.getProject())) { continue; } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesActionDelegate.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesActionDelegate.java index 1b8e6eb9..47fda096 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesActionDelegate.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesActionDelegate.java @@ -8,6 +8,7 @@ * Contributors: * Sonatype, Inc. - initial API and implementation *******************************************************************************/ + package org.eclipse.m2e.jdt.internal; import org.slf4j.Logger; @@ -24,10 +25,10 @@ import org.eclipse.ui.IEditorPart; import org.eclipse.m2e.jdt.IClasspathManager; import org.eclipse.m2e.jdt.MavenJdtPlugin; + /** - * * DownloadSourcesActionDelegate - * + * * @author Anton Kraev */ @@ -37,18 +38,18 @@ public class DownloadSourcesActionDelegate implements IEditorActionDelegate { public void setActiveEditor(IAction action, IEditorPart part) { - if (part != null) { + if(part != null) { try { - IClasspathManager buildpathManager = MavenJdtPlugin .getDefault().getBuildpathManager(); + IClasspathManager buildpathManager = MavenJdtPlugin.getDefault().getBuildpathManager(); IClassFileEditorInput input = (IClassFileEditorInput) part.getEditorInput(); IJavaElement element = input.getClassFile(); - while (element.getParent() != null) { + while(element.getParent() != null) { element = element.getParent(); - if (element instanceof IPackageFragmentRoot) { + if(element instanceof IPackageFragmentRoot) { IPackageFragmentRoot root = (IPackageFragmentRoot) element; - if (root.getSourceAttachmentPath() != null) { + if(root.getSourceAttachmentPath() != null) { // do nothing if sources attached already break; } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesJob.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesJob.java index ffee461a..63c2a06e 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesJob.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DownloadSourcesJob.java @@ -54,6 +54,7 @@ import org.eclipse.m2e.jdt.MavenJdtPlugin; */ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { private static Logger log = LoggerFactory.getLogger(DownloadSourcesJob.class); + private static final long SCHEDULE_INTERVAL = 1000L; private static class DownloadRequest { @@ -67,8 +68,8 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { final boolean downloadJavaDoc; - public DownloadRequest(IProject project, IPackageFragmentRoot fragment, ArtifactKey artifact, boolean downloadSources, - boolean downloadJavaDoc) { + public DownloadRequest(IProject project, IPackageFragmentRoot fragment, ArtifactKey artifact, + boolean downloadSources, boolean downloadJavaDoc) { this.project = project; this.fragment = fragment; this.artifact = artifact; @@ -79,27 +80,26 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { public int hashCode() { int hash = 17; hash = hash * 31 + project.hashCode(); - hash = hash * 31 + (fragment != null? fragment.hashCode(): 0); - hash = hash * 31 + (artifact != null? artifact.hashCode(): 0); + hash = hash * 31 + (fragment != null ? fragment.hashCode() : 0); + hash = hash * 31 + (artifact != null ? artifact.hashCode() : 0); hash = hash * 31 + (downloadSources ? 1 : 0); hash = hash * 31 + (downloadJavaDoc ? 1 : 0); return hash; } - + public boolean equals(Object o) { - if (this == o) { + if(this == o) { return true; } - if (!(o instanceof DownloadRequest)) { + if(!(o instanceof DownloadRequest)) { return false; } DownloadRequest other = (DownloadRequest) o; return project.equals(other.project) - && (fragment != null? fragment.equals(other.fragment): other.fragment == null) - && (artifact != null? artifact.equals(other.artifact): other.artifact == null) - && downloadSources == other.downloadSources - && downloadJavaDoc == other.downloadJavaDoc; + && (fragment != null ? fragment.equals(other.fragment) : other.fragment == null) + && (artifact != null ? artifact.equals(other.artifact) : other.artifact == null) + && downloadSources == other.downloadSources && downloadJavaDoc == other.downloadJavaDoc; } } @@ -134,33 +134,35 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { Map<IPackageFragmentRoot, File[]> nonMavenProjects = new LinkedHashMap<IPackageFragmentRoot, File[]>(); for(DownloadRequest request : downloadRequests) { - if ( request.artifact != null ) try { - IMavenProjectFacade projectFacade = projectManager.create(request.project, monitor); - - if (projectFacade != null) { - downloadMaven(projectFacade, request.artifact, request.downloadSources, request.downloadJavaDoc, monitor); - mavenProjects.add(request.project); - } else { - List<ArtifactRepository> repositories = maven.getArtifactRepositories(); - - File[] files = downloadAttachments(request.artifact, repositories, request.downloadSources, request.downloadJavaDoc, monitor); - - nonMavenProjects.put(request.fragment, files); + if(request.artifact != null) + try { + IMavenProjectFacade projectFacade = projectManager.create(request.project, monitor); + + if(projectFacade != null) { + downloadMaven(projectFacade, request.artifact, request.downloadSources, request.downloadJavaDoc, monitor); + mavenProjects.add(request.project); + } else { + List<ArtifactRepository> repositories = maven.getArtifactRepositories(); + + File[] files = downloadAttachments(request.artifact, repositories, request.downloadSources, + request.downloadJavaDoc, monitor); + + nonMavenProjects.put(request.fragment, files); + } + } catch(CoreException ex) { + exceptions.add(ex.getStatus()); } - } catch(CoreException ex) { - exceptions.add(ex.getStatus()); - } } if(!mavenProjects.isEmpty() || !nonMavenProjects.isEmpty()) { ISchedulingRule schedulingRule = ResourcesPlugin.getWorkspace().getRuleFactory().buildRule(); getJobManager().beginRule(schedulingRule, monitor); try { - for (IProject mavenProject : mavenProjects) { + for(IProject mavenProject : mavenProjects) { manager.updateClasspath(mavenProject, monitor); } - for (Map.Entry<IPackageFragmentRoot, File[]> entry : nonMavenProjects.entrySet()) { + for(Map.Entry<IPackageFragmentRoot, File[]> entry : nonMavenProjects.entrySet()) { File[] files = entry.getValue(); manager.attachSourcesAndJavadoc(entry.getKey(), files[0], files[1], monitor); } @@ -168,7 +170,7 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { getJobManager().endRule(schedulingRule); } } - + if(!exceptions.isEmpty()) { IStatus[] problems = exceptions.toArray(new IStatus[exceptions.size()]); return new MultiStatus(MavenJdtPlugin.PLUGIN_ID, -1, problems, "Could not download sources or javadoc", null); @@ -177,22 +179,23 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { return Status.OK_STATUS; } - private void downloadMaven(IMavenProjectFacade projectFacade, ArtifactKey artifact, boolean downloadSources, boolean downloadJavadoc, IProgressMonitor monitor) throws CoreException { + private void downloadMaven(IMavenProjectFacade projectFacade, ArtifactKey artifact, boolean downloadSources, + boolean downloadJavadoc, IProgressMonitor monitor) throws CoreException { MavenProject mavenProject = projectFacade.getMavenProject(monitor); List<ArtifactRepository> repositories = mavenProject.getRemoteArtifactRepositories(); - - if (artifact != null) { + + if(artifact != null) { downloadAttachments(artifact, repositories, downloadSources, downloadJavadoc, monitor); } else { - for (Artifact a : mavenProject.getArtifacts()) { + for(Artifact a : mavenProject.getArtifacts()) { ArtifactKey aKey = new ArtifactKey(a.getGroupId(), a.getArtifactId(), a.getBaseVersion(), a.getClassifier()); downloadAttachments(aKey, repositories, downloadSources, downloadJavadoc, monitor); } } } - private File[] downloadAttachments(ArtifactKey artifact, List<ArtifactRepository> repositories, boolean downloadSources, - boolean downloadJavadoc, IProgressMonitor monitor) throws CoreException { + private File[] downloadAttachments(ArtifactKey artifact, List<ArtifactRepository> repositories, + boolean downloadSources, boolean downloadJavadoc, IProgressMonitor monitor) throws CoreException { if(monitor != null && monitor.isCanceled()) { String message = "Downloading of sources/javadocs was canceled"; //$NON-NLS-1$ log.debug(message); @@ -201,24 +204,25 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { } throw new OperationCanceledException(message); } - ArtifactKey[] attached = manager.getAttachedSourcesAndJavadoc(artifact, repositories, downloadSources, downloadJavadoc); + ArtifactKey[] attached = manager.getAttachedSourcesAndJavadoc(artifact, repositories, downloadSources, + downloadJavadoc); - File[] files = new File[2]; + File[] files = new File[2]; - if (attached[0] != null) { + if(attached[0] != null) { try { files[0] = download(attached[0], repositories, monitor); log.info("Downloaded sources for " + artifact.toString()); - } catch (CoreException e) { + } catch(CoreException e) { log.error("Could not download sources for " + artifact.toString(), e); //$NON-NLS-1$ } } - if (attached[1] != null) { + if(attached[1] != null) { try { files[1] = download(attached[1], repositories, monitor); log.info("Downloaded javadoc for " + artifact.toString()); - } catch (CoreException e) { + } catch(CoreException e) { log.error("Could not download sources for " + artifact.toString(), e); //$NON-NLS-1$ } } @@ -226,7 +230,8 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { return files; } - private File download(ArtifactKey artifact, List<ArtifactRepository> repositories, IProgressMonitor monitor) throws CoreException { + private File download(ArtifactKey artifact, List<ArtifactRepository> repositories, IProgressMonitor monitor) + throws CoreException { Artifact resolved = maven.resolve(artifact.getGroupId(), // artifact.getArtifactId(), // artifact.getVersion(), // @@ -237,8 +242,9 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { return resolved.getFile(); } - private void scheduleDownload(IProject project, IPackageFragmentRoot fragment, ArtifactKey artifact, boolean downloadSources, boolean downloadJavadoc) { - if (project == null || !project.isAccessible()) { + private void scheduleDownload(IProject project, IPackageFragmentRoot fragment, ArtifactKey artifact, + boolean downloadSources, boolean downloadJavadoc) { + if(project == null || !project.isAccessible()) { return; } @@ -250,16 +256,16 @@ class DownloadSourcesJob extends Job implements IBackgroundProcessingQueue { } /** - * If artifact is not null, download sources and/or javadoc of this artifact. - * If artifact is null, download sources and/or javadoc of all project dependencies. - * Entire project classpath is updated after download. - * Does nothing if both downloadSources and downloadJavadoc are false. + * If artifact is not null, download sources and/or javadoc of this artifact. If artifact is null, download sources + * and/or javadoc of all project dependencies. Entire project classpath is updated after download. Does nothing if + * both downloadSources and downloadJavadoc are false. */ public void scheduleDownload(IProject project, ArtifactKey artifact, boolean downloadSources, boolean downloadJavadoc) { scheduleDownload(project, null, artifact, downloadSources, downloadJavadoc); } - public void scheduleDownload(IPackageFragmentRoot fragment, ArtifactKey artifact, boolean downloadSources, boolean downloadJavadoc) { + public void scheduleDownload(IPackageFragmentRoot fragment, ArtifactKey artifact, boolean downloadSources, + boolean downloadJavadoc) { IProject project = fragment.getJavaProject().getProject(); scheduleDownload(project, fragment, artifact, downloadSources, downloadJavadoc); } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JarLifecycleMapping.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JarLifecycleMapping.java index c999344c..45690b94 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JarLifecycleMapping.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JarLifecycleMapping.java @@ -10,6 +10,7 @@ package org.eclipse.m2e.jdt.internal; import org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping; + /** * @author igor */ diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java index bded57f0..1a7a30fb 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaElementsAdapterFactory.java @@ -39,7 +39,7 @@ import org.eclipse.m2e.jdt.MavenJdtPlugin; * @author Igor Fedorenko * @author Eugene Kuleshov */ -@SuppressWarnings({"restriction","rawtypes"}) +@SuppressWarnings({"restriction", "rawtypes"}) public class JavaElementsAdapterFactory implements IAdapterFactory { private static final Logger log = LoggerFactory.getLogger(JavaElementsAdapterFactory.class); @@ -62,16 +62,16 @@ public class JavaElementsAdapterFactory implements IAdapterFactory { return null; } } - + } else if(adaptableObject instanceof RequiredProjectWrapper) { IMavenProjectFacade projectFacade = getProjectFacade(adaptableObject); - if(projectFacade!=null) { + if(projectFacade != null) { return projectFacade.getArtifactKey(); } - + } else if(adaptableObject instanceof IJavaProject) { return ((IJavaProject) adaptableObject).getProject().getAdapter(ArtifactKey.class); - + } } else if(adapterType == IPath.class) { @@ -81,7 +81,7 @@ public class JavaElementsAdapterFactory implements IAdapterFactory { return resource.getLocation(); } } - + } else if(adapterType == IMavenProjectFacade.class) { if(adaptableObject instanceof IJavaElement) { IProject project = ((IJavaElement) adaptableObject).getJavaProject().getProject(); @@ -116,5 +116,5 @@ public class JavaElementsAdapterFactory implements IAdapterFactory { IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry(); return projectManager.create(project, new NullProgressMonitor()); } - + } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaProjectConversionParticipant.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaProjectConversionParticipant.java index 11ed21ae..44384887 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaProjectConversionParticipant.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/JavaProjectConversionParticipant.java @@ -8,6 +8,7 @@ * Contributors: * Red Hat, Inc. - initial API and implementation *******************************************************************************/ + package org.eclipse.m2e.jdt.internal; import java.util.Arrays; @@ -40,29 +41,30 @@ import org.apache.maven.model.Resource; import org.eclipse.m2e.core.project.conversion.AbstractProjectConversionParticipant; + /** - * Converts existing Eclipse Java projects by setting the maven compiler source and target values. - * It also tries to best match existing Java source directories with the corresponding - * source, test source, resource and test resource directories of the Maven model. - * + * Converts existing Eclipse Java projects by setting the maven compiler source and target values. It also tries to best + * match existing Java source directories with the corresponding source, test source, resource and test resource + * directories of the Maven model. + * * @author Fred Bricon */ public class JavaProjectConversionParticipant extends AbstractProjectConversionParticipant { private static final Logger log = LoggerFactory.getLogger(JavaProjectConversionParticipant.class); - + private static final String DEFAULT_JAVA_SOURCE = "src/main/java"; //$NON-NLS-1$ - + private static final String DEFAULT_RESOURCES = "src/main/resources"; //$NON-NLS-1$ - + private static final String DEFAULT_JAVA_TEST_SOURCE = "src/test/java"; //$NON-NLS-1$ - + private static final String DEFAULT_TEST_RESOURCES = "src/test/resources"; //$NON-NLS-1$ - + private static final String DEFAULT_JAVA_VERSION = "1.5"; //$NON-NLS-1$ private static final String COMPILER_GROUP_ID = "org.apache.maven.plugins"; //$NON-NLS-1$ - + private static final String COMPILER_ARTIFACT_ID = "maven-compiler-plugin"; //$NON-NLS-1$ private static final String COMPILER_VERSION = "2.3.2"; //$NON-NLS-1$ @@ -74,47 +76,46 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP private static final String CONFIGURATION_KEY = "configuration"; //$NON-NLS-1$ public boolean accept(IProject project) throws CoreException { - boolean accepts = project != null && project.isAccessible() - && project.hasNature(JavaCore.NATURE_ID); + boolean accepts = project != null && project.isAccessible() && project.hasNature(JavaCore.NATURE_ID); return accepts; } public void convert(IProject project, Model model, IProgressMonitor monitor) throws CoreException { - if (!accept(project)) { + if(!accept(project)) { return; } IJavaProject javaProject = JavaCore.create(project); - if (javaProject == null) { + if(javaProject == null) { return; } log.debug("Applying Java conversion to " + project.getName()); //$NON-NLS-1$ - + configureBuildSourceDirectories(model, javaProject); //Read existing Eclipse compiler settings String source = javaProject.getOption(JavaCore.COMPILER_SOURCE, false); - String target= javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, false); + String target = javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, false); //We want to keep pom.xml configuration to a minimum so we rely on convention. If the java version == 1.5, //we shouldn't need to add anything as recent maven-compiler-plugin versions target Java 1.5 by default - if (DEFAULT_JAVA_VERSION.equals(source) && DEFAULT_JAVA_VERSION.equals(target)) { + if(DEFAULT_JAVA_VERSION.equals(source) && DEFAULT_JAVA_VERSION.equals(target)) { return; } - + //Configure Java version boolean useProperties = false;//TODO Use preferences - if (useProperties) { + if(useProperties) { configureProperties(model, source, target); } else { configureCompilerPlugin(model, source, target); } - + } private void configureProperties(Model model, String source, String target) { Properties properties = model.getProperties(); - if (properties == null) { + if(properties == null) { properties = new Properties(); model.setProperties(properties); } @@ -123,47 +124,47 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP } private void configureCompilerPlugin(Model model, String source, String target) { - Build build= getOrCreateBuild(model); + Build build = getOrCreateBuild(model); model.setBuild(build); - + Plugin compiler = getOrCreateCompilerPlugin(build); - - Xpp3Dom configuration = (Xpp3Dom)compiler.getConfiguration(); - if (configuration == null) { + + Xpp3Dom configuration = (Xpp3Dom) compiler.getConfiguration(); + if(configuration == null) { configuration = new Xpp3Dom(CONFIGURATION_KEY); compiler.setConfiguration(configuration); } - + Xpp3Dom sourceDom = configuration.getChild(SOURCE_KEY); - if (sourceDom == null) { + if(sourceDom == null) { sourceDom = new Xpp3Dom(SOURCE_KEY); configuration.addChild(sourceDom); } - sourceDom.setValue(source); - + sourceDom.setValue(source); + Xpp3Dom targetDom = configuration.getChild(TARGET_KEY); - if (targetDom == null) { + if(targetDom == null) { targetDom = new Xpp3Dom(TARGET_KEY); configuration.addChild(targetDom); } - targetDom.setValue(target); + targetDom.setValue(target); compiler.setConfiguration(configuration); } private Plugin getOrCreateCompilerPlugin(Build build) { build.flushPluginMap();//We need to force the re-generation of the plugin map as it may be stale - Plugin compiler = build.getPluginsAsMap().get(COMPILER_GROUP_ID+":"+COMPILER_ARTIFACT_ID); //$NON-NLS-1$ - if (compiler == null) { + Plugin compiler = build.getPluginsAsMap().get(COMPILER_GROUP_ID + ":" + COMPILER_ARTIFACT_ID); //$NON-NLS-1$ + if(compiler == null) { compiler = build.getPluginsAsMap().get(COMPILER_ARTIFACT_ID); } - if (compiler == null) { + if(compiler == null) { compiler = new Plugin(); compiler.setGroupId(COMPILER_GROUP_ID); compiler.setArtifactId(COMPILER_ARTIFACT_ID); compiler.setVersion(COMPILER_VERSION); build.addPlugin(compiler); } - + return compiler; } @@ -174,37 +175,37 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP Set<String> potentialResourceDirectories = new LinkedHashSet<String>(); Set<String> potentialTestResourceDirectories = new LinkedHashSet<String>(); IPath projectPath = javaProject.getPath(); - - for (int i = 0; i < entries.length; i++) { - if (entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) { + + for(int i = 0; i < entries.length; i++ ) { + if(entries[i].getEntryKind() == IClasspathEntry.CPE_SOURCE) { IPath path = entries[i].getPath().makeRelativeTo(projectPath); - if (path.isAbsolute()) { + if(path.isAbsolute()) { //We only support paths relative to the project root, so we skip this one continue; } String portablePath = path.toPortableString(); boolean isPotentialTestSource = isPotentialTestSource(path); boolean isResource = false; - if (isPotentialTestSource) { - if (DEFAULT_TEST_RESOURCES.equals(portablePath)) { + if(isPotentialTestSource) { + if(DEFAULT_TEST_RESOURCES.equals(portablePath)) { isResource = potentialTestResourceDirectories.add(portablePath); } else { potentialTestSources.add(portablePath); } } else { - if (DEFAULT_RESOURCES.equals(portablePath)) { + if(DEFAULT_RESOURCES.equals(portablePath)) { isResource = potentialResourceDirectories.add(portablePath); } else { sources.add(portablePath); } } - - if (!isResource) { + + if(!isResource) { //For source folders not already flagged as resource folder, check if // they contain non-java sources, so we can add them as resources too boolean hasNonJavaResources = false; - IFolder folder = javaProject.getProject().getFolder(path); - if (folder.isAccessible()) { + IFolder folder = javaProject.getProject().getFolder(path); + if(folder.isAccessible()) { NonJavaResourceVisitor nonJavaResourceVisitor = new NonJavaResourceVisitor(); try { folder.accept(nonJavaResourceVisitor); @@ -213,16 +214,16 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP hasNonJavaResources = true; } catch(CoreException ex) { //385666 ResourceException is thrown in Helios - if (ex.getCause() instanceof NonJavaResourceFoundException) { + if(ex.getCause() instanceof NonJavaResourceFoundException) { hasNonJavaResources = true; } else { log.error("An error occured while analysing {} : {}", folder, ex.getMessage()); } } } - - if (hasNonJavaResources) { - if (isPotentialTestSource) { + + if(hasNonJavaResources) { + if(isPotentialTestSource) { potentialTestResourceDirectories.add(portablePath); } else { potentialResourceDirectories.add(portablePath); @@ -231,46 +232,46 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP } } } - + Build build = getOrCreateBuild(model); - - if (!sources.isEmpty()) { - if (sources.size() > 1) { + + if(!sources.isEmpty()) { + if(sources.size() > 1) { //We don't know how to handle multiple sources, i.e. how to map to a resource or test source directory //That should be dealt by setting the build-helper-plugin config (http://mojo.codehaus.org/build-helper-maven-plugin/usage.html) - log.warn("{} has multiple source entries, this is not supported yet", model.getArtifactId()); //$NON-NLS-1$ + log.warn("{} has multiple source entries, this is not supported yet", model.getArtifactId()); //$NON-NLS-1$ } String sourceDirectory = sources.iterator().next(); - if (!DEFAULT_JAVA_SOURCE.equals(sourceDirectory)) { + if(!DEFAULT_JAVA_SOURCE.equals(sourceDirectory)) { build.setSourceDirectory(sourceDirectory); } - - for (String resourceDirectory : potentialResourceDirectories) { - if (!DEFAULT_RESOURCES.equals(resourceDirectory) || potentialResourceDirectories.size() > 1) { + + for(String resourceDirectory : potentialResourceDirectories) { + if(!DEFAULT_RESOURCES.equals(resourceDirectory) || potentialResourceDirectories.size() > 1) { build.addResource(createResource(resourceDirectory)); } } } - if (!potentialTestSources.isEmpty()) { - if (potentialTestSources.size() > 1) { - log.warn("{} has multiple test source entries, this is not supported yet", model.getArtifactId()); //$NON-NLS-1$ + if(!potentialTestSources.isEmpty()) { + if(potentialTestSources.size() > 1) { + log.warn("{} has multiple test source entries, this is not supported yet", model.getArtifactId()); //$NON-NLS-1$ } String testSourceDirectory = potentialTestSources.iterator().next(); - if (!DEFAULT_JAVA_TEST_SOURCE.equals(testSourceDirectory)) { + if(!DEFAULT_JAVA_TEST_SOURCE.equals(testSourceDirectory)) { build.setTestSourceDirectory(testSourceDirectory); } - for (String resourceDirectory : potentialTestResourceDirectories) { - if (!DEFAULT_TEST_RESOURCES.equals(resourceDirectory) || potentialTestResourceDirectories.size() > 1) { + for(String resourceDirectory : potentialTestResourceDirectories) { + if(!DEFAULT_TEST_RESOURCES.equals(resourceDirectory) || potentialTestResourceDirectories.size() > 1) { build.addTestResource(createResource(resourceDirectory)); } } } //Ensure we don't attach a new empty build definition to the model - if (build.getSourceDirectory() != null || build.getTestSourceDirectory() != null - || !build.getResources().isEmpty() || !build.getTestResources().isEmpty()) { - model.setBuild(build); + if(build.getSourceDirectory() != null || build.getTestSourceDirectory() != null || !build.getResources().isEmpty() + || !build.getTestResources().isEmpty()) { + model.setBuild(build); } } @@ -285,9 +286,9 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP * Checks if a given path has one of its segment ending with test or tests */ private boolean isPotentialTestSource(IPath path) { - for (String segment : path.segments()) { - String folderName = segment.toLowerCase(); - if (folderName.matches(".*tests?")) { //$NON-NLS-1$ + for(String segment : path.segments()) { + String folderName = segment.toLowerCase(); + if(folderName.matches(".*tests?")) { //$NON-NLS-1$ return true; } } @@ -297,35 +298,34 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP private Build getOrCreateBuild(Model model) { Build build = model.getBuild(); - if (build == null) { + if(build == null) { build = new Build(); } return build; } - /** - * Visitor implementation looking for non-Java resources. as soon as such resource is found, - * a {@link NonJavaResourceFoundException} is thrown. + * Visitor implementation looking for non-Java resources. as soon as such resource is found, a + * {@link NonJavaResourceFoundException} is thrown. */ private static class NonJavaResourceVisitor implements IResourceVisitor { - + //TODO either declare a complete list of extensions or switch to // a different "ignore resource" strategy private static final List<String> IGNORED_EXTENSIONS = Arrays.asList(".svn"); //$NON-NLS-1$ - + public NonJavaResourceVisitor() { } @SuppressWarnings("unused") public boolean visit(IResource resource) throws CoreException { String resourceName = resource.getProjectRelativePath().lastSegment(); - if (resource.isHidden() || isIgnored(resourceName)) { + if(resource.isHidden() || isIgnored(resourceName)) { return false; } if(resource instanceof IFile) { IFile file = (IFile) resource; - if (!"java".equals(file.getFileExtension())) { + if(!"java".equals(file.getFileExtension())) { throw new NonJavaResourceFoundException(); } } @@ -333,8 +333,8 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP } private boolean isIgnored(String resourceName) { - for (String extension : IGNORED_EXTENSIONS) { - if (resourceName.endsWith(extension)) { + for(String extension : IGNORED_EXTENSIONS) { + if(resourceName.endsWith(extension)) { return true; } } @@ -346,8 +346,9 @@ public class JavaProjectConversionParticipant extends AbstractProjectConversionP private static final long serialVersionUID = 1L; - public NonJavaResourceFoundException() {} - + public NonJavaResourceFoundException() { + } + @Override public Throwable fillInStackTrace() { //Overriding fillInStackTrace() reduces the stacktrace creation overhead, diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainer.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainer.java index 62ceedfe..134209e3 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainer.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainer.java @@ -17,34 +17,36 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.core.IClasspathContainer; import org.eclipse.jdt.core.IClasspathEntry; + /** * Maven classpath container */ public class MavenClasspathContainer implements IClasspathContainer, Serializable { private static final long serialVersionUID = -5976726121300869771L; - + private final IClasspathEntry[] entries; + private final IPath path; public MavenClasspathContainer(IPath path, IClasspathEntry[] entries) { this.path = path; this.entries = entries; } - + public String getDescription() { - return Messages.MavenClasspathContainer_description; + return Messages.MavenClasspathContainer_description; } - + public int getKind() { return IClasspathContainer.K_APPLICATION; } - + public synchronized IClasspathEntry[] getClasspathEntries() { return entries; } public IPath getPath() { - return path; + return path; } - + } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerInitializer.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerInitializer.java index 658bdb14..ab0362ab 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerInitializer.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerInitializer.java @@ -75,7 +75,8 @@ public class MavenClasspathContainerInitializer extends ClasspathContainerInitia getBuildPathManager().persistAttachedSourcesAndJavadoc(project, containerSuggestion, monitor); } catch(CoreException ex) { log.error(ex.getMessage(), ex); - return new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, 0, Messages.MavenClasspathContainerInitializer_error_cannot_persist, ex); + return new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, 0, + Messages.MavenClasspathContainerInitializer_error_cannot_persist, ex); } return Status.OK_STATUS; } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerSaveHelper.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerSaveHelper.java index c82fb60a..38823d87 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerSaveHelper.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathContainerSaveHelper.java @@ -31,7 +31,7 @@ import org.eclipse.jdt.core.JavaCore; /** * BuildPath save helper - * + * * @author Eugene Kuleshov */ public class MavenClasspathContainerSaveHelper { @@ -41,6 +41,7 @@ public class MavenClasspathContainerSaveHelper { { enableResolveObject(true); } + protected Object resolveObject(Object o) throws IOException { if(o instanceof ProjectEntryReplace) { return ((ProjectEntryReplace) o).getEntry(); @@ -58,19 +59,19 @@ public class MavenClasspathContainerSaveHelper { }; return (IClasspathContainer) is.readObject(); } - + public void writeContainer(IClasspathContainer container, OutputStream output) throws IOException { ObjectOutputStream os = new ObjectOutputStream(new BufferedOutputStream(output)) { { enableReplaceObject(true); } - + protected Object replaceObject(Object o) throws IOException { if(o instanceof IClasspathEntry) { IClasspathEntry e = (IClasspathEntry) o; - if(e.getEntryKind()==IClasspathEntry.CPE_PROJECT) { + if(e.getEntryKind() == IClasspathEntry.CPE_PROJECT) { return new ProjectEntryReplace(e); - } else if(e.getEntryKind()==IClasspathEntry.CPE_LIBRARY) { + } else if(e.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { return new LibraryEntryReplace(e); } } else if(o instanceof IClasspathAttribute) { @@ -86,18 +87,23 @@ public class MavenClasspathContainerSaveHelper { os.writeObject(container); os.flush(); } - + /** * A library IClasspathEntry replacement used for object serialization */ static final class LibraryEntryReplace implements Serializable { private static final long serialVersionUID = 3901667379326978799L; - + private final IPath path; + private final IPath sourceAttachmentPath; + private final IPath sourceAttachmentRootPath; + private final IClasspathAttribute[] extraAttributes; + private final boolean exported; + private final IAccessRule[] accessRules; LibraryEntryReplace(IClasspathEntry entry) { @@ -108,23 +114,27 @@ public class MavenClasspathContainerSaveHelper { this.extraAttributes = entry.getExtraAttributes(); this.exported = entry.isExported(); } - + IClasspathEntry getEntry() { return JavaCore.newLibraryEntry(path, sourceAttachmentPath, sourceAttachmentRootPath, // accessRules, extraAttributes, exported); } } - + /** * A project IClasspathEntry replacement used for object serialization */ static final class ProjectEntryReplace implements Serializable { private static final long serialVersionUID = -2397483865904288762L; - + private final IPath path; + private final IClasspathAttribute[] extraAttributes; + private final IAccessRule[] accessRules; + private final boolean exported; + private final boolean combineAccessRules; ProjectEntryReplace(IClasspathEntry entry) { @@ -146,8 +156,9 @@ public class MavenClasspathContainerSaveHelper { */ static final class ClasspathAttributeReplace implements Serializable { private static final long serialVersionUID = 6370039352012628029L; - + private final String name; + private final String value; ClasspathAttributeReplace(IClasspathAttribute attribute) { @@ -159,38 +170,39 @@ public class MavenClasspathContainerSaveHelper { return JavaCore.newClasspathAttribute(name, value); } } - + /** * An IAccessRule replacement used for object serialization */ static final class AccessRuleReplace implements Serializable { private static final long serialVersionUID = 7315582893941374715L; - + private final IPath pattern; + private final int kind; - + AccessRuleReplace(IAccessRule accessRule) { pattern = accessRule.getPattern(); kind = accessRule.getKind(); } - + IAccessRule getAccessRule() { return JavaCore.newAccessRule(pattern, kind); } } - + /** * An IPath replacement used for object serialization */ static final class PathReplace implements Serializable { private static final long serialVersionUID = -2361259525684491181L; - + private final String path; PathReplace(IPath path) { this.path = path.toPortableString(); } - + IPath getPath() { return Path.fromPortableString(path); } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathVariableInitializer.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathVariableInitializer.java index adda6229..2a6f1f8c 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathVariableInitializer.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenClasspathVariableInitializer.java @@ -11,14 +11,14 @@ package org.eclipse.m2e.jdt.internal; - import org.eclipse.jdt.core.ClasspathVariableInitializer; import org.eclipse.m2e.jdt.MavenJdtPlugin; + /** * Maven classpath variable initializer is used to handle M2_REPO variable. - * + * * @author Eugene Kuleshov */ public class MavenClasspathVariableInitializer extends ClasspathVariableInitializer { diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenJdtImages.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenJdtImages.java index 3fc01b02..d461778b 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenJdtImages.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/MavenJdtImages.java @@ -31,18 +31,17 @@ public class MavenJdtImages { // object images // public static final Image IMG_CLEAR = createImage("clear.gif"); - + // descriptors - + public static final ImageDescriptor JAVA_DOC = create("javadoc.gif"); //$NON-NLS-1$ - - + private static ImageDescriptor create(String key) { try { ImageRegistry imageRegistry = getImageRegistry(); if(imageRegistry != null) { ImageDescriptor imageDescriptor = imageRegistry.getDescriptor(key); - if(imageDescriptor==null) { + if(imageDescriptor == null) { imageDescriptor = createDescriptor(key); imageRegistry.put(key, imageDescriptor); } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/Messages.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/Messages.java index ff330305..4438062c 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/Messages.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/Messages.java @@ -16,7 +16,7 @@ import org.eclipse.osgi.util.NLS; /** * Messages - * + * * @author mkleint */ public class Messages extends NLS { diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/DownloadSourcesAction.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/DownloadSourcesAction.java index 3004402c..01e1e437 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/DownloadSourcesAction.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/DownloadSourcesAction.java @@ -29,22 +29,22 @@ import org.eclipse.m2e.jdt.IClasspathManager; import org.eclipse.m2e.jdt.MavenJdtPlugin; - public class DownloadSourcesAction implements IObjectActionDelegate, IExecutableExtension { //TODO private public static final String ID_SOURCES = "downloadSources"; //$NON-NLS-1$ + //TODO private public static final String ID_JAVADOC = "downloadJavaDoc"; //$NON-NLS-1$ - + private IStructuredSelection selection; private String id; - + public DownloadSourcesAction() { this(ID_SOURCES); } - + public DownloadSourcesAction(String id) { this.id = id; } @@ -53,11 +53,11 @@ public class DownloadSourcesAction implements IObjectActionDelegate, IExecutable * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object) */ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) { - if (data != null) { - id = (String)data; + if(data != null) { + id = (String) data; } - } - + } + public void run(IAction action) { if(selection != null) { IClasspathManager buildpathManager = MavenJdtPlugin.getDefault().getBuildpathManager(); diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/OpenJavaDocAction.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/OpenJavaDocAction.java index c0f28d51..e44a01e0 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/OpenJavaDocAction.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/actions/OpenJavaDocAction.java @@ -44,16 +44,17 @@ import org.eclipse.m2e.core.embedder.IMaven; import org.eclipse.m2e.core.ui.internal.actions.SelectionUtil; import org.eclipse.m2e.jdt.internal.Messages; + /** * Open JavaDoc action - * + * * @author Eugene Kuleshov */ public class OpenJavaDocAction extends ActionDelegate { private static final Logger log = LoggerFactory.getLogger(OpenJavaDocAction.class); public static final String ID = "org.eclipse.m2e.openJavaDocAction"; //$NON-NLS-1$ - + private IStructuredSelection selection; public void selectionChanged(IAction action, ISelection selection) { @@ -63,7 +64,7 @@ public class OpenJavaDocAction extends ActionDelegate { this.selection = null; } } - + public void run(IAction action) { if(selection != null) { try { @@ -73,13 +74,13 @@ public class OpenJavaDocAction extends ActionDelegate { return; } - new Job(NLS.bind(Messages.OpenJavaDocAction_job_open_javadoc,ak)) { + new Job(NLS.bind(Messages.OpenJavaDocAction_job_open_javadoc, ak)) { protected IStatus run(IProgressMonitor monitor) { openJavaDoc(ak.getGroupId(), ak.getArtifactId(), ak.getVersion(), monitor); return Status.OK_STATUS; } }.schedule(); - + } catch(CoreException ex) { log.error(ex.getMessage(), ex); PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @@ -99,9 +100,10 @@ public class OpenJavaDocAction extends ActionDelegate { IMaven maven = MavenPlugin.getMaven(); List<ArtifactRepository> artifactRepositories = maven.getArtifactRepositories(); - - Artifact artifact = maven.resolve(groupId, artifactId, version, "javadoc", "javadoc", artifactRepositories, monitor); //$NON-NLS-1$ //$NON-NLS-2$ - + + Artifact artifact = maven.resolve(groupId, artifactId, version, + "javadoc", "javadoc", artifactRepositories, monitor); //$NON-NLS-1$ //$NON-NLS-2$ + final File file = artifact.getFile(); if(file == null) { openDialog(NLS.bind(Messages.OpenJavaDocAction_error_download, name)); @@ -113,7 +115,7 @@ public class OpenJavaDocAction extends ActionDelegate { try { String url = "jar:" + file.toURI().toString() + "!/index.html"; //$NON-NLS-1$ //$NON-NLS-2$ URL helpUrl = PlatformUI.getWorkbench().getHelpSystem().resolve(url, true); - + IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser = browserSupport.createBrowser(IWorkbenchBrowserSupport.NAVIGATION_BAR, // name, name, name); @@ -123,12 +125,12 @@ public class OpenJavaDocAction extends ActionDelegate { } } }); - + } catch(CoreException ex) { log.error("Can't download JavaDoc for " + name, ex); - openDialog(NLS.bind(Messages.OpenJavaDocAction_error_download,name)); + openDialog(NLS.bind(Messages.OpenJavaDocAction_error_download, name)); // TODO search index and offer to select other version - } + } } @@ -140,5 +142,5 @@ public class OpenJavaDocAction extends ActionDelegate { } }); } - + } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenLaunchConfigurationListener.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenLaunchConfigurationListener.java index 1d3e73fb..108294f3 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenLaunchConfigurationListener.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenLaunchConfigurationListener.java @@ -26,6 +26,7 @@ import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.core.project.IMavenProjectChangedListener; import org.eclipse.m2e.core.project.MavenProjectChangedEvent; + public class MavenLaunchConfigurationListener implements ILaunchConfigurationListener, IMavenProjectChangedListener { private static final Logger log = LoggerFactory.getLogger(MavenLaunchConfigurationListener.class); @@ -43,14 +44,14 @@ public class MavenLaunchConfigurationListener implements ILaunchConfigurationLis private void updateLaunchConfiguration(ILaunchConfiguration configuration) { try { - if (!MavenRuntimeClasspathProvider.isSupportedType(configuration.getType().getIdentifier())) { + if(!MavenRuntimeClasspathProvider.isSupportedType(configuration.getType().getIdentifier())) { return; } - if (configuration.getAttributes().containsKey(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER)) { + if(configuration.getAttributes().containsKey(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER)) { return; } IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); - if (javaProject != null && javaProject.getProject().hasNature(IMavenConstants.NATURE_ID)) { + if(javaProject != null && javaProject.getProject().hasNature(IMavenConstants.NATURE_ID)) { MavenRuntimeClasspathProvider.enable(configuration); } } catch(CoreException ex) { @@ -58,22 +59,22 @@ public class MavenLaunchConfigurationListener implements ILaunchConfigurationLis } } - public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) { - for (MavenProjectChangedEvent event : events) { - try { - switch (event.getKind()) { - case MavenProjectChangedEvent.KIND_ADDED: - MavenRuntimeClasspathProvider.enable(event.getMavenProject().getProject()); - break; - case MavenProjectChangedEvent.KIND_REMOVED: - MavenRuntimeClasspathProvider.disable(event.getOldMavenProject().getProject()); - break; - default: - break; - } - } catch (Exception e) { - log.error("Could not update launch configuration", e); - } - } - } + public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) { + for(MavenProjectChangedEvent event : events) { + try { + switch(event.getKind()) { + case MavenProjectChangedEvent.KIND_ADDED: + MavenRuntimeClasspathProvider.enable(event.getMavenProject().getProject()); + break; + case MavenProjectChangedEvent.KIND_REMOVED: + MavenRuntimeClasspathProvider.disable(event.getOldMavenProject().getProject()); + break; + default: + break; + } + } catch(Exception e) { + log.error("Could not update launch configuration", e); + } + } + } } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java index 938ec521..9516ba11 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenRuntimeClasspathProvider.java @@ -59,7 +59,7 @@ import org.eclipse.m2e.jdt.internal.Messages; public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { - + public static final String MAVEN_SOURCEPATH_PROVIDER = "org.eclipse.m2e.launchconfig.sourcepathProvider"; //$NON-NLS-1$ public static final String MAVEN_CLASSPATH_PROVIDER = "org.eclipse.m2e.launchconfig.classpathProvider"; //$NON-NLS-1$ @@ -71,7 +71,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { public static final String JDT_JUNIT_TEST = "org.eclipse.jdt.junit.launchconfig"; //$NON-NLS-1$ public static final String JDT_JAVA_APPLICATION = "org.eclipse.jdt.launching.localJavaApplication"; //$NON-NLS-1$ - + public static final String JDT_TESTNG_TEST = "org.testng.eclipse.launchconfig"; //$NON-NLS-1$ private static final Set<String> supportedTypes = new HashSet<String>(); @@ -84,13 +84,15 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry(); - public IRuntimeClasspathEntry[] computeUnresolvedClasspath(final ILaunchConfiguration configuration) throws CoreException { + public IRuntimeClasspathEntry[] computeUnresolvedClasspath(final ILaunchConfiguration configuration) + throws CoreException { boolean useDefault = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true); - if (useDefault) { + if(useDefault) { IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); IRuntimeClasspathEntry jreEntry = JavaRuntime.computeJREEntry(configuration); IRuntimeClasspathEntry projectEntry = JavaRuntime.newProjectRuntimeClasspathEntry(javaProject); - IRuntimeClasspathEntry mavenEntry = JavaRuntime.newRuntimeContainerClasspathEntry(new Path(IClasspathManager.CONTAINER_ID), IRuntimeClasspathEntry.USER_CLASSES); + IRuntimeClasspathEntry mavenEntry = JavaRuntime.newRuntimeContainerClasspathEntry(new Path( + IClasspathManager.CONTAINER_ID), IRuntimeClasspathEntry.USER_CLASSES); if(jreEntry == null) { return new IRuntimeClasspathEntry[] {projectEntry, mavenEntry}; @@ -98,7 +100,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { return new IRuntimeClasspathEntry[] {jreEntry, projectEntry, mavenEntry}; } - + return recoverRuntimePath(configuration, IJavaLaunchConfigurationConstants.ATTR_CLASSPATH); } @@ -108,11 +110,12 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { int scope = getArtifactScope(configuration); Set<IRuntimeClasspathEntry> all = new LinkedHashSet<IRuntimeClasspathEntry>(entries.length); for(IRuntimeClasspathEntry entry : entries) { - if (entry.getType() == IRuntimeClasspathEntry.CONTAINER && MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) { + if(entry.getType() == IRuntimeClasspathEntry.CONTAINER + && MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) { addMavenClasspathEntries(all, entry, configuration, scope, monitor); - } else if (entry.getType() == IRuntimeClasspathEntry.PROJECT) { + } else if(entry.getType() == IRuntimeClasspathEntry.PROJECT) { IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); - if (javaProject.getPath().equals(entry.getPath())) { + if(javaProject.getPath().equals(entry.getPath())) { addProjectEntries(all, entry.getPath(), scope, THIS_PROJECT_CLASSIFIER, configuration, monitor); } else { addStandardClasspathEntries(all, entry, configuration); @@ -124,24 +127,23 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { return all.toArray(new IRuntimeClasspathEntry[all.size()]); } - private void addStandardClasspathEntries(Set<IRuntimeClasspathEntry> all, IRuntimeClasspathEntry entry, ILaunchConfiguration configuration) - throws CoreException - { + private void addStandardClasspathEntries(Set<IRuntimeClasspathEntry> all, IRuntimeClasspathEntry entry, + ILaunchConfiguration configuration) throws CoreException { IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveRuntimeClasspathEntry(entry, configuration); - for (int j = 0; j < resolved.length; j++) { + for(int j = 0; j < resolved.length; j++ ) { all.add(resolved[j]); } } - private void addMavenClasspathEntries(Set<IRuntimeClasspathEntry> resolved, IRuntimeClasspathEntry runtimeClasspathEntry, - ILaunchConfiguration configuration, int scope, IProgressMonitor monitor) throws CoreException - { + private void addMavenClasspathEntries(Set<IRuntimeClasspathEntry> resolved, + IRuntimeClasspathEntry runtimeClasspathEntry, ILaunchConfiguration configuration, int scope, + IProgressMonitor monitor) throws CoreException { IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); MavenJdtPlugin plugin = MavenJdtPlugin.getDefault(); IClasspathManager buildpathManager = plugin.getBuildpathManager(); IClasspathEntry[] cp = buildpathManager.getClasspath(javaProject.getProject(), scope, false, monitor); for(IClasspathEntry entry : cp) { - switch (entry.getEntryKind()) { + switch(entry.getEntryKind()) { case IClasspathEntry.CPE_PROJECT: addProjectEntries(resolved, entry.getPath(), scope, getArtifactClassifier(entry), configuration, monitor); break; @@ -157,11 +159,11 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { protected int getArtifactScope(ILaunchConfiguration configuration) throws CoreException { String typeid = configuration.getType().getAttribute("id"); //$NON-NLS-1$ - if (JDT_JAVA_APPLICATION.equals(typeid)) { + if(JDT_JAVA_APPLICATION.equals(typeid)) { IResource[] resources = configuration.getMappedResources(); // MNGECLIPSE-530: NPE starting openarchitecture workflow - if (resources == null || resources.length == 0) { + if(resources == null || resources.length == 0) { return IClasspathManager.CLASSPATH_RUNTIME; } @@ -169,15 +171,15 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { final Set<IPath> testSources = new HashSet<IPath>(); IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); IMavenProjectFacade facade = projectManager.create(javaProject.getProject(), new NullProgressMonitor()); - if (facade == null) { + if(facade == null) { return IClasspathManager.CLASSPATH_RUNTIME; } - + testSources.addAll(Arrays.asList(facade.getTestCompileSourceLocations())); - for (int i = 0; i < resources.length; i++) { - for (IPath testPath : testSources) { - if (testPath.isPrefixOf(resources[i].getProjectRelativePath())) { + for(int i = 0; i < resources.length; i++ ) { + for(IPath testPath : testSources) { + if(testPath.isPrefixOf(resources[i].getProjectRelativePath())) { return IClasspathManager.CLASSPATH_TEST; } } @@ -186,12 +188,13 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { } else if(JDT_JUNIT_TEST.equals(typeid) || JDT_TESTNG_TEST.equals(typeid)) { return IClasspathManager.CLASSPATH_TEST; } else { - throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, 0, - NLS.bind(Messages.MavenRuntimeClasspathProvider_error_unsupported, typeid), null)); + throw new CoreException(new Status(IStatus.ERROR, IMavenConstants.PLUGIN_ID, 0, NLS.bind( + Messages.MavenRuntimeClasspathProvider_error_unsupported, typeid), null)); } } - protected void addProjectEntries(Set<IRuntimeClasspathEntry> resolved, IPath path, int scope, String classifier, ILaunchConfiguration launchConfiguration, final IProgressMonitor monitor) throws CoreException { + protected void addProjectEntries(Set<IRuntimeClasspathEntry> resolved, IPath path, int scope, String classifier, + ILaunchConfiguration launchConfiguration, final IProgressMonitor monitor) throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(path.segment(0)); @@ -201,7 +204,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { } ResolverConfiguration configuration = projectFacade.getResolverConfiguration(); - if (configuration == null) { + if(configuration == null) { return; } @@ -217,14 +220,14 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { boolean projectResolved = false; for(IClasspathEntry entry : javaProject.getRawClasspath()) { IRuntimeClasspathEntry rce = null; - switch (entry.getEntryKind()) { + switch(entry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: - if (!projectResolved) { - if (IClasspathManager.CLASSPATH_TEST == scope && isTestClassifier(classifier)) { + if(!projectResolved) { + if(IClasspathManager.CLASSPATH_TEST == scope && isTestClassifier(classifier)) { // ECLIPSE-19: test classes come infront on the rest addFolders(resolved, project, allTestClasses); } - if (isMainClassifier(classifier)) { + if(isMainClassifier(classifier)) { addFolders(resolved, project, allClasses); } projectResolved = true; @@ -232,10 +235,11 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { break; case IClasspathEntry.CPE_CONTAINER: IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), javaProject); - if (container != null && !MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) { - switch (container.getKind()) { + if(container != null && !MavenClasspathHelpers.isMaven2ClasspathContainer(entry.getPath())) { + switch(container.getKind()) { case IClasspathContainer.K_APPLICATION: - rce = JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.USER_CLASSES, javaProject); + rce = JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(), + IRuntimeClasspathEntry.USER_CLASSES, javaProject); break; // case IClasspathContainer.K_DEFAULT_SYSTEM: // unresolved.add(JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(), IRuntimeClasspathEntry.STANDARD_CLASSES, javaProject)); @@ -250,15 +254,15 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { rce = JavaRuntime.newArchiveRuntimeClasspathEntry(entry.getPath()); break; case IClasspathEntry.CPE_VARIABLE: - if (!JavaRuntime.JRELIB_VARIABLE.equals(entry.getPath().segment(0))) { + if(!JavaRuntime.JRELIB_VARIABLE.equals(entry.getPath().segment(0))) { rce = JavaRuntime.newVariableRuntimeClasspathEntry(entry.getPath()); } break; case IClasspathEntry.CPE_PROJECT: IProject res = root.getProject(entry.getPath().segment(0)); - if (res != null) { + if(res != null) { IJavaProject otherProject = JavaCore.create(res); - if (otherProject != null) { + if(otherProject != null) { rce = JavaRuntime.newDefaultProjectClasspathEntry(otherProject); } } @@ -266,7 +270,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { default: break; } - if (rce != null) { + if(rce != null) { addStandardClasspathEntries(resolved, rce, launchConfiguration); } } @@ -297,7 +301,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { } public static void enable(ILaunchConfiguration config) throws CoreException { - if (config instanceof ILaunchConfigurationWorkingCopy) { + if(config instanceof ILaunchConfigurationWorkingCopy) { enable((ILaunchConfigurationWorkingCopy) config); } else { ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy(); @@ -317,7 +321,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_SOURCE_PATH_PROVIDER, (String) null); wc.doSave(); } - + private static String getArtifactClassifier(IClasspathEntry entry) { IClasspathAttribute[] attributes = entry.getExtraAttributes(); for(IClasspathAttribute attribute : attributes) { @@ -335,7 +339,7 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { } } } - + public static void disable(IProject project) throws CoreException { for(ILaunchConfiguration config : getLaunchConfiguration(project)) { if(isSupportedType(config.getType().getIdentifier())) { @@ -350,8 +354,8 @@ public class MavenRuntimeClasspathProvider extends StandardClasspathProvider { ILaunchConfiguration[] configurations = launchManager.getLaunchConfigurations(); for(ILaunchConfiguration config : configurations) { String projectName = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String) null); - if (project.getName().equals(projectName)) { - result.add(config); + if(project.getName().equals(projectName)) { + result.add(config); } } return result; diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenSourcePathProvider.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenSourcePathProvider.java index d13145ab..7d728745 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenSourcePathProvider.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/launch/MavenSourcePathProvider.java @@ -27,7 +27,6 @@ import org.eclipse.jdt.launching.IRuntimeClasspathEntry; import org.eclipse.jdt.launching.JavaRuntime; - public class MavenSourcePathProvider extends MavenRuntimeClasspathProvider { public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration configuration) throws CoreException { @@ -41,7 +40,8 @@ public class MavenSourcePathProvider extends MavenRuntimeClasspathProvider { } @Override - protected void addProjectEntries(Set<IRuntimeClasspathEntry> resolved, IPath path, int scope, String classifier, ILaunchConfiguration launchConfiguration, final IProgressMonitor monitor) { + protected void addProjectEntries(Set<IRuntimeClasspathEntry> resolved, IPath path, int scope, String classifier, + ILaunchConfiguration launchConfiguration, final IProgressMonitor monitor) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject project = root.getProject(path.segment(0)); IJavaProject javaProject = JavaCore.create(project); diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/MavenClasspathContainerPage.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/MavenClasspathContainerPage.java index cd393214..82dc69b7 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/MavenClasspathContainerPage.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/MavenClasspathContainerPage.java @@ -40,7 +40,7 @@ public class MavenClasspathContainerPage extends WizardPage implements IClasspat IJavaProject javaProject; private IClasspathEntry containerEntry; - + public MavenClasspathContainerPage() { super(Messages.MavenClasspathContainerPage_title); } @@ -66,7 +66,6 @@ public class MavenClasspathContainerPage extends WizardPage implements IClasspat setTitle(Messages.MavenClasspathContainerPage_control_title); setDescription(Messages.MavenClasspathContainerPage_control_desc); - Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); setControl(composite); @@ -78,7 +77,7 @@ public class MavenClasspathContainerPage extends WizardPage implements IClasspat public void widgetSelected(SelectionEvent e) { // IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer(); // container.openPage(MavenProjectPreferencePage.ID, javaProject.getProject()); - + PreferencesUtil.createPropertyDialogOn(getShell(), javaProject.getProject(), // IMavenConstants.PREFERENCE_PAGE_ID, new String[] {IMavenConstants.PREFERENCE_PAGE_ID}, null).open(); } diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/filter/MavenModuleFilter.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/filter/MavenModuleFilter.java index c5b300b3..e2099f6d 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/filter/MavenModuleFilter.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/ui/filter/MavenModuleFilter.java @@ -28,9 +28,10 @@ import org.eclipse.m2e.core.internal.IMavenConstants; import org.eclipse.m2e.core.project.IMavenProjectFacade; import org.eclipse.m2e.core.project.IMavenProjectRegistry; + /** * MavenModuleFilter - * + * * @author Eugene Kuleshov */ public class MavenModuleFilter extends ViewerFilter { @@ -64,10 +65,9 @@ public class MavenModuleFilter extends ViewerFilter { } catch(CoreException ex) { log.error(ex.getMessage(), ex); } - + } return true; } } - |