Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2012-12-31 23:21:03 -0500
committerIgor Fedorenko2012-12-31 23:21:03 -0500
commita8b5512972ebd9a273b8955fd1306e039428d400 (patch)
treef6cd368f8ee88082c81eb7087dcbe3bfed3997f6 /org.eclipse.m2e.editor
parentcf04c93473bf354448dd453877b688643d4d5cf9 (diff)
downloadm2e-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.editor')
-rw-r--r--org.eclipse.m2e.editor/.settings/org.eclipse.jdt.core.prefs78
-rw-r--r--org.eclipse.m2e.editor/.settings/org.eclipse.jdt.ui.prefs67
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorImages.java79
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorPlugin.java14
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComparator.java35
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java337
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyLabelProvider.java128
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java31
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorContentProvider.java15
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/SectionExpansionAdapter.java8
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/StringLabelProvider.java3
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java146
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/MavenModuleSelectionDialog.java5
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/actions/ShowDependencyHierarchyAction.java11
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependenciesPage.java34
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java114
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ElementValueProvider.java19
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java78
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/Matcher.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditor.java414
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorContributor.java28
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java292
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPageFactory.java2
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java291
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java102
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ScopeArtifactFilter.java8
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchControl.java15
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchMatcher.java3
-rw-r--r--org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ValueProvider.java4
30 files changed, 1318 insertions, 1047 deletions
diff --git a/org.eclipse.m2e.editor/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.m2e.editor/.settings/org.eclipse.jdt.core.prefs
index 62825a63..80d9c54b 100644
--- a/org.eclipse.m2e.editor/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.m2e.editor/.settings/org.eclipse.jdt.core.prefs
@@ -1,13 +1,22 @@
-#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
org.eclipse.jdt.core.builder.invalidClasspath=abort
org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.uad,*.ucd,*.uld,*.upd,*.udd,*.uod,*.usd,*.utd,*.uud,*.odd,*.ead,*.ecd,*.eld,*.epd,*.edd,*.eod,*.esd,*.etd,*.eud,*.urd*.uml,*.ecore,,*.launch,*.ucls
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.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
@@ -15,13 +24,16 @@ org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.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=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
@@ -30,58 +42,76 @@ org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.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=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
-org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
+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
@@ -92,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
@@ -136,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
@@ -157,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
@@ -223,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
@@ -252,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
@@ -307,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
@@ -316,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
@@ -325,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
@@ -337,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.editor/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.m2e.editor/.settings/org.eclipse.jdt.ui.prefs
index ee9d1387..595d9975 100644
--- a/org.eclipse.m2e.editor/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.m2e.editor/.settings/org.eclipse.jdt.ui.prefs
@@ -1,5 +1,66 @@
eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_m2 plugin
-formatter_settings_version=11
-org.eclipse.jdt.ui.javadoc=false
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\n * Copyright (c) 2010 Sonatype, Inc.\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * Sonatype, Inc. - initial API and implementation\n *******************************************************************************/</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="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\nMavenPlugin.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 stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+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
+org.eclipse.jdt.ui.importorder=java;javax;org;org.w3c;org.xml;org.apache;com;junit;org.eclipse;org.codehaus;org.apache.lucene;org.apache.maven;org.sonatype;org.eclipse.m2e;
+org.eclipse.jdt.ui.javadoc=true
+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\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.editor/src/org/eclipse/m2e/editor/MavenEditorImages.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorImages.java
index 598c01fc..fad30c39 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorImages.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorImages.java
@@ -11,12 +11,14 @@
package org.eclipse.m2e.editor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
/**
* @author Eugene Kuleshov
@@ -25,39 +27,39 @@ public class MavenEditorImages {
private static final Logger log = LoggerFactory.getLogger(MavenEditorImages.class);
// images
-
+
public static final Image IMG_CLEAR = createImage("clear.gif"); //$NON-NLS-1$
-
+
public static final Image IMG_CLEAR_DISABLED = createImage("clear_disabled.gif"); //$NON-NLS-1$
-
- public static final Image IMG_PROJECT = createImage("project_obj.gif"); //$NON-NLS-1$
+
+ public static final Image IMG_PROJECT = createImage("project_obj.gif"); //$NON-NLS-1$
// object images
-
- public static final Image IMG_JAR = createImage("jar_obj.gif"); //$NON-NLS-1$
-
+
+ public static final Image IMG_JAR = createImage("jar_obj.gif"); //$NON-NLS-1$
+
public static final Image IMG_INHERITED = createImage("inherited_obj.gif"); //$NON-NLS-1$
- public static final Image IMG_REPOSITORY = createImage("repository_obj.gif"); //$NON-NLS-1$
-
- public static final Image IMG_PLUGIN = createImage("plugin_obj.gif"); //$NON-NLS-1$
+ public static final Image IMG_REPOSITORY = createImage("repository_obj.gif"); //$NON-NLS-1$
+
+ public static final Image IMG_PLUGIN = createImage("plugin_obj.gif"); //$NON-NLS-1$
public static final Image IMG_EXECUTION = createImage("execution_obj.gif"); //$NON-NLS-1$
-
- public static final Image IMG_GOAL = createImage("goal_obj.gif"); //$NON-NLS-1$
- public static final Image IMG_FILTER = createImage("filter_obj.gif"); //$NON-NLS-1$
+ public static final Image IMG_GOAL = createImage("goal_obj.gif"); //$NON-NLS-1$
+
+ public static final Image IMG_FILTER = createImage("filter_obj.gif"); //$NON-NLS-1$
+
+ public static final Image IMG_RESOURCE = createImage("resource_obj.gif"); //$NON-NLS-1$
- public static final Image IMG_RESOURCE = createImage("resource_obj.gif"); //$NON-NLS-1$
+ public static final Image IMG_INCLUDE = createImage("include_obj.gif"); //$NON-NLS-1$
+
+ public static final Image IMG_EXCLUDE = createImage("exclude_obj.gif"); //$NON-NLS-1$
- public static final Image IMG_INCLUDE = createImage("include_obj.gif"); //$NON-NLS-1$
-
- public static final Image IMG_EXCLUDE = createImage("exclude_obj.gif"); //$NON-NLS-1$
-
public static final Image IMG_PERSON = createImage("person_obj.gif"); //$NON-NLS-1$
-
+
public static final Image IMG_ROLE = createImage("role_obj.gif"); //$NON-NLS-1$
-
+
public static final Image IMG_PROPERTY = createImage("property_obj.gif"); //$NON-NLS-1$
public static final Image IMG_REPORT = createImage("report_obj.gif"); //$NON-NLS-1$
@@ -65,35 +67,35 @@ public class MavenEditorImages {
public static final Image IMG_PROFILE = createImage("profile_obj.gif"); //$NON-NLS-1$
public static final Image IMG_SCOPE = createImage("scope_obj.gif"); //$NON-NLS-1$
-
+
// image descriptors
-
- public static final ImageDescriptor REFRESH = create("refresh.gif"); //$NON-NLS-1$
-
+
+ public static final ImageDescriptor REFRESH = create("refresh.gif"); //$NON-NLS-1$
+
public static final ImageDescriptor COLLAPSE_ALL = create("collapseall.gif"); //$NON-NLS-1$
public static final ImageDescriptor EXPAND_ALL = create("expandall.gif"); //$NON-NLS-1$
public static final ImageDescriptor SHOW_GROUP = create("show_group.gif"); //$NON-NLS-1$
-
+
public static final ImageDescriptor SHOW_INHERITED_DEPENDENCIES = create("show_inherited_dependencies.gif"); //$NON-NLS-1$
public static final ImageDescriptor ADD_MODULE = create("new_project.gif"); //$NON-NLS-1$
public static final ImageDescriptor ADD_ARTIFACT = create("new_jar.gif"); //$NON-NLS-1$
-
+
public static final ImageDescriptor SELECT_ARTIFACT = create("select_jar.gif"); //$NON-NLS-1$
-
+
public static final ImageDescriptor ADD_PLUGIN = create("new_plugin.gif"); //$NON-NLS-1$
-
+
public static final ImageDescriptor SELECT_PLUGIN = create("select_plugin.gif"); //$NON-NLS-1$
-
+
public static final ImageDescriptor SORT = create("sort.gif"); //$NON-NLS-1$
public static final ImageDescriptor FILTER = create("filter.gif"); //$NON-NLS-1$
public static final ImageDescriptor EFFECTIVE_POM = create("effective_pom.gif"); //$NON-NLS-1$
-
+
public static final ImageDescriptor PARENT_POM = create("parent_pom.gif"); //$NON-NLS-1$
public static final ImageDescriptor WEB_PAGE = create("web.gif"); //$NON-NLS-1$
@@ -101,21 +103,20 @@ public class MavenEditorImages {
public static final ImageDescriptor HIERARCHY = create("hierarchy.gif"); //$NON-NLS-1$
public static final ImageDescriptor SCOPE = create("scope.gif"); //$NON-NLS-1$
-
+
public static final ImageDescriptor ADVANCED_TABS = create("advanced_tabs.gif"); //$NON-NLS-1$
public static final ImageDescriptor ELEMENT_OBJECT = create("element_obj.gif"); //$NON-NLS-1$
-
private static ImageDescriptor create(String key) {
try {
ImageDescriptor imageDescriptor = createDescriptor(key);
ImageRegistry imageRegistry = getImageRegistry();
- if(imageRegistry!=null) {
+ if(imageRegistry != null) {
imageRegistry.put(key, imageDescriptor);
}
return imageDescriptor;
- } catch (Exception ex) {
+ } catch(Exception ex) {
log.error(key, ex);
return null;
}
@@ -124,16 +125,16 @@ public class MavenEditorImages {
private static Image createImage(String key) {
create(key);
ImageRegistry imageRegistry = getImageRegistry();
- return imageRegistry==null ? null : imageRegistry.get(key);
+ return imageRegistry == null ? null : imageRegistry.get(key);
}
private static ImageRegistry getImageRegistry() {
MavenEditorPlugin plugin = MavenEditorPlugin.getDefault();
- return plugin==null ? null : plugin.getImageRegistry();
+ return plugin == null ? null : plugin.getImageRegistry();
}
private static ImageDescriptor createDescriptor(String image) {
return AbstractUIPlugin.imageDescriptorFromPlugin(MavenEditorPlugin.PLUGIN_ID, "icons/" + image); //$NON-NLS-1$
}
-
+
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorPlugin.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorPlugin.java
index 2a1454e8..53612937 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorPlugin.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/MavenEditorPlugin.java
@@ -11,35 +11,37 @@
package org.eclipse.m2e.editor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
/**
* @author Eugene Kuleshov
*/
public class MavenEditorPlugin extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.eclipse.m2e.editor"; //$NON-NLS-1$
-
+
private static MavenEditorPlugin instance;
public MavenEditorPlugin() {
}
-
+
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
instance = this;
}
-
+
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
instance = null;
}
-
+
public static MavenEditorPlugin getDefault() {
return instance;
}
-
+
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComparator.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComparator.java
index 8727e122..8eb60ce3 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComparator.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComparator.java
@@ -8,27 +8,27 @@
* Contributors:
* Sonatype, Inc. - initial API and implementation
*******************************************************************************/
+
package org.eclipse.m2e.editor.composites;
import java.util.Comparator;
public class DependenciesComparator<T> implements Comparator<T> {
-
+
private boolean sortByGroups = true;
-
+
public int compare(T o1, T o2) {
String[] gav1;
String[] gav2;
-
+
gav1 = toGAV((org.apache.maven.model.Dependency) o1);
-
+
gav2 = toGAV((org.apache.maven.model.Dependency) o2);
-
+
return compareGAVs(gav1, gav2);
}
-
-
+
protected String[] toGAV(org.apache.maven.model.Dependency dep) {
String[] gav = new String[3];
gav[0] = dep.getGroupId();
@@ -36,28 +36,28 @@ public class DependenciesComparator<T> implements Comparator<T> {
gav[2] = dep.getVersion();
return gav;
}
-
+
protected int compareGAVs(String[] gav1, String[] gav2) {
-
+
String g1 = gav1[0] == null ? "" : gav1[0]; //$NON-NLS-1$
String g2 = gav2[0] == null ? "" : gav2[0]; //$NON-NLS-1$
-
+
String a1 = gav1[1] == null ? "" : gav1[1]; //$NON-NLS-1$
String a2 = gav2[1] == null ? "" : gav2[1]; //$NON-NLS-1$
-
+
String v1 = gav1[2] == null ? "" : gav1[2]; //$NON-NLS-1$
String v2 = gav2[2] == null ? "" : gav2[2]; //$NON-NLS-1$
return compareDependencies(g1, a1, v1, g2, a2, v2);
}
-
- protected int compareDependencies(String group1, String artifact1, String version1,
- String group2, String artifact2, String version2) {
+
+ protected int compareDependencies(String group1, String artifact1, String version1, String group2, String artifact2,
+ String version2) {
int comp = 0;
- if (sortByGroups && (comp = group1.compareTo(group2)) != 0) {
+ if(sortByGroups && (comp = group1.compareTo(group2)) != 0) {
return comp;
}
- if ((comp = artifact1.compareTo(artifact2)) != 0) {
+ if((comp = artifact1.compareTo(artifact2)) != 0) {
return comp;
}
@@ -66,9 +66,10 @@ public class DependenciesComparator<T> implements Comparator<T> {
/**
* Set this to false to ignore groupIDs while sorting
+ *
* @param sortByGroups
*/
public void setSortByGroups(boolean sortByGroups) {
this.sortByGroups = sortByGroups;
}
-} \ No newline at end of file
+}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
index d3c23aae..36b4ecde 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependenciesComposite.java
@@ -11,7 +11,25 @@
package org.eclipse.m2e.editor.composites;
-import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.*;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.ARTIFACT_ID;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.CLASSIFIER;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEPENDENCIES;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEPENDENCY;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEPENDENCY_MANAGEMENT;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.GROUP_ID;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.OPTIONAL;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.SCOPE;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.SYSTEM_PATH;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.TYPE;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.VERSION;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.childEquals;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChilds;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getTextValue;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.performOnDOMDocument;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeIfNoChildElement;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -20,9 +38,12 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.project.MavenProject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -40,6 +61,24 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.project.MavenProject;
+
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.ArtifactKey;
import org.eclipse.m2e.core.internal.index.IndexedArtifactFile;
@@ -60,24 +99,6 @@ import org.eclipse.m2e.editor.pom.MavenPomEditorPage;
import org.eclipse.m2e.editor.pom.SearchControl;
import org.eclipse.m2e.editor.pom.SearchMatcher;
import org.eclipse.m2e.editor.pom.ValueProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
/**
@@ -99,7 +120,7 @@ public class DependenciesComposite extends Composite {
//This ListComposite takes both m2e and maven Dependencies
DependenciesListComposite<Object> dependenciesEditor;
-
+
private final List<String> temporaryRemovedDependencies = new ArrayList<String>();
Button dependencySelectButton;
@@ -129,8 +150,8 @@ public class DependenciesComposite extends Composite {
DependenciesComparator<Dependency> dependencyManagementComparator;
private List<DependenciesComposite.Dependency> dependencies;
- private List<DependenciesComposite.Dependency> manageddependencies;
-
+
+ private List<DependenciesComposite.Dependency> manageddependencies;
public DependenciesComposite(Composite composite, MavenPomEditorPage editorPage, int flags, MavenPomEditor pomEditor) {
super(composite, flags);
@@ -164,30 +185,29 @@ public class DependenciesComposite extends Composite {
Section dependenciesSection = toolkit.createSection(verticalSash, ExpandableComposite.TITLE_BAR);
dependenciesSection.marginWidth = 3;
dependenciesSection.setText(Messages.DependenciesComposite_sectionDependencies);
-
+
dependenciesComparator = new DependenciesComparator<Object>();
dependenciesContentProvider.setComparator(dependenciesComparator);
dependenciesEditor = new DependenciesListComposite<Object>(dependenciesSection, SWT.NONE, true);
- dependenciesEditor.setCellLabelProvider(new DelegatingStyledCellLabelProvider( dependencyLabelProvider));
+ dependenciesEditor.setCellLabelProvider(new DelegatingStyledCellLabelProvider(dependencyLabelProvider));
dependenciesEditor.setContentProvider(dependenciesContentProvider);
dependenciesEditor.setRemoveButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final List<Object> dependencyList = dependenciesEditor.getSelection();
try {
- editorPage.performEditOperation( new Operation() {
+ editorPage.performEditOperation(new Operation() {
public void process(Document document) {
Element deps = findChild(document.getDocumentElement(), DEPENDENCIES);
- if (deps == null) {
+ if(deps == null) {
//TODO log
return;
}
- for (Object dependency : dependencyList) {
- if (dependency instanceof Dependency) {
- Element dep = findChild(deps, DEPENDENCY,
- childEquals(GROUP_ID, ((Dependency)dependency).groupId),
- childEquals(ARTIFACT_ID, ((Dependency)dependency).artifactId));
+ for(Object dependency : dependencyList) {
+ if(dependency instanceof Dependency) {
+ Element dep = findChild(deps, DEPENDENCY, childEquals(GROUP_ID, ((Dependency) dependency).groupId),
+ childEquals(ARTIFACT_ID, ((Dependency) dependency).artifactId));
removeChild(deps, dep);
}
}
@@ -203,10 +223,10 @@ public class DependenciesComposite extends Composite {
dependenciesEditor.setPropertiesListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Object selection = dependenciesEditor.getSelection().get(0);
- if (selection instanceof Dependency) {
+ if(selection instanceof Dependency) {
Dependency dependency = (Dependency) selection;
- EditDependencyDialog d = new EditDependencyDialog(getShell(), false, editorPage
- .getProject(), editorPage.getPomEditor().getMavenProject());
+ EditDependencyDialog d = new EditDependencyDialog(getShell(), false, editorPage.getProject(), editorPage
+ .getPomEditor().getMavenProject());
d.setDependency(toApacheDependency(dependency));
if(d.open() == Window.OK) {
try {
@@ -216,7 +236,7 @@ public class DependenciesComposite extends Composite {
dependenciesEditor.setSelection(Collections.singletonList((Object) dependency));
}
}
- } else if (selection instanceof org.apache.maven.model.Dependency) {
+ } else if(selection instanceof org.apache.maven.model.Dependency) {
/*
* TODO: Support editing or displaying of inherited/managed dependencies.
*/
@@ -235,18 +255,21 @@ public class DependenciesComposite extends Composite {
try {
openManageDependenciesDialog();
} catch(InvocationTargetException e1) {
- MavenEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, "Error: ", e1)); //$NON-NLS-1$
+ MavenEditorPlugin.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, "Error: ", e1)); //$NON-NLS-1$
} catch(InterruptedException e1) {
- MavenEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, "Error: ", e1)); //$NON-NLS-1$
+ MavenEditorPlugin.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, "Error: ", e1)); //$NON-NLS-1$
}
}
});
-
+
dependenciesEditor.setAddButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final MavenRepositorySearchDialog addDepDialog = MavenRepositorySearchDialog.createSearchDependencyDialog(
- getShell(), Messages.DependenciesComposite_action_selectDependency, editorPage.getPomEditor().getMavenProject(), editorPage.getProject(), false);
-
+ getShell(), Messages.DependenciesComposite_action_selectDependency, editorPage.getPomEditor()
+ .getMavenProject(), editorPage.getProject(), false);
+
if(addDepDialog.open() == Window.OK) {
final IndexedArtifactFile dep = (IndexedArtifactFile) addDepDialog.getFirstResult();
final String selectedScope = addDepDialog.getSelectedScope();
@@ -254,8 +277,7 @@ public class DependenciesComposite extends Composite {
editorPage.performEditOperation(new Operation() {
public void process(Document document) {
Element depsEl = getChild(document.getDocumentElement(), DEPENDENCIES);
- PomHelper.addOrUpdateDependency(depsEl,
- dep.group, dep.artifact,
+ PomHelper.addOrUpdateDependency(depsEl, dep.group, dep.artifact,
isManaged(dep.group, dep.artifact, dep.version) ? null : dep.version, dep.type, selectedScope,
dep.classifier);
}
@@ -263,8 +285,8 @@ public class DependenciesComposite extends Composite {
} finally {
setDependenciesInput();
List<Dependency> deps = getDependencies();
- if (deps.size() > 0) {
- dependenciesEditor.setSelection(Collections.<Object>singletonList(deps.get(deps.size() - 1)));
+ if(deps.size() > 0) {
+ dependenciesEditor.setSelection(Collections.<Object> singletonList(deps.get(deps.size() - 1)));
}
}
}
@@ -273,41 +295,42 @@ public class DependenciesComposite extends Composite {
});
ToolBarManager modulesToolBarManager = new ToolBarManager(SWT.FLAT);
-
- modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_sortAlphabetically, MavenEditorImages.SORT) {
+
+ modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_sortAlphabetically,
+ MavenEditorImages.SORT) {
{
setChecked(false);
}
-
+
@Override
public int getStyle() {
return AS_CHECK_BOX;
}
-
+
@Override
public void run() {
dependenciesContentProvider.setShouldSort(isChecked());
dependenciesEditor.getViewer().refresh();
}
});
-
- modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_showInheritedDependencies,
+
+ modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_showInheritedDependencies,
MavenEditorImages.SHOW_INHERITED_DEPENDENCIES) {
{
setChecked(false);
}
-
+
@Override
public int getStyle() {
return AS_CHECK_BOX;
}
-
+
@Override
public void run() {
- if (isChecked()) {
- showInheritedDependencies = true;
+ if(isChecked()) {
+ showInheritedDependencies = true;
} else {
- showInheritedDependencies = false;
+ showInheritedDependencies = false;
}
ISelection selection = dependenciesEditor.getViewer().getSelection();
setDependenciesInput();
@@ -315,7 +338,7 @@ public class DependenciesComposite extends Composite {
dependenciesEditor.getViewer().setSelection(selection, true);
}
});
-
+
modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_showgroupid,
MavenEditorImages.SHOW_GROUP) {
{
@@ -379,7 +402,6 @@ public class DependenciesComposite extends Composite {
dependencyManagementEditor.setContentProvider(dependencyManagementContentProvider);
dependencyManagementEditor.setLabelProvider(dependencyManagementLabelProvider);
dependencyManagementSection.setClient(dependencyManagementEditor);
-
dependencyManagementEditor.setRemoveButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -388,13 +410,12 @@ public class DependenciesComposite extends Composite {
editorPage.performEditOperation(new Operation() {
public void process(Document document) {
Element deps = findChild(findChild(document.getDocumentElement(), DEPENDENCY_MANAGEMENT), DEPENDENCIES);
- if (deps == null) {
+ if(deps == null) {
//TODO log
return;
}
- for (Dependency dependency : dependencyList) {
- Element dep = findChild(deps, DEPENDENCY,
- childEquals(GROUP_ID, dependency.groupId),
+ for(Dependency dependency : dependencyList) {
+ Element dep = findChild(deps, DEPENDENCY, childEquals(GROUP_ID, dependency.groupId),
childEquals(ARTIFACT_ID, dependency.artifactId));
removeChild(deps, dep);
}
@@ -407,17 +428,17 @@ public class DependenciesComposite extends Composite {
}
}
});
-
+
dependencyManagementEditor.setPropertiesListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Dependency dependency = dependencyManagementEditor.getSelection().get(0);
- EditDependencyDialog d = new EditDependencyDialog(getShell(), true, editorPage
- .getProject(), editorPage.getPomEditor().getMavenProject());
+ EditDependencyDialog d = new EditDependencyDialog(getShell(), true, editorPage.getProject(), editorPage
+ .getPomEditor().getMavenProject());
d.setDependency(toApacheDependency(dependency));
if(d.open() == Window.OK) {
try {
editorPage.performEditOperation(d.getEditOperation(), log, "Error updating dependency");
- } finally {
+ } finally {
setDependencyManagementInput();
dependencyManagementEditor.setSelection(Collections.singletonList(dependency));
//refresh this one to update decorations..
@@ -443,7 +464,8 @@ public class DependenciesComposite extends Composite {
dependencyManagementEditor.setAddButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final MavenRepositorySearchDialog addDepDialog = MavenRepositorySearchDialog.createSearchDependencyDialog(
- getShell(), Messages.DependenciesComposite_action_selectDependency, editorPage.getPomEditor().getMavenProject(), editorPage.getProject(), true);
+ getShell(), Messages.DependenciesComposite_action_selectDependency, editorPage.getPomEditor()
+ .getMavenProject(), editorPage.getProject(), true);
if(addDepDialog.open() == Window.OK) {
final IndexedArtifactFile dep = (IndexedArtifactFile) addDepDialog.getFirstResult();
final String selectedScope = addDepDialog.getSelectedScope();
@@ -451,45 +473,45 @@ public class DependenciesComposite extends Composite {
editorPage.performEditOperation(new Operation() {
public void process(Document document) {
Element depsEl = getChild(document.getDocumentElement(), DEPENDENCY_MANAGEMENT, DEPENDENCIES);
- PomHelper.addOrUpdateDependency(depsEl,
- dep.group, dep.artifact,
- dep.version, dep.type, selectedScope, dep.classifier);
+ PomHelper.addOrUpdateDependency(depsEl, dep.group, dep.artifact, dep.version, dep.type, selectedScope,
+ dep.classifier);
}
}, log, "errror adding dependency");
} finally {
setDependencyManagementInput();
List<Dependency> dlist = getManagedDependencies();
- if (dlist.size() > 0) {
- dependencyManagementEditor.setSelection(Collections.<Dependency>singletonList(dlist.get(dlist.size() - 1)));
+ if(dlist.size() > 0) {
+ dependencyManagementEditor.setSelection(Collections.<Dependency> singletonList(dlist.get(dlist.size() - 1)));
}
//refresh this one to update decorations..
dependenciesEditor.refresh();
}
-
+
}
}
});
ToolBarManager modulesToolBarManager = new ToolBarManager(SWT.FLAT);
- modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_sortAlphabetically, MavenEditorImages.SORT) {
+ modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_sortAlphabetically,
+ MavenEditorImages.SORT) {
{
setChecked(false);
dependencyManagementContentProvider.setShouldSort(false);
}
-
+
@Override
public int getStyle() {
return AS_CHECK_BOX;
}
-
+
@Override
public void run() {
dependencyManagementContentProvider.setShouldSort(isChecked());
dependencyManagementEditor.getViewer().refresh();
}
});
-
+
modulesToolBarManager.add(new Action(Messages.DependenciesComposite_action_showgroupid,
MavenEditorImages.SHOW_GROUP) {
{
@@ -542,7 +564,6 @@ public class DependenciesComposite extends Composite {
dependencyManagementSection.setTextClient(toolbarComposite);
}
-
public void loadData() {
resetDependencies();
resetManagedDependencies();
@@ -550,7 +571,7 @@ public class DependenciesComposite extends Composite {
@Override
public List<org.apache.maven.model.Dependency> getValue() {
List<org.apache.maven.model.Dependency> toRet = new ArrayList<org.apache.maven.model.Dependency>();
- for (DependenciesComposite.Dependency d : getManagedDependencies()) {
+ for(DependenciesComposite.Dependency d : getManagedDependencies()) {
toRet.add(toApacheDependency(d));
}
return toRet;
@@ -570,7 +591,6 @@ public class DependenciesComposite extends Composite {
}
}
-
public void setSearchControl(SearchControl searchControl) {
if(this.searchControl != null) {
return;
@@ -607,7 +627,6 @@ public class DependenciesComposite extends Composite {
}
-
public static class DependencyFilter extends ViewerFilter {
private SearchMatcher searchMatcher;
@@ -619,7 +638,7 @@ public class DependenciesComposite extends Composite {
if(element instanceof Dependency) {
Dependency d = (Dependency) element;
return searchMatcher.isMatchingArtifact(d.groupId, d.artifactId);
- } else if (element instanceof org.apache.maven.model.Dependency) {
+ } else if(element instanceof org.apache.maven.model.Dependency) {
org.apache.maven.model.Dependency dependency = (org.apache.maven.model.Dependency) element;
return searchMatcher.isMatchingArtifact(dependency.getGroupId(), dependency.getArtifactId());
}
@@ -633,14 +652,15 @@ public class DependenciesComposite extends Composite {
* The head is the child, the tail is the root pom
*/
final LinkedList<MavenProject> hierarchy = new LinkedList<MavenProject>();
-
+
IRunnableWithProgress projectLoader = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry();
IMavenProjectFacade projectFacade = projectManager.create(pomEditor.getPomFile(), true, monitor);
- if (projectFacade != null) {
- hierarchy.addAll(new ParentGatherer(projectFacade.getMavenProject(), projectFacade).getParentHierarchy(monitor));
+ if(projectFacade != null) {
+ hierarchy.addAll(new ParentGatherer(projectFacade.getMavenProject(), projectFacade)
+ .getParentHierarchy(monitor));
}
} catch(CoreException e) {
throw new InvocationTargetException(e);
@@ -650,26 +670,26 @@ public class DependenciesComposite extends Composite {
PlatformUI.getWorkbench().getProgressService().run(false, true, projectLoader);
- if (hierarchy.isEmpty()) {
+ if(hierarchy.isEmpty()) {
//We were unable to read the project metadata above, so there was an error.
//User has already been notified to fix the problem.
return;
}
-
- final ManageDependenciesDialog manageDepDialog = new ManageDependenciesDialog(getShell(), new ValueProvider<List<org.apache.maven.model.Dependency>>() {
- @Override
- public List<org.apache.maven.model.Dependency> getValue() {
- List<org.apache.maven.model.Dependency> toRet = new ArrayList<org.apache.maven.model.Dependency>();
- for (DependenciesComposite.Dependency d : getDependencies()) {
- toRet.add(toApacheDependency(d));
- }
- return toRet;
- }
- }, hierarchy,
- dependenciesEditor.getSelection());
+
+ final ManageDependenciesDialog manageDepDialog = new ManageDependenciesDialog(getShell(),
+ new ValueProvider<List<org.apache.maven.model.Dependency>>() {
+ @Override
+ public List<org.apache.maven.model.Dependency> getValue() {
+ List<org.apache.maven.model.Dependency> toRet = new ArrayList<org.apache.maven.model.Dependency>();
+ for(DependenciesComposite.Dependency d : getDependencies()) {
+ toRet.add(toApacheDependency(d));
+ }
+ return toRet;
+ }
+ }, hierarchy, dependenciesEditor.getSelection());
manageDepDialog.open();
}
-
+
protected void setDependencyManagementInput() {
resetManagedDependencies();
final List<Dependency> managed = getManagedDependencies();
@@ -678,6 +698,7 @@ public class DependenciesComposite extends Composite {
/**
* only to be called within the perform* methods..
+ *
* @param depEl
* @return
*/
@@ -693,67 +714,67 @@ public class DependenciesComposite extends Composite {
dep.optional = Boolean.parseBoolean(getTextValue(findChild(depEl, OPTIONAL)));
return dep;
}
-
+
private final Object MAN_DEP_LOCK = new Object();
private List<Dependency> getManagedDependencies() {
- synchronized (MAN_DEP_LOCK) {
- if (manageddependencies == null) {
+ synchronized(MAN_DEP_LOCK) {
+ if(manageddependencies == null) {
manageddependencies = new ArrayList<Dependency>();
try {
performOnDOMDocument(new OperationTuple(pomEditor.getDocument(), new Operation() {
public void process(Document document) {
Element dms = findChild(findChild(document.getDocumentElement(), DEPENDENCY_MANAGEMENT), DEPENDENCIES);
- for (Element depEl : findChilds(dms, DEPENDENCY)) {
+ for(Element depEl : findChilds(dms, DEPENDENCY)) {
Dependency dep = toDependency(depEl);
- if (dep != null) {
+ if(dep != null) {
manageddependencies.add(dep);
}
}
}
}, true));
- } catch (Exception ex) {
+ } catch(Exception ex) {
log.error("Error loading managed dependencies", ex);
}
}
return manageddependencies;
}
}
-
+
private void resetManagedDependencies() {
- synchronized (MAN_DEP_LOCK) {
+ synchronized(MAN_DEP_LOCK) {
manageddependencies = null;
}
}
-
-
- private final Object DEP_LOCK = new Object();
+
+ private final Object DEP_LOCK = new Object();
+
private List<Dependency> getDependencies() {
- synchronized (DEP_LOCK) {
- if (dependencies == null) {
+ synchronized(DEP_LOCK) {
+ if(dependencies == null) {
dependencies = new ArrayList<Dependency>();
try {
performOnDOMDocument(new OperationTuple(pomEditor.getDocument(), new Operation() {
public void process(Document document) {
Element dms = findChild(document.getDocumentElement(), DEPENDENCIES);
- for (Element depEl : findChilds(dms, DEPENDENCY)) {
+ for(Element depEl : findChilds(dms, DEPENDENCY)) {
Dependency dep = toDependency(depEl);
- if (dep != null) {
+ if(dep != null) {
dependencies.add(dep);
}
}
}
}, true));
- } catch (Exception ex) {
+ } catch(Exception ex) {
log.error("Error loading dependencies", ex);
}
}
return dependencies;
}
}
-
+
private void resetDependencies() {
- synchronized (DEP_LOCK) {
+ synchronized(DEP_LOCK) {
dependencies = null;
}
}
@@ -762,9 +783,9 @@ public class DependenciesComposite extends Composite {
resetDependencies();
List<Object> deps = new ArrayList<Object>();
deps.addAll(getDependencies());
-
- if (showInheritedDependencies) {
-
+
+ if(showInheritedDependencies) {
+
/*
* Add the inherited dependencies into the bunch. But don't we need to
* filter out the dependencies that are duplicated in the M2E model, so
@@ -772,22 +793,21 @@ public class DependenciesComposite extends Composite {
*/
List<org.apache.maven.model.Dependency> allDeps = new LinkedList<org.apache.maven.model.Dependency>();
MavenProject mp = pomEditor.getMavenProject();
- if (mp != null) {
+ if(mp != null) {
allDeps.addAll(mp.getDependencies());
}
- for (org.apache.maven.model.Dependency mavenDep : allDeps) {
+ for(org.apache.maven.model.Dependency mavenDep : allDeps) {
boolean found = false;
Iterator<Dependency> iter = getDependencies().iterator();
- while (!found && iter.hasNext()) {
+ while(!found && iter.hasNext()) {
Dependency m2eDep = iter.next();
- if (mavenDep.getGroupId().equals(m2eDep.groupId)
- && mavenDep.getArtifactId().equals(m2eDep.artifactId)) {
+ if(mavenDep.getGroupId().equals(m2eDep.groupId) && mavenDep.getArtifactId().equals(m2eDep.artifactId)) {
found = true;
}
}
- if (!found) {
+ if(!found) {
//now check the temporary keys
- if (!temporaryRemovedDependencies.contains(mavenDep.getGroupId() + ":" + mavenDep.getArtifactId())) {
+ if(!temporaryRemovedDependencies.contains(mavenDep.getGroupId() + ":" + mavenDep.getArtifactId())) {
deps.add(mavenDep);
}
}
@@ -795,15 +815,16 @@ public class DependenciesComposite extends Composite {
}
dependenciesEditor.setInput(deps);
}
-
+
protected class PropertiesListComposite<T> extends ListEditorComposite<T> {
private static final String PROPERTIES_BUTTON_KEY = "PROPERTIES"; //$NON-NLS-1$
+
protected Button properties;
-
+
public PropertiesListComposite(Composite parent, int style, boolean includeSearch) {
super(parent, style, includeSearch);
}
-
+
@Override
protected void createButtons(boolean includeSearch) {
if(includeSearch) {
@@ -813,52 +834,52 @@ public class DependenciesComposite extends Composite {
properties = createButton(Messages.ListEditorComposite_btnProperties);
addButton(PROPERTIES_BUTTON_KEY, properties);
}
-
+
public void setPropertiesListener(SelectionListener listener) {
properties.addSelectionListener(listener);
}
-
+
@Override
protected void viewerSelectionChanged() {
super.viewerSelectionChanged();
updatePropertiesButton();
}
-
+
protected void updatePropertiesButton() {
boolean enable = !viewer.getSelection().isEmpty() && !isBadSelection();
properties.setEnabled(!readOnly && enable);
}
-
+
@Override
protected void updateRemoveButton() {
boolean enable = !viewer.getSelection().isEmpty() && !isBadSelection();
getRemoveButton().setEnabled(!readOnly && enable);
}
-
+
@Override
public void setReadOnly(boolean readOnly) {
super.setReadOnly(readOnly);
updatePropertiesButton();
}
-
+
/**
- * Returns true if the viewer has no input or if there is currently
- * an inherited dependency selected
+ * Returns true if the viewer has no input or if there is currently an inherited dependency selected
+ *
* @return
*/
protected boolean isBadSelection() {
@SuppressWarnings("unchecked")
List<Object> deps = (List<Object>) viewer.getInput();
- if (deps == null || deps.isEmpty()) {
+ if(deps == null || deps.isEmpty()) {
return true;
}
boolean bad = false;
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
@SuppressWarnings("unchecked")
Iterator<Object> iter = selection.iterator();
- while (iter.hasNext()) {
+ while(iter.hasNext()) {
Object obj = iter.next();
- if (obj instanceof org.apache.maven.model.Dependency) {
+ if(obj instanceof org.apache.maven.model.Dependency) {
bad = true;
break;
}
@@ -866,16 +887,16 @@ public class DependenciesComposite extends Composite {
return bad;
}
}
-
+
protected class DependenciesListComposite<T> extends PropertiesListComposite<T> {
private static final String MANAGE = "MANAGE"; //$NON-NLS-1$
+
protected Button manage;
public DependenciesListComposite(Composite parent, int style, boolean includeSearch) {
super(parent, style, includeSearch);
}
-
@Override
protected void createButtons(boolean includeSearch) {
@@ -883,19 +904,19 @@ public class DependenciesComposite extends Composite {
manage = createButton(Messages.DependenciesComposite_manageButton);
addButton(MANAGE, manage);
}
-
+
@Override
protected void viewerSelectionChanged() {
super.viewerSelectionChanged();
updateManageButton();
}
-
+
@Override
public void setReadOnly(boolean readOnly) {
super.setReadOnly(readOnly);
updateManageButton();
}
-
+
@Override
public void refresh() {
super.refresh();
@@ -913,7 +934,7 @@ public class DependenciesComposite extends Composite {
}
manage.setEnabled(!readOnly && hasNonManaged);
}
-
+
public void setManageButtonListener(SelectionListener listener) {
manage.addSelectionListener(listener);
}
@@ -922,12 +943,12 @@ public class DependenciesComposite extends Composite {
public void mavenProjectHasChanged() {
temporaryRemovedDependencies.clear();
//MNGECLIPSE-2673 when maven project changes and we show the inherited items, update now..
- if (showInheritedDependencies) {
+ if(showInheritedDependencies) {
setDependenciesInput();
}
dependenciesEditor.refresh();
}
-
+
private org.apache.maven.model.Dependency toApacheDependency(Dependency dependency) {
org.apache.maven.model.Dependency toRet = new org.apache.maven.model.Dependency();
toRet.setArtifactId(dependency.artifactId);
@@ -962,19 +983,27 @@ public class DependenciesComposite extends Composite {
class Dependency implements IAdaptable {
String artifactId;
+
String groupId;
+
String version;
+
String type;
+
String classifier;
+
String scope;
+
String systemPath;
+
boolean optional;
-
- public Dependency() {}
+
+ public Dependency() {
+ }
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
- if (ArtifactKey.class.equals(adapter)) {
+ if(ArtifactKey.class.equals(adapter)) {
return new ArtifactKey(groupId, artifactId, version, classifier);
}
return null;
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyLabelProvider.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyLabelProvider.java
index 22fc6e18..a1b37183 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyLabelProvider.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/DependencyLabelProvider.java
@@ -14,16 +14,23 @@ package org.eclipse.m2e.editor.composites;
import java.util.Collection;
import java.util.List;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DependencyManagement;
-import org.apache.maven.model.InputLocation;
-import org.apache.maven.project.MavenProject;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.IDecoration;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.DependencyManagement;
+import org.apache.maven.model.InputLocation;
+import org.apache.maven.project.MavenProject;
+
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.IMavenProjectRegistry;
@@ -32,11 +39,6 @@ import org.eclipse.m2e.editor.MavenEditorImages;
import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.m2e.editor.pom.MavenPomEditor;
import org.eclipse.m2e.editor.pom.ValueProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
/**
@@ -44,7 +46,8 @@ import org.eclipse.swt.widgets.Display;
*
* @author Eugene Kuleshov
*/
-public class DependencyLabelProvider extends LabelProvider implements IColorProvider, DelegatingStyledCellLabelProvider.IStyledLabelProvider {
+public class DependencyLabelProvider extends LabelProvider implements IColorProvider,
+ DelegatingStyledCellLabelProvider.IStyledLabelProvider {
private MavenPomEditor pomEditor;
@@ -63,34 +66,35 @@ public class DependencyLabelProvider extends LabelProvider implements IColorProv
this.showManagedOverlay = showManagedOverlay;
}
- public void setPomEditor(MavenPomEditor pomEditor, ValueProvider<List<org.apache.maven.model.Dependency>> valueProvider) {
+ public void setPomEditor(MavenPomEditor pomEditor,
+ ValueProvider<List<org.apache.maven.model.Dependency>> valueProvider) {
assert pomEditor != null;
this.pomEditor = pomEditor;
this.valueProvider = valueProvider;
}
-
+
public void setShowGroupId(boolean showGroupId) {
this.showGroupId = showGroupId;
}
// IColorProvider
-
+
public Color getForeground(Object element) {
//a workaround to handle display in ManagedDependenciesDialog
//TODO shall have a switch of it's own.. the curse of blind code reuse
- if (showManagedOverlay && element instanceof org.apache.maven.model.Dependency) {
+ if(showManagedOverlay && element instanceof org.apache.maven.model.Dependency) {
//mkleint: let's just assume all maven Dependency instances are inherited
return Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY);
}
return null;
}
-
+
public Color getBackground(Object element) {
return null;
}
-
+
private String[] findManaged(DependenciesComposite.Dependency dep) {
- if (pomEditor != null) {
+ if(pomEditor != null) {
MavenProject mp = pomEditor.getMavenProject();
String version = null;
String scope = null;
@@ -102,33 +106,33 @@ public class DependencyLabelProvider extends LabelProvider implements IColorProv
if(d.getGroupId().equals(dep.groupId) && d.getArtifactId().equals(dep.artifactId)) {
//based on location, try finding a match in the live Model
InputLocation location = d.getLocation("artifactId");
- if (location != null) {
- if (id.equals(location.getSource().getModelId())) {
+ if(location != null) {
+ if(id.equals(location.getSource().getModelId())) {
version = d.getVersion();
scope = d.getScope();
break;
}
}
- return new String [] {d.getVersion(), d.getScope()};
+ return new String[] {d.getVersion(), d.getScope()};
}
}
}
}
List<org.apache.maven.model.Dependency> dm = valueProvider.getValue();
- for (org.apache.maven.model.Dependency modelDep : dm) {
- String modelGroupId = modelDep.getGroupId();
- String modelArtifactId = modelDep.getArtifactId();
- String modelVersion = modelDep.getVersion();
- String modelScope = modelDep.getScope();
- if (modelGroupId != null && modelGroupId.equals(dep.groupId) && modelArtifactId != null
- && modelArtifactId.equals(dep.artifactId)) {
- if (version != null && (modelVersion == null || modelVersion.contains("${"))) {
- //prefer the resolved version to the model one if the model version as expressions..
- return new String[] {version, modelScope == null ? scope : modelScope};
- }
- return new String[] {modelVersion, modelScope == null ? scope : modelScope};
+ for(org.apache.maven.model.Dependency modelDep : dm) {
+ String modelGroupId = modelDep.getGroupId();
+ String modelArtifactId = modelDep.getArtifactId();
+ String modelVersion = modelDep.getVersion();
+ String modelScope = modelDep.getScope();
+ if(modelGroupId != null && modelGroupId.equals(dep.groupId) && modelArtifactId != null
+ && modelArtifactId.equals(dep.artifactId)) {
+ if(version != null && (modelVersion == null || modelVersion.contains("${"))) {
+ //prefer the resolved version to the model one if the model version as expressions..
+ return new String[] {version, modelScope == null ? scope : modelScope};
}
+ return new String[] {modelVersion, modelScope == null ? scope : modelScope};
}
+ }
}
return null;
}
@@ -138,9 +142,9 @@ public class DependencyLabelProvider extends LabelProvider implements IColorProv
StyledString ss = new StyledString(getText(element));
DependenciesComposite.Dependency dep = (DependenciesComposite.Dependency) element;
String[] managed = findManaged(dep);
- if (managed != null && managed[0] != null) {
+ if(managed != null && managed[0] != null) {
String man = managed[0];
- if (managed[1] != null && !Artifact.SCOPE_COMPILE.equals(managed[1])) {
+ if(managed[1] != null && !Artifact.SCOPE_COMPILE.equals(managed[1])) {
man = man + "," + managed[1];
}
ss.append(NLS.bind(Messages.DependencyLabelProvider_0, man), StyledString.DECORATIONS_STYLER);
@@ -149,16 +153,16 @@ public class DependencyLabelProvider extends LabelProvider implements IColorProv
}
return new StyledString(getText(element));
}
-
+
// LabelProvider
-
+
@Override
public String getText(Object element) {
if(element instanceof DependenciesComposite.Dependency) {
DependenciesComposite.Dependency dependency = (DependenciesComposite.Dependency) element;
return getText(dependency.groupId, dependency.artifactId, dependency.version, //
dependency.classifier, dependency.type, dependency.scope);
- } else if (element instanceof org.apache.maven.model.Dependency) {
+ } else if(element instanceof org.apache.maven.model.Dependency) {
org.apache.maven.model.Dependency dependency = (org.apache.maven.model.Dependency) element;
return getText(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(),
dependency.getClassifier(), dependency.getType(), dependency.getScope());
@@ -178,10 +182,9 @@ public class DependencyLabelProvider extends LabelProvider implements IColorProv
DependenciesComposite.Dependency dependency = (DependenciesComposite.Dependency) element;
boolean isManaged = showManagedOverlay && findManaged(dependency) != null;
return getImage(dependency.groupId, dependency.artifactId, dependency.version, isManaged);
- } else if (element instanceof org.apache.maven.model.Dependency) {
-
-
- if (!showManagedOverlay) {
+ } else if(element instanceof org.apache.maven.model.Dependency) {
+
+ if(!showManagedOverlay) {
org.apache.maven.model.Dependency dependency = (Dependency) element;
//a workaround to handle display in ManagedDependenciesDialog
//TODO shall have a switch of it's own.. the curse of blind code reuse
@@ -203,34 +206,37 @@ public class DependencyLabelProvider extends LabelProvider implements IColorProv
private Image getImage(String groupId, String artifactId, String version, boolean isManaged) {
// XXX need to resolve actual dependencies (i.e. inheritance, dependency management or properties)
// XXX need to handle version ranges
-
+
if((version == null || version.indexOf("${") > -1) && pomEditor != null) { //$NON-NLS-1$
- MavenProject mavenProject = pomEditor.getMavenProject();
- if(mavenProject != null) {
- Artifact artifact = mavenProject.getArtifactMap().get(groupId + ":" + artifactId); //$NON-NLS-1$
- if(artifact!=null) {
- version = artifact.getVersion();
- }
- if(version==null || version.indexOf("${") > -1) { //$NON-NLS-1$
- Collection<Artifact> artifacts = mavenProject.getManagedVersionMap().values();
- for(Artifact a : artifacts) {
- if(a.getGroupId().equals(groupId) && a.getArtifactId().equals(artifactId)) {
- version = a.getVersion();
- break;
- }
+ MavenProject mavenProject = pomEditor.getMavenProject();
+ if(mavenProject != null) {
+ Artifact artifact = mavenProject.getArtifactMap().get(groupId + ":" + artifactId); //$NON-NLS-1$
+ if(artifact != null) {
+ version = artifact.getVersion();
+ }
+ if(version == null || version.indexOf("${") > -1) { //$NON-NLS-1$
+ Collection<Artifact> artifacts = mavenProject.getManagedVersionMap().values();
+ for(Artifact a : artifacts) {
+ if(a.getGroupId().equals(groupId) && a.getArtifactId().equals(artifactId)) {
+ version = a.getVersion();
+ break;
}
}
}
+ }
}
-
+
if(groupId != null && artifactId != null && version != null) {
IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry();
IMavenProjectFacade projectFacade = projectManager.getMavenProject(groupId, artifactId, version);
if(projectFacade != null) {
- return isManaged ? MavenImages.getOverlayImage(MavenImages.PATH_PROJECT, MavenImages.PATH_LOCK, IDecoration.BOTTOM_LEFT) : MavenEditorImages.IMG_PROJECT;
+ return isManaged ? MavenImages.getOverlayImage(MavenImages.PATH_PROJECT, MavenImages.PATH_LOCK,
+ IDecoration.BOTTOM_LEFT) : MavenEditorImages.IMG_PROJECT;
}
- }
- return isManaged ? MavenImages.getOverlayImage(MavenImages.PATH_JAR, MavenImages.PATH_LOCK, IDecoration.BOTTOM_LEFT) : MavenEditorImages.IMG_JAR;
+ }
+ return isManaged ? MavenImages
+ .getOverlayImage(MavenImages.PATH_JAR, MavenImages.PATH_LOCK, IDecoration.BOTTOM_LEFT)
+ : MavenEditorImages.IMG_JAR;
}
private String getText(String groupId, String artifactId, String version, String classifier, String type, String scope) {
@@ -264,6 +270,4 @@ public class DependencyLabelProvider extends LabelProvider implements IColorProv
return s == null || s.trim().length() == 0;
}
-
-
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java
index 9b4aa9e0..b6e309ce 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorComposite.java
@@ -29,7 +29,6 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
@@ -41,6 +40,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.m2e.editor.internal.Messages;
+
/**
* List editor composite
@@ -49,16 +50,17 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
*/
public class ListEditorComposite<T> extends Composite {
-
TableViewer viewer;
-
+
protected Map<String, Button> buttons = new HashMap<String, Button>(5);
-
+
/*
* Default button keys
*/
private static final String ADD = "ADD"; //$NON-NLS-1$
+
private static final String CREATE = "CREATE"; //$NON-NLS-1$
+
private static final String REMOVE = "REMOVE"; //$NON-NLS-1$
boolean readOnly = false;
@@ -91,7 +93,7 @@ public class ListEditorComposite<T> extends Composite {
});
createButtons(includeSearch);
-
+
int vSpan = buttons.size();
GridData viewerData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, vSpan);
viewerData.widthHint = 100;
@@ -116,7 +118,7 @@ public class ListEditorComposite<T> extends Composite {
public void setLabelProvider(ILabelProvider labelProvider) {
viewer.setLabelProvider(labelProvider);
}
-
+
public void setCellLabelProvider(CellLabelProvider cell) {
column.setLabelProvider(cell);
}
@@ -148,11 +150,11 @@ public class ListEditorComposite<T> extends Composite {
getAddButton().setEnabled(true);
}
}
-
+
protected Button getCreateButton() {
return buttons.get(CREATE);
}
-
+
protected Button getRemoveButton() {
return buttons.get(REMOVE);
}
@@ -194,8 +196,8 @@ public class ListEditorComposite<T> extends Composite {
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
- for (Map.Entry<String, Button> entry : buttons.entrySet()) {
- if (entry.getKey().equals(REMOVE)) {
+ for(Map.Entry<String, Button> entry : buttons.entrySet()) {
+ if(entry.getKey().equals(REMOVE)) {
//Special case, as it makes no sense to enable if it there's nothing selected.
updateRemoveButton();
} else {
@@ -208,7 +210,7 @@ public class ListEditorComposite<T> extends Composite {
protected void viewerSelectionChanged() {
updateRemoveButton();
}
-
+
protected void updateRemoveButton() {
getRemoveButton().setEnabled(!readOnly && !viewer.getSelection().isEmpty());
}
@@ -233,9 +235,8 @@ public class ListEditorComposite<T> extends Composite {
}
/**
- * Create the buttons that populate the column to the right of the ListViewer.
- * Subclasses must call the helper method addButton to add each button to the
- * composite.
+ * Create the buttons that populate the column to the right of the ListViewer. Subclasses must call the helper method
+ * addButton to add each button to the composite.
*
* @param includeSearch true if the search button should be created
*/
@@ -246,7 +247,7 @@ public class ListEditorComposite<T> extends Composite {
createCreateButton();
createRemoveButton();
}
-
+
protected void addButton(String key, Button button) {
buttons.put(key, button);
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorContentProvider.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorContentProvider.java
index 735755c8..b6c21d08 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorContentProvider.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/ListEditorContentProvider.java
@@ -18,22 +18,25 @@ import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
+
/**
* @author Eugene Kuleshov
*/
public class ListEditorContentProvider<T> implements IStructuredContentProvider {
public static final Object[] EMPTY = new Object[0];
+
private boolean shouldSort;
+
private Comparator<T> comparator;
-
+
@SuppressWarnings("unchecked")
public Object[] getElements(Object input) {
if(input instanceof List) {
List<T> list = (List<T>) input;
- if (shouldSort) {
+ if(shouldSort) {
T[] array = (T[]) list.toArray();
- Arrays.<T>sort(array, comparator);
+ Arrays.<T> sort(array, comparator);
return array;
}
return list.toArray();
@@ -43,14 +46,14 @@ public class ListEditorContentProvider<T> implements IStructuredContentProvider
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
-
+
public void dispose() {
}
-
+
public void setShouldSort(boolean shouldSort) {
this.shouldSort = shouldSort;
}
-
+
public void setComparator(Comparator<T> comparator) {
this.comparator = comparator;
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/SectionExpansionAdapter.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/SectionExpansionAdapter.java
index 1f34cec0..a9b940d4 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/SectionExpansionAdapter.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/SectionExpansionAdapter.java
@@ -15,13 +15,15 @@ import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.Section;
+
/**
* An expansion adapter that collapses all the sections in the same row.
*/
public class SectionExpansionAdapter extends ExpansionAdapter {
private boolean inProgress = false;
+
private Section[] sections;
-
+
public SectionExpansionAdapter(Section[] sections) {
this.sections = sections;
for(Section section : sections) {
@@ -32,8 +34,8 @@ public class SectionExpansionAdapter extends ExpansionAdapter {
public void expansionStateChanged(ExpansionEvent e) {
if(!inProgress && e.getSource() instanceof Section) {
inProgress = true;
- boolean expand = ((Section)e.getSource()).isExpanded();
-
+ boolean expand = ((Section) e.getSource()).isExpanded();
+
for(Section section : sections) {
section.setExpanded(expand);
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/StringLabelProvider.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/StringLabelProvider.java
index 270be049..612cfdaa 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/StringLabelProvider.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/composites/StringLabelProvider.java
@@ -14,6 +14,7 @@ package org.eclipse.m2e.editor.composites;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
+
/**
* Label provider for <code>String</code> entries
*
@@ -36,4 +37,4 @@ public class StringLabelProvider extends LabelProvider {
public Image getImage(Object element) {
return img;
}
-} \ No newline at end of file
+}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
index 4b3feb64..35657975 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/ManageDependenciesDialog.java
@@ -27,8 +27,12 @@ import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.project.MavenProject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -44,18 +48,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.m2e.core.ui.internal.components.PomHierarchyComposite;
-import org.eclipse.m2e.core.ui.internal.dialogs.AbstractMavenDialog;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits.CompoundOperation;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple;
-import org.eclipse.m2e.core.ui.internal.editing.PomHelper;
-import org.eclipse.m2e.editor.MavenEditorPlugin;
-import org.eclipse.m2e.editor.composites.DependencyLabelProvider;
-import org.eclipse.m2e.editor.composites.ListEditorContentProvider;
-import org.eclipse.m2e.editor.pom.ValueProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
@@ -71,10 +63,23 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+
+import org.apache.maven.model.Dependency;
+import org.apache.maven.project.MavenProject;
+
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.ui.internal.components.PomHierarchyComposite;
+import org.eclipse.m2e.core.ui.internal.dialogs.AbstractMavenDialog;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.CompoundOperation;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple;
+import org.eclipse.m2e.core.ui.internal.editing.PomHelper;
+import org.eclipse.m2e.editor.MavenEditorPlugin;
+import org.eclipse.m2e.editor.composites.DependencyLabelProvider;
+import org.eclipse.m2e.editor.composites.ListEditorContentProvider;
+import org.eclipse.m2e.editor.pom.ValueProvider;
+
/**
* This dialog is used to present the user with a list of dialogs that they can move to being managed under
@@ -94,21 +99,22 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
private PomHierarchyComposite pomHierarchy;
private IStatus status;
-
+
private List<Object> originalSelection;
-
+
private ValueProvider<List<Dependency>> modelVProvider;
/**
* Hierarchy is a LinkedList representing the hierarchy relationship between POM represented by model and its parents.
* The head of the list should be the child, while the tail should be the root parent, with the others in between.
*/
- public ManageDependenciesDialog(Shell parent, ValueProvider<List<Dependency>> modelVProvider, LinkedList<MavenProject> hierarchy) {
+ public ManageDependenciesDialog(Shell parent, ValueProvider<List<Dependency>> modelVProvider,
+ LinkedList<MavenProject> hierarchy) {
this(parent, modelVProvider, hierarchy, null);
}
- public ManageDependenciesDialog(Shell parent, ValueProvider<List<Dependency>> modelVProvider, LinkedList<MavenProject> hierarchy,
- List<Object> selection) {
+ public ManageDependenciesDialog(Shell parent, ValueProvider<List<Dependency>> modelVProvider,
+ LinkedList<MavenProject> hierarchy, List<Object> selection) {
super(parent, DIALOG_SETTINGS);
setShellStyle(getShellStyle() | SWT.RESIZE);
@@ -208,9 +214,9 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
//MNGECLIPSE-2675 only show the dependencies not already managed (decide just by absence of the version element
List<Dependency> deps = modelVProvider.getValue();
List<Dependency> nonManaged = new ArrayList<Dependency>();
- if (deps != null) {
- for (Dependency d : deps) {
- if (d.getVersion() != null) {
+ if(deps != null) {
+ for(Dependency d : deps) {
+ if(d.getVersion() != null) {
nonManaged.add(d);
}
}
@@ -226,7 +232,7 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
if(originalSelection != null && originalSelection.size() > 0) {
dependenciesViewer.setSelection(new StructuredSelection(originalSelection));
}
-
+
return composite;
}
@@ -235,17 +241,17 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
*/
protected void computeResult() {
MavenProject targetPOM = getTargetPOM();
- IMavenProjectFacade targetFacade = MavenPlugin.getMavenProjectRegistry()
- .getMavenProject(targetPOM.getGroupId(), targetPOM.getArtifactId(), targetPOM.getVersion());
+ IMavenProjectFacade targetFacade = MavenPlugin.getMavenProjectRegistry().getMavenProject(targetPOM.getGroupId(),
+ targetPOM.getArtifactId(), targetPOM.getVersion());
MavenProject currentPOM = projectHierarchy.getFirst();
- IMavenProjectFacade currentFacade = MavenPlugin.getMavenProjectRegistry()
- .getMavenProject(currentPOM.getGroupId(), currentPOM.getArtifactId(), currentPOM.getVersion());
-
- if (targetFacade == null || currentFacade == null) {
- return;
+ IMavenProjectFacade currentFacade = MavenPlugin.getMavenProjectRegistry().getMavenProject(currentPOM.getGroupId(),
+ currentPOM.getArtifactId(), currentPOM.getVersion());
+
+ if(targetFacade == null || currentFacade == null) {
+ return;
}
final boolean same = targetPOM.equals(currentPOM);
-
+
final LinkedList<Dependency> modelDeps = getDependenciesList();
/*
@@ -253,7 +259,6 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
* 2) Add dependencies to dependencyManagement of targetPOM
*/
-
//First we remove the version from the original dependency
final IFile current = currentFacade.getPom();
final IFile target = targetFacade.getPom();
@@ -261,10 +266,12 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- if (same) {
- performOnDOMDocument(new OperationTuple(current, new CompoundOperation(createManageOperation(modelDeps), createRemoveVersionOperation(modelDeps))));
+ if(same) {
+ performOnDOMDocument(new OperationTuple(current, new CompoundOperation(createManageOperation(modelDeps),
+ createRemoveVersionOperation(modelDeps))));
} else {
- performOnDOMDocument(new OperationTuple(target, createManageOperation(modelDeps)), new OperationTuple(current, createRemoveVersionOperation(modelDeps)));
+ performOnDOMDocument(new OperationTuple(target, createManageOperation(modelDeps)), new OperationTuple(
+ current, createRemoveVersionOperation(modelDeps)));
}
} catch(Exception e) {
LOG.error("Error updating managed dependencies", e);
@@ -277,54 +284,56 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
perform.setSystem(true);
perform.schedule();
}
-
+
public static Operation createRemoveVersionOperation(final List<Dependency> modelDeps) {
return new Operation() {
public void process(Document document) {
List<Element> deps = findChilds(findChild(document.getDocumentElement(), DEPENDENCIES), DEPENDENCY);
- for (Element dep : deps) {
+ for(Element dep : deps) {
String grid = getTextValue(findChild(dep, GROUP_ID));
String artid = getTextValue(findChild(dep, ARTIFACT_ID));
for(Dependency modelDep : modelDeps) {
- if (modelDep.getGroupId() != null && modelDep.getGroupId().equals(grid) &&
- modelDep.getArtifactId() != null && modelDep.getArtifactId().equals(artid)) {
+ if(modelDep.getGroupId() != null && modelDep.getGroupId().equals(grid) && modelDep.getArtifactId() != null
+ && modelDep.getArtifactId().equals(artid)) {
removeChild(dep, findChild(dep, VERSION));
}
}
}
}
};
-
+
}
+
public static Operation createManageOperation(final List<Dependency> modelDeps) {
return new Operation() {
public void process(Document document) {
List<Dependency> modelDependencies = new ArrayList<Dependency>(modelDeps);
Element managedDepsElement = getChild(document.getDocumentElement(), DEPENDENCY_MANAGEMENT, DEPENDENCIES);
List<Element> existing = findChilds(managedDepsElement, DEPENDENCY);
- for (Element dep : existing) {
- String artifactId = getTextValue(findChild(dep, ARTIFACT_ID));
- String groupId = getTextValue(findChild(dep, GROUP_ID));
- //cloned list, shall not modify shared resource (used by the remove operation)
- Iterator<Dependency> mdIter = modelDependencies.iterator();
- while(mdIter.hasNext()) {
- //TODO: here we iterate to find existing managed dependencies and decide not to overwrite them.
- // but this could eventually break the current project when the versions are diametrally different
- // we should have shown this information to the user in the UI in the first place (for him to decide what to do)
- Dependency md = mdIter.next();
- if(artifactId.equals(md.getArtifactId()) && groupId.equals(md.getGroupId())) {
- mdIter.remove();
- break;
- }
+ for(Element dep : existing) {
+ String artifactId = getTextValue(findChild(dep, ARTIFACT_ID));
+ String groupId = getTextValue(findChild(dep, GROUP_ID));
+ //cloned list, shall not modify shared resource (used by the remove operation)
+ Iterator<Dependency> mdIter = modelDependencies.iterator();
+ while(mdIter.hasNext()) {
+ //TODO: here we iterate to find existing managed dependencies and decide not to overwrite them.
+ // but this could eventually break the current project when the versions are diametrally different
+ // we should have shown this information to the user in the UI in the first place (for him to decide what to do)
+ Dependency md = mdIter.next();
+ if(artifactId.equals(md.getArtifactId()) && groupId.equals(md.getGroupId())) {
+ mdIter.remove();
+ break;
}
}
- //TODO is the version is defined by property expression, we should make sure the property is defined in the current project
- for (Dependency modelDependency : modelDependencies) {
- PomHelper.createDependency(managedDepsElement, modelDependency.getGroupId(), modelDependency.getArtifactId(), modelDependency.getVersion());
- }
+ }
+ //TODO is the version is defined by property expression, we should make sure the property is defined in the current project
+ for(Dependency modelDependency : modelDependencies) {
+ PomHelper.createDependency(managedDepsElement, modelDependency.getGroupId(), modelDependency.getArtifactId(),
+ modelDependency.getVersion());
+ }
}
};
-
+
}
protected LinkedList<Dependency> getDependenciesList() {
@@ -389,12 +398,13 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
protected void checkStatus(MavenProject targetProject, LinkedList<Dependency> selectedDependencies) {
if(targetProject == null || selectedDependencies.isEmpty()) {
- updateStatus(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, Messages.ManageDependenciesDialog_emptySelectionError));
+ updateStatus(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID,
+ Messages.ManageDependenciesDialog_emptySelectionError));
return;
}
boolean error = false;
- IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry()
- .getMavenProject(targetProject.getGroupId(), targetProject.getArtifactId(), targetProject.getVersion());
+ IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().getMavenProject(targetProject.getGroupId(),
+ targetProject.getArtifactId(), targetProject.getVersion());
if(facade == null) {
error = true;
updateStatus(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID,
@@ -471,8 +481,8 @@ public class ManageDependenciesDialog extends AbstractMavenDialog {
public Color getForeground(Object element) {
if(element instanceof MavenProject) {
MavenProject project = (MavenProject) element;
- IMavenProjectFacade search = MavenPlugin.getMavenProjectRegistry()
- .getMavenProject(project.getGroupId(), project.getArtifactId(), project.getVersion());
+ IMavenProjectFacade search = MavenPlugin.getMavenProjectRegistry().getMavenProject(project.getGroupId(),
+ project.getArtifactId(), project.getVersion());
if(search == null) {
//This project is not in the workspace so we can't really modify it.
return Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY);
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/MavenModuleSelectionDialog.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/MavenModuleSelectionDialog.java
index 9c391597..5bb53c93 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/MavenModuleSelectionDialog.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/dialogs/MavenModuleSelectionDialog.java
@@ -8,8 +8,6 @@ import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.m2e.core.ui.internal.wizards.MavenProjectSelectionDialog;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -23,6 +21,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.m2e.core.ui.internal.wizards.MavenProjectSelectionDialog;
+import org.eclipse.m2e.editor.internal.Messages;
+
public class MavenModuleSelectionDialog extends MavenProjectSelectionDialog {
protected Set<Object> knownModules;
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java
index 7d29a4f7..c6c3e07b 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/Messages.java
@@ -88,7 +88,7 @@ public class Messages extends NLS {
public static String DependencyTreePage_title;
public static String FormUtils_click_for_details;
-
+
public static String FormUtils_click_for_details2;
public static String FormUtils_error_info;
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/actions/ShowDependencyHierarchyAction.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/actions/ShowDependencyHierarchyAction.java
index 5f679dae..8e9411e9 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/actions/ShowDependencyHierarchyAction.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/internal/actions/ShowDependencyHierarchyAction.java
@@ -18,15 +18,16 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.actions.ActionDelegate;
+
import org.eclipse.m2e.core.embedder.ArtifactKey;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction;
import org.eclipse.m2e.core.ui.internal.actions.SelectionUtil;
import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.m2e.editor.pom.MavenPomEditor;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.actions.ActionDelegate;
/**
@@ -50,9 +51,9 @@ public class ShowDependencyHierarchyAction extends ActionDelegate {
if(selection != null) {
Object element = this.selection.getFirstElement();
IMavenProjectFacade projectFacade = SelectionUtil.getType(element, IMavenProjectFacade.class);
- if(projectFacade!=null) {
+ if(projectFacade != null) {
ArtifactKey artifactKey = SelectionUtil.getType(element, ArtifactKey.class);
- if(artifactKey!=null) {
+ if(artifactKey != null) {
showDependencyHierarchy(projectFacade.getArtifactKey(), artifactKey);
}
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependenciesPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependenciesPage.java
index 736f4190..e153ab81 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependenciesPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependenciesPage.java
@@ -14,9 +14,6 @@ package org.eclipse.m2e.editor.pom;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.editor.composites.DependenciesComposite;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -27,20 +24,26 @@ import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.editor.composites.DependenciesComposite;
+import org.eclipse.m2e.editor.internal.Messages;
+
+
/**
* @author Eugene Kuleshov
*/
public class DependenciesPage extends MavenPomEditorPage {
-
+
private DependenciesComposite dependenciesComposite;
+
private SearchControl searchControl;
-
+
public DependenciesPage(MavenPomEditor pomEditor) {
super(pomEditor, IMavenConstants.PLUGIN_ID + ".pom.dependencies", Messages.DependenciesPage_title); //$NON-NLS-1$
}
public void dispose() {
- if(dependenciesComposite!=null) {
+ if(dependenciesComposite != null) {
dependenciesComposite.dispose();
}
super.dispose();
@@ -53,13 +56,13 @@ public class DependenciesPage extends MavenPomEditorPage {
searchControl.getSearchText().setEditable(true);
}
}
-
+
protected void createFormContent(IManagedForm managedForm) {
FormToolkit toolkit = managedForm.getToolkit();
-
+
ScrolledForm form = managedForm.getForm();
form.setText(Messages.DependenciesPage_form);
-
+
form.getBody().setLayout(new GridLayout(1, true));
dependenciesComposite = new DependenciesComposite(form.getBody(), this, SWT.NONE, pomEditor);
@@ -75,13 +78,13 @@ public class DependenciesPage extends MavenPomEditorPage {
});
searchControl = new SearchControl(Messages.DependenciesPage_find, managedForm);
-
+
IToolBarManager pageToolBarManager = form.getForm().getToolBarManager();
pageToolBarManager.add(searchControl);
pageToolBarManager.add(new Separator());
-
+
form.updateToolBar();
-
+
// form.pack();
super.createFormContent(managedForm);
@@ -90,7 +93,7 @@ public class DependenciesPage extends MavenPomEditorPage {
public void loadData() {
dependenciesComposite.loadData();
}
-
+
public void updateView(final Notification notification) {
}
@@ -99,10 +102,9 @@ public class DependenciesPage extends MavenPomEditorPage {
*/
@Override
public void mavenProjectHasChanged() {
- if (dependenciesComposite != null) {
+ if(dependenciesComposite != null) {
dependenciesComposite.mavenProjectHasChanged();
}
}
-
-
+
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java
index 523761a9..c6445050 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/DependencyTreePage.java
@@ -17,9 +17,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.project.MavenProject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -49,17 +49,6 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.internal.MavenPluginActivator;
-import org.eclipse.m2e.core.project.IMavenProjectChangedListener;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
-import org.eclipse.m2e.core.project.IMavenProjectRegistry;
-import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction;
-import org.eclipse.m2e.editor.MavenEditorImages;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
@@ -87,11 +76,26 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.progress.UIJob;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.project.MavenProject;
+
import org.sonatype.aether.graph.DependencyNode;
import org.sonatype.aether.graph.DependencyVisitor;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.project.IMavenProjectChangedListener;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.IMavenProjectRegistry;
+import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
+import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction;
+import org.eclipse.m2e.editor.MavenEditorImages;
+import org.eclipse.m2e.editor.internal.Messages;
+
/**
* @author Eugene Kuleshov
@@ -176,11 +180,11 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
private void initPopupMenu(Viewer viewer, String id) {
MenuManager menuMgr = new MenuManager("#PopupMenu-" + id); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
-
+
Menu menu = menuMgr.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
-
+
getEditorSite().registerContextMenu(MavenPomEditor.EDITOR_ID + id, menuMgr, viewer, false);
}
@@ -201,13 +205,14 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
return;
}
listViewer.setInput(null);
- FormUtils.setMessage(getManagedForm().getForm(), Messages.DependencyTreePage_message_resolving, IMessageProvider.WARNING);
+ FormUtils.setMessage(getManagedForm().getForm(), Messages.DependencyTreePage_message_resolving,
+ IMessageProvider.WARNING);
dataLoadingJob = new Job(Messages.DependencyTreePage_job_loading) {
protected IStatus run(IProgressMonitor monitor) {
try {
mavenProject = pomEditor.readMavenProject(force, monitor);
- if(mavenProject == null){
+ if(mavenProject == null) {
log.error("Unable to read maven project. Dependencies not updated."); //$NON-NLS-1$
return Status.CANCEL_STATUS;
}
@@ -273,7 +278,7 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
Tree tree = formToolkit.createTree(hierarchySection, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
hierarchySection.setClient(tree);
-
+
treeViewer = new TreeViewer(tree);
treeViewer.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.TRUE);
@@ -312,7 +317,8 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
FormToolkit formToolkit) {
ToolBarManager hiearchyToolBarManager = new ToolBarManager(SWT.FLAT);
- hiearchyToolBarManager.add(new Action(Messages.DependencyTreePage_action_collapseAll, MavenEditorImages.COLLAPSE_ALL) {
+ hiearchyToolBarManager.add(new Action(Messages.DependencyTreePage_action_collapseAll,
+ MavenEditorImages.COLLAPSE_ALL) {
public void run() {
treeViewer.collapseAll();
}
@@ -340,16 +346,17 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
}
});
- hiearchyToolBarManager.add(new Action(Messages.DependencyTreePage_action_showGroupId, MavenEditorImages.SHOW_GROUP) {
- public int getStyle() {
- return AS_CHECK_BOX;
- }
+ hiearchyToolBarManager
+ .add(new Action(Messages.DependencyTreePage_action_showGroupId, MavenEditorImages.SHOW_GROUP) {
+ public int getStyle() {
+ return AS_CHECK_BOX;
+ }
- public void run() {
- treeLabelProvider.setShowGroupId(isChecked());
- treeViewer.refresh();
- }
- });
+ public void run() {
+ treeLabelProvider.setShowGroupId(isChecked());
+ treeViewer.refresh();
+ }
+ });
hierarchyFilterAction = new Action(Messages.DependencyTreePage_action_filterSearch, MavenEditorImages.FILTER) {
public int getStyle() {
@@ -501,7 +508,7 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
IToolBarManager toolBarManager = form.getForm().getToolBarManager();
toolBarManager.add(searchControl);
-
+
class ClasspathDropdown extends Action implements IMenuCreator {
private Menu menu;
@@ -510,39 +517,40 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
setImageDescriptor(MavenEditorImages.SCOPE);
setMenuCreator(this);
}
-
+
public Menu getMenu(Menu parent) {
return null;
}
public Menu getMenu(Control parent) {
- if (menu != null) {
+ if(menu != null) {
menu.dispose();
}
-
+
menu = new Menu(parent);
addToMenu(menu, Messages.DependencyTreePage_scope_all, Artifact.SCOPE_TEST, currentClasspath);
- addToMenu(menu, Messages.DependencyTreePage_scope_comp_runtime, Artifact.SCOPE_COMPILE_PLUS_RUNTIME, currentClasspath);
+ addToMenu(menu, Messages.DependencyTreePage_scope_comp_runtime, Artifact.SCOPE_COMPILE_PLUS_RUNTIME,
+ currentClasspath);
addToMenu(menu, Messages.DependencyTreePage_scope_compile, Artifact.SCOPE_COMPILE, currentClasspath);
addToMenu(menu, Messages.DependencyTreePage_scope_runtime, Artifact.SCOPE_RUNTIME, currentClasspath);
return menu;
}
-
+
protected void addToMenu(Menu parent, String text, String scope, String currentScope) {
ClasspathAction action = new ClasspathAction(text, scope);
action.setChecked(scope.equals(currentScope));
new ActionContributionItem(action).fill(parent, -1);
}
-
+
public void dispose() {
- if (menu != null) {
+ if(menu != null) {
menu.dispose();
menu = null;
}
}
}
toolBarManager.add(new ClasspathDropdown());
-
+
toolBarManager.add(new Separator());
toolBarManager.add(new Action(Messages.DependencyTreePage_action_refresh, MavenEditorImages.REFRESH) {
public void run() {
@@ -781,7 +789,7 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
if(!node.getAliases().isEmpty()) {
c = node.getAliases().iterator().next();
}
-
+
StringBuilder label = new StringBuilder(128);
if(showGroupId) {
@@ -993,9 +1001,9 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
}
super.dispose();
}
-
+
public void selectDepedency(ArtifactKey artifactKey) {
- if(dataLoadingJob!=null && dataLoadingJob.getState()==Job.RUNNING) {
+ if(dataLoadingJob != null && dataLoadingJob.getState() == Job.RUNNING) {
try {
dataLoadingJob.join();
} catch(InterruptedException ex) {
@@ -1003,9 +1011,9 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
}
}
- if(mavenProject!=null) {
+ if(mavenProject != null) {
Artifact artifact = getArtifact(artifactKey);
- if(artifact!=null) {
+ if(artifact != null) {
listViewer.getTable().setFocus();
listViewer.setSelection(new StructuredSelection(artifact), true);
}
@@ -1021,7 +1029,6 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
}
return null;
}
-
public class ClasspathAction extends Action {
@@ -1047,11 +1054,11 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
}
public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) {
- if (getManagedForm() == null || getManagedForm().getForm() == null)
+ if(getManagedForm() == null || getManagedForm().getForm() == null)
return;
-
- for (int i=0; i<events.length; i++) {
- if (events[i].getSource().equals(((MavenPomEditor) getEditor()).getPomFile())) {
+
+ for(int i = 0; i < events.length; i++ ) {
+ if(events[i].getSource().equals(((MavenPomEditor) getEditor()).getPomFile())) {
// file has been changed. need to update graph
new UIJob(Messages.DependencyTreePage_job_reloading) {
public IStatus runInUIThread(IProgressMonitor monitor) {
@@ -1065,12 +1072,13 @@ public class DependencyTreePage extends FormPage implements IMavenProjectChanged
}
public void fileChanged() {
- if (getManagedForm() == null || getManagedForm().getForm() == null)
+ if(getManagedForm() == null || getManagedForm().getForm() == null)
return;
-
+
new UIJob(Messages.DependencyTreePage_job_reloading) {
public IStatus runInUIThread(IProgressMonitor monitor) {
- FormUtils.setMessage(getManagedForm().getForm(), Messages.DependencyTreePage_message_updating, IMessageProvider.WARNING);
+ FormUtils.setMessage(getManagedForm().getForm(), Messages.DependencyTreePage_message_updating,
+ IMessageProvider.WARNING);
return Status.OK_STATUS;
}
}.schedule();
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ElementValueProvider.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ElementValueProvider.java
index 930380b4..851ab71d 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ElementValueProvider.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ElementValueProvider.java
@@ -1,31 +1,36 @@
+
package org.eclipse.m2e.editor.pom;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
+
+
public final class ElementValueProvider {
private String[] path;
+
private String defaultValue;
public ElementValueProvider(String... path) {
this.path = path;
}
-
+
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
+
public String getDefaultValue() {
return defaultValue;
}
-
+
public Element find(Document document) {
Element toRet = null;
Element parent = document.getDocumentElement();
- for (String pathEl : path) {
+ for(String pathEl : path) {
toRet = PomEdits.findChild(parent, pathEl);
- if (toRet == null) {
+ if(toRet == null) {
return null;
}
parent = toRet;
@@ -36,9 +41,9 @@ public final class ElementValueProvider {
public Element get(Document document) {
return PomEdits.getChild(document.getDocumentElement(), path);
}
-
+
public String getValue(Document document) {
return PomEdits.getTextValue(find(document));
}
-
+
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
index b811f621..06ce92ad 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/FormUtils.java
@@ -16,17 +16,11 @@ import java.net.URL;
import java.util.Arrays;
import java.util.Properties;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.interpolation.InterpolationException;
-import org.codehaus.plexus.interpolation.PrefixedObjectValueSource;
-import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
-import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.m2e.core.ui.internal.dialogs.MavenMessageDialog;
-import org.eclipse.m2e.core.ui.internal.util.Util;
-import org.eclipse.m2e.editor.internal.Messages;
-import org.eclipse.m2e.editor.xml.internal.FormHoverProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
@@ -50,8 +44,18 @@ import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.PrefixedObjectValueSource;
+import org.codehaus.plexus.interpolation.PropertiesBasedValueSource;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
+
+import org.apache.maven.project.MavenProject;
+
+import org.eclipse.m2e.core.ui.internal.dialogs.MavenMessageDialog;
+import org.eclipse.m2e.core.ui.internal.util.Util;
+import org.eclipse.m2e.editor.internal.Messages;
+import org.eclipse.m2e.editor.xml.internal.FormHoverProvider;
/**
@@ -59,6 +63,7 @@ import org.slf4j.LoggerFactory;
*/
public abstract class FormUtils {
private static final Logger log = LoggerFactory.getLogger(FormUtils.class);
+
public static final int MAX_MSG_LENGTH = 80;
/**
@@ -105,16 +110,15 @@ public abstract class FormUtils {
form.getForm().setMessage(message, severity);
addFormTitleListeners(createDefaultPerformer(form, message, ttip, severity), form);
}
-
+
/**
- *
* @param form
* @param message
* @param severity
* @param runnable something that will be "run" once the user clicks the message area.
*/
- static void setMessageWithPerformer(ScrolledForm form, String message,
- int severity, FormHoverProvider.Execute runnable) {
+ static void setMessageWithPerformer(ScrolledForm form, String message, int severity,
+ FormHoverProvider.Execute runnable) {
form.getForm().setMessage(message, severity);
addFormTitleListeners(runnable, form);
}
@@ -195,13 +199,14 @@ public abstract class FormUtils {
}
/**
- * be very careful when using this method, see MNGECLIPSE-2674
- * ideally this would be replaced by a distributed system where each component reacts to the
- * readonly or not-readonly event and with the knowledge of the inner state decides what gets enabled/disabled
- *
+ * be very careful when using this method, see MNGECLIPSE-2674 ideally this would be replaced by a distributed system
+ * where each component reacts to the readonly or not-readonly event and with the knowledge of the inner state decides
+ * what gets enabled/disabled
+ *
* @param composite
* @param readonly
- * @deprecated so that you think hard before using it. Using it for disabling all controls is probably fine. Enabling all is NOT.
+ * @deprecated so that you think hard before using it. Using it for disabling all controls is probably fine. Enabling
+ * all is NOT.
*/
public static void setReadonly(Composite composite, boolean readonly) {
if(composite != null) {
@@ -234,17 +239,18 @@ public abstract class FormUtils {
}
}
}
-
- private static FormHoverProvider.Execute createDefaultPerformer(final ScrolledForm form, final String message, final String ttip,
- final int severity) {
+
+ private static FormHoverProvider.Execute createDefaultPerformer(final ScrolledForm form, final String message,
+ final String ttip, final int severity) {
if(ttip != null && ttip.length() > 0 && message != null) {
- return new FormHoverProvider.Execute() {
+ return new FormHoverProvider.Execute() {
- public void run(Point point) {
- int dialogSev = IMessageProvider.ERROR == severity ? MessageDialog.ERROR : MessageDialog.WARNING;
- MavenMessageDialog.openWithSeverity(form.getShell(), Messages.FormUtils_error_info, Messages.FormUtils_pom_error, ttip, dialogSev);
- }
- };
+ public void run(Point point) {
+ int dialogSev = IMessageProvider.ERROR == severity ? MessageDialog.ERROR : MessageDialog.WARNING;
+ MavenMessageDialog.openWithSeverity(form.getShell(), Messages.FormUtils_error_info,
+ Messages.FormUtils_pom_error, ttip, dialogSev);
+ }
+ };
}
return null;
}
@@ -295,16 +301,17 @@ public abstract class FormUtils {
}
}
}
-
+
/**
* copy pas
+ *
* @param project
* @param text
* @return
*/
//TODO copy pasted from PomTemplateContext
static String simpleInterpolate(MavenProject project, String text) {
- if (text != null && text.contains("${")) { //$NON-NLS-1$
+ if(text != null && text.contains("${")) { //$NON-NLS-1$
//when expression is in the version but no project instance around
// just give up.
if(project == null) {
@@ -312,17 +319,18 @@ public abstract class FormUtils {
}
Properties props = project.getProperties();
RegexBasedInterpolator inter = new RegexBasedInterpolator();
- if (props != null) {
+ if(props != null) {
inter.addValueSource(new PropertiesBasedValueSource(props));
}
- inter.addValueSource(new PrefixedObjectValueSource(Arrays.asList( new String[]{ "pom.", "project." } ), project.getModel(), false)); //$NON-NLS-1$ //$NON-NLS-2$
+ inter.addValueSource(new PrefixedObjectValueSource(
+ Arrays.asList(new String[] {"pom.", "project."}), project.getModel(), false)); //$NON-NLS-1$ //$NON-NLS-2$
try {
text = inter.interpolate(text);
} catch(InterpolationException e) {
text = null;
}
- }
+ }
return text;
- }
+ }
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/Matcher.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/Matcher.java
index d321de46..baf634e0 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/Matcher.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/Matcher.java
@@ -19,5 +19,5 @@ public abstract class Matcher {
public abstract boolean isMatchingArtifact(String groupId, String artifactId);
public abstract boolean isEmpty();
-
+
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditor.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditor.java
index 22480857..f3481c6f 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditor.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditor.java
@@ -20,8 +20,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
-import org.apache.maven.project.MavenProject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -54,19 +55,6 @@ import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IOverviewRuler;
import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.internal.MavenPluginActivator;
-import org.eclipse.m2e.core.internal.preferences.MavenPreferenceConstants;
-import org.eclipse.m2e.core.project.IMavenProjectChangedListener;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
-import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator;
-import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction.MavenStorageEditorInput;
-import org.eclipse.m2e.core.ui.internal.actions.SelectionUtil;
-import org.eclipse.m2e.editor.MavenEditorPlugin;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.search.ui.text.ISearchEditorAccess;
import org.eclipse.search.ui.text.Match;
import org.eclipse.swt.widgets.Composite;
@@ -101,10 +89,26 @@ import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.emf2xml.EMF2DOMSSEAdapter;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+
+import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
+import org.apache.maven.project.MavenProject;
+
import org.sonatype.aether.graph.DependencyNode;
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.internal.MavenPluginActivator;
+import org.eclipse.m2e.core.internal.preferences.MavenPreferenceConstants;
+import org.eclipse.m2e.core.project.IMavenProjectChangedListener;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.MavenProjectChangedEvent;
+import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator;
+import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction.MavenStorageEditorInput;
+import org.eclipse.m2e.core.ui.internal.actions.SelectionUtil;
+import org.eclipse.m2e.editor.MavenEditorPlugin;
+import org.eclipse.m2e.editor.internal.Messages;
+
/**
* Maven POM editor
@@ -125,9 +129,9 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
private static final String EXTENSION_FACTORIES = MavenEditorPlugin.PLUGIN_ID + ".pageFactories"; //$NON-NLS-1$
private static final String ELEMENT_PAGE = "factory"; //$NON-NLS-1$
-
+
private static final String EFFECTIVE_POM = Messages.MavenPomEditor_effective_pom;
-
+
OverviewPage overviewPage;
DependenciesPage dependenciesPage;
@@ -135,9 +139,9 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
DependencyTreePage dependencyTreePage;
StructuredSourceTextEditor sourcePage;
-
+
StructuredTextEditor effectivePomSourcePage;
-
+
private List<MavenPomEditorPage> mavenpomEditorPages = new ArrayList<MavenPomEditorPage>();
private Map<String, org.sonatype.aether.graph.DependencyNode> rootNodes = new HashMap<String, org.sonatype.aether.graph.DependencyNode>();
@@ -165,7 +169,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
private boolean resourceChangeEventSkip = false;
private MavenStorageEditorInput effectivePomEditorInput;
-
+
private boolean disposed = false;
public MavenPomEditor() {
@@ -174,16 +178,19 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
/**
* the pom document being edited..
+ *
* @return
*/
public IDocument getDocument() {
- if (structuredModel == null) return null;
+ if(structuredModel == null)
+ return null;
return structuredModel.getStructuredDocument();
}
-
+
public IStructuredModel getModel() {
return structuredModel;
}
+
// IResourceChangeListener
/**
@@ -217,8 +224,9 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
return true;
}
- };
-
+ }
+ ;
+
try {
RemovedResourceDeltaVisitor visitor = new RemovedResourceDeltaVisitor();
event.getDelta().accept(visitor);
@@ -238,39 +246,37 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
// suppress a prompt to reload the pom if modifications were caused by workspace actions
//XXX: mkleint: why is this called outside of the ChangedResourceDeltaVisitor?
- if (sourcePage != null) {
+ if(sourcePage != null) {
sourcePage.updateModificationStamp();
}
class ChangedResourceDeltaVisitor implements IResourceDeltaVisitor {
public boolean visit(IResourceDelta delta) throws CoreException {
- if(delta.getResource().equals(pomFile)
- && (delta.getKind() & IResourceDelta.CHANGED) != 0 && delta.getResource().exists()) {
+ if(delta.getResource().equals(pomFile) && (delta.getKind() & IResourceDelta.CHANGED) != 0
+ && delta.getResource().exists()) {
int flags = delta.getFlags();
- if ((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.REPLACED) != 0) {
+ if((flags & IResourceDelta.CONTENT) != 0 || (flags & IResourceDelta.REPLACED) != 0) {
handleContentChanged();
return false;
}
- if ((flags & IResourceDelta.MARKERS) != 0) {
+ if((flags & IResourceDelta.MARKERS) != 0) {
handleMarkersChanged();
return false;
}
}
return true;
}
-
+
/**
- * this method never got called with the current editor changes/saves the file.
- * the doSave() method removed/added the resource listener when saving
- * it did get called however when external editor (txt/xml) saved the file..
- *
- * I've changed that behaviour to only avoid the reload() call when current editor saves the file.
- * we still want to attempt to reload the mavenproject instance.. please read <code>mavenProjectChanged</code> javadoc
- * for details on when this works and when not.
+ * this method never got called with the current editor changes/saves the file. the doSave() method removed/added
+ * the resource listener when saving it did get called however when external editor (txt/xml) saved the file..
+ * I've changed that behaviour to only avoid the reload() call when current editor saves the file. we still want
+ * to attempt to reload the mavenproject instance.. please read <code>mavenProjectChanged</code> javadoc for
+ * details on when this works and when not.
*/
private void handleContentChanged() {
reloadMavenProjectCache();
- if (!resourceChangeEventSkip) {
+ if(!resourceChangeEventSkip) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
/* MNGECLIPSE-1789: commented this out since forced model reload caused the XML editor to go crazy;
@@ -287,29 +293,32 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
});
}
-
+
}
-
+
private void handleMarkersChanged() {
try {
- IMarker[] markers = pomFile.findMarkers(IMavenConstants.MARKER_ID, true, IResource.DEPTH_ZERO);
- final String msg = markers != null && markers.length > 0 //
- ? markers[0].getAttribute(IMarker.MESSAGE, "Unknown error") : null;
- final int severity = markers != null && markers.length > 0 ? (markers[0].getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR) == IMarker.SEVERITY_WARNING ? IMessageProvider.WARNING : IMessageProvider.ERROR) : IMessageProvider.NONE;
-
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- for(MavenPomEditorPage page : getMavenPomEditorPages()) {
- page.setErrorMessage(msg, msg == null ? IMessageProvider.NONE : severity);
+ IMarker[] markers = pomFile.findMarkers(IMavenConstants.MARKER_ID, true, IResource.DEPTH_ZERO);
+ final String msg = markers != null && markers.length > 0 //
+ ? markers[0].getAttribute(IMarker.MESSAGE, "Unknown error") : null;
+ final int severity = markers != null && markers.length > 0 ? (markers[0].getAttribute(IMarker.SEVERITY,
+ IMarker.SEVERITY_ERROR) == IMarker.SEVERITY_WARNING ? IMessageProvider.WARNING : IMessageProvider.ERROR)
+ : IMessageProvider.NONE;
+
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ for(MavenPomEditorPage page : getMavenPomEditorPages()) {
+ page.setErrorMessage(msg, msg == null ? IMessageProvider.NONE : severity);
+ }
}
- }
- });
- } catch (CoreException ex ) {
+ });
+ } catch(CoreException ex) {
log.error("Error updating pom file markers.", ex); //$NON-NLS-1$
}
}
- };
-
+ }
+ ;
+
try {
ChangedResourceDeltaVisitor visitor = new ChangedResourceDeltaVisitor();
event.getDelta().accept(visitor);
@@ -324,27 +333,27 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
//this code assumes the MavenPomEditorPages are the first ones in the list..
//currenty the case, effective+xml editor are at the end..
//if this constraint changes, we need to find the active page in the super.pages list first and check for instanceof
- if (active > -1 && active < getMavenPomEditorPages().size()) {
+ if(active > -1 && active < getMavenPomEditorPages().size()) {
MavenPomEditorPage page = getMavenPomEditorPages().get(active);
page.loadData();
}
- if(isEffectiveActive()){
+ if(isEffectiveActive()) {
loadEffectivePOM();
}
flushCommandStack();
}
- private boolean isEffectiveActive(){
+ private boolean isEffectiveActive() {
int active = getActivePage();
String name = getPageText(active);
return EFFECTIVE_POM.equals(name);
}
-
+
void flushCommandStack() {
dirty = false;
- if (sseCommandStack != null)
+ if(sseCommandStack != null)
sseCommandStack.saveIsDone();
- if (getContainer() != null && !getContainer().isDisposed())
+ if(getContainer() != null && !getContainer().isDisposed())
getContainer().getDisplay().asyncExec(new Runnable() {
public void run() {
editorDirtyStateChanged();
@@ -353,7 +362,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
protected void addPages() {
-
+
overviewPage = new OverviewPage(this);
addPomPage(overviewPage);
@@ -364,30 +373,30 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
addPomPage(dependencyTreePage);
addSourcePage();
-
+
addEditorPageExtensions();
selectActivePage();
}
- protected void selectActivePage(){
+ protected void selectActivePage() {
boolean showXML = M2EUIPluginActivator.getDefault().getPreferenceStore()
.getBoolean(MavenPreferenceConstants.P_DEFAULT_POM_EDITOR_PAGE);
- if(showXML){
+ if(showXML) {
setActivePage(null);
- }
+ }
}
-
+
protected void pageChange(int newPageIndex) {
String name = getPageText(newPageIndex);
- if(EFFECTIVE_POM.equals(name)){
+ if(EFFECTIVE_POM.equals(name)) {
loadEffectivePOM();
}
//The editor occassionally doesn't get
//closed if the project gets deleted. In this case, the editor
//stays open and very bad things happen if you select it
- try{
+ try {
super.pageChange(newPageIndex);
- }catch(NullPointerException e){
+ } catch(NullPointerException e) {
MavenEditorPlugin.getDefault().getLog().log(new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, "", e)); //$NON-NLS-1$
this.close(false);
}
@@ -419,65 +428,66 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
}
}
-
/**
* Load the effective POM in a job and then update the effective pom page when its done
+ *
* @author dyocum
- *
*/
- class LoadEffectivePomJob extends Job{
+ class LoadEffectivePomJob extends Job {
public LoadEffectivePomJob(String name) {
super(name);
}
-
+
private void showEffectivePomError(final String name) {
- if (disposed) {
+ if(disposed) {
return;
}
String error = Messages.MavenPomEditor_error_loading_effective_pom;
IDocument doc = effectivePomSourcePage.getDocumentProvider().getDocument(getEffectivePomEditorInput());
doc.set(error);
}
+
@Override
protected IStatus run(IProgressMonitor monitor) {
- try{
+ try {
StringWriter sw = new StringWriter();
final String name = getPartName() + Messages.MavenPomEditor_effective;
MavenProject mavenProject = SelectionUtil.getMavenProject(getEditorInput(), monitor);
- if(mavenProject == null){
+ if(mavenProject == null) {
showEffectivePomError(name);
return Status.CANCEL_STATUS;
}
new MavenXpp3Writer().write(sw, mavenProject.getModel());
final String content = sw.toString();
- if (disposed) {
+ if(disposed) {
return Status.OK_STATUS;
}
IDocument doc = effectivePomSourcePage.getDocumentProvider().getDocument(getEffectivePomEditorInput());
doc.set(content);
return Status.OK_STATUS;
- } catch(CoreException ce){
- return new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, -1, Messages.MavenPomEditor_error_failed_effective, ce);
- } catch(IOException ie){
- return new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, -1, Messages.MavenPomEditor_error_failed_effective, ie);
- }
+ } catch(CoreException ce) {
+ return new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, -1,
+ Messages.MavenPomEditor_error_failed_effective, ce);
+ } catch(IOException ie) {
+ return new Status(IStatus.ERROR, MavenEditorPlugin.PLUGIN_ID, -1,
+ Messages.MavenPomEditor_error_failed_effective, ie);
+ }
}
}
-
+
/**
- * Load the effective POM. Should only happen when tab is brought to front or tab
- * is in front when a reload happens.
+ * Load the effective POM. Should only happen when tab is brought to front or tab is in front when a reload happens.
*/
- private void loadEffectivePOM(){
- if (disposed) {
+ private void loadEffectivePOM() {
+ if(disposed) {
return;
}
String content = Messages.MavenPomEditor_loading;
IDocument doc = effectivePomSourcePage.getDocumentProvider().getDocument(getEffectivePomEditorInput());
doc.set(content);
-
+
//then start the load
LoadEffectivePomJob job = new LoadEffectivePomJob(Messages.MavenPomEditor_loading);
job.schedule();
@@ -499,9 +509,9 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
return effectivePomEditorInput;
}
-
+
protected class MavenStructuredTextViewer extends StructuredTextViewer implements IAdaptable {
-
+
public MavenStructuredTextViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler,
boolean showAnnotationsOverview, int styles) {
super(parent, verticalRuler, overviewRuler, showAnnotationsOverview, styles);
@@ -512,64 +522,63 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
public Object getAdapter(Class adapter) {
- if (MavenProject.class.equals(adapter)) {
+ if(MavenProject.class.equals(adapter)) {
return getMavenProject();
}
return null;
}
-
-
+
}
protected class StructuredSourceTextEditor extends StructuredTextEditor {
private long fModificationStamp = -1;
+
private MavenProject mvnprj;
protected void updateModificationStamp() {
- IDocumentProvider p= getDocumentProvider();
- if (p == null)
+ IDocumentProvider p = getDocumentProvider();
+ if(p == null)
return;
- if(p instanceof IDocumentProviderExtension3) {
- fModificationStamp= p.getModificationStamp(getEditorInput());
+ if(p instanceof IDocumentProviderExtension3) {
+ fModificationStamp = p.getModificationStamp(getEditorInput());
}
}
-
+
/**
- * we override the creation of StructuredTextViewer to have our own subclass created
- * that drags along an instance of resolved MavenProject via implementing IMavenProjectCache
- *
+ * we override the creation of StructuredTextViewer to have our own subclass created that drags along an instance of
+ * resolved MavenProject via implementing IMavenProjectCache
*/
protected StructuredTextViewer createStructedTextViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {
return new MavenStructuredTextViewer(parent, verticalRuler, getOverviewRuler(), isOverviewRulerVisible(), styles);
}
-
+
protected void sanityCheckState(IEditorInput input) {
- IDocumentProvider p= getDocumentProvider();
- if (p == null)
+ IDocumentProvider p = getDocumentProvider();
+ if(p == null)
return;
- if (p instanceof IDocumentProviderExtension3) {
+ if(p instanceof IDocumentProviderExtension3) {
- IDocumentProviderExtension3 p3= (IDocumentProviderExtension3) p;
+ IDocumentProviderExtension3 p3 = (IDocumentProviderExtension3) p;
- long stamp= p.getModificationStamp(input);
- if (stamp != fModificationStamp) {
- fModificationStamp= stamp;
- if (!p3.isSynchronized(input))
+ long stamp = p.getModificationStamp(input);
+ if(stamp != fModificationStamp) {
+ fModificationStamp = stamp;
+ if(!p3.isSynchronized(input))
handleEditorInputChanged();
}
- } else {
+ } else {
- if (fModificationStamp == -1)
- fModificationStamp= p.getSynchronizationStamp(input);
+ if(fModificationStamp == -1)
+ fModificationStamp = p.getSynchronizationStamp(input);
- long stamp= p.getModificationStamp(input);
- if (stamp != fModificationStamp) {
- fModificationStamp= stamp;
- if (stamp != p.getSynchronizationStamp(input))
+ long stamp = p.getModificationStamp(input);
+ if(stamp != fModificationStamp) {
+ fModificationStamp = stamp;
+ if(stamp != p.getSynchronizationStamp(input))
handleEditorInputChanged();
}
}
@@ -577,6 +586,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
updateState(getEditorInput());
updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_ELEMENT_STATE);
}
+
public void doSave(IProgressMonitor monitor) {
// always save text editor
// ResourcesPlugin.getWorkspace().removeResourceChangeListener(MavenPomEditor.this);
@@ -589,15 +599,16 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
private boolean oldDirty;
+
public boolean isDirty() {
- if (oldDirty != dirty) {
- oldDirty = dirty;
+ if(oldDirty != dirty) {
+ oldDirty = dirty;
updatePropertyDependentActions();
}
return dirty;
}
}
-
+
private void addSourcePage() {
sourcePage = new StructuredSourceTextEditor();
sourcePage.setEditorPart(this);
@@ -607,22 +618,21 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
try {
int dex = addPage(effectivePomSourcePage, getEffectivePomEditorInput());
setPageText(dex, EFFECTIVE_POM);
-
+
sourcePageIndex = addPage(sourcePage, getEditorInput());
setPageText(sourcePageIndex, POM_XML);
sourcePage.update();
-
IDocument doc = sourcePage.getDocumentProvider().getDocument(getEditorInput());
-
- doc.addDocumentListener(new IDocumentListener(){
- public void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event) {
+ doc.addDocumentListener(new IDocumentListener() {
+
+ public void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event) {
}
public void documentChanged(org.eclipse.jface.text.DocumentEvent event) {
//recheck the read-only status if the document changes (will happen when xml page is edited)
- if(MavenPomEditor.this.checkedWritableStatus && MavenPomEditor.this.readOnly){
+ if(MavenPomEditor.this.checkedWritableStatus && MavenPomEditor.this.readOnly) {
MavenPomEditor.this.checkedWritableStatus = false;
}
}
@@ -635,13 +645,13 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
commandStackListener = new CommandStackListener() {
public void commandStackChanged(EventObject event) {
- boolean oldDirty = dirty;
+ boolean oldDirty = dirty;
dirty = sseCommandStack.isSaveNeeded();
- if (dirty != oldDirty)
+ if(dirty != oldDirty)
MavenPomEditor.this.editorDirtyStateChanged();
}
};
-
+
IStructuredTextUndoManager undoManager = structuredModel.getUndoManager();
//mkleint: it appears to me that the undomanager will only only be null
//for documents released from read/edit (which we do in dispose())
@@ -655,7 +665,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
flushCommandStack();
// TODO activate xml source page if model is empty or have errors
-
+
} catch(PartInitException ex) {
log.error(ex.getMessage(), ex);
}
@@ -664,13 +674,13 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
public boolean isReadOnly() {
return !(getEditorInput() instanceof IFileEditorInput);
}
-
+
private int addPomPage(IFormPage page) {
try {
if(page instanceof MavenPomEditorPage) {
mavenpomEditorPages.add((MavenPomEditorPage) page);
}
- if (page instanceof IPomFileChangedListener) {
+ if(page instanceof IPomFileChangedListener) {
fileChangeListeners.add((IPomFileChangedListener) page);
}
return addPage(page);
@@ -680,14 +690,13 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
}
-
public synchronized org.sonatype.aether.graph.DependencyNode readDependencyTree(boolean force, String classpath,
IProgressMonitor monitor) throws CoreException {
if(force || !rootNodes.containsKey(classpath)) {
monitor.setTaskName(Messages.MavenPomEditor_task_reading);
//mkleint: I'm wondering if the force parameter on dependencyTree is also applicable to the pom project method.
MavenProject mavenProject = readMavenProject(force, monitor);
- if(mavenProject == null){
+ if(mavenProject == null) {
log.error("Unable to read maven project. Dependencies not updated."); //$NON-NLS-1$
return null;
}
@@ -700,7 +709,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
DependencyNode root = MavenPlugin.getMavenModelManager().readDependencyTree(facade, mavenProject, classpath,
monitor);
root.setData("LEVEL", "ROOT");
- for (DependencyNode nd : root.getChildren()) {
+ for(DependencyNode nd : root.getChildren()) {
nd.setData("LEVEL", "DIRECT");
}
rootNodes.put(classpath, root);
@@ -708,10 +717,11 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
return rootNodes.get(classpath);
}
-
+
/**
- * this method is safer than readMavenProject for instances that shall return fast and don't mind
- * not having the MavenProject instance around.
+ * this method is safer than readMavenProject for instances that shall return fast and don't mind not having the
+ * MavenProject instance around.
+ *
* @return the cached MavenProject instance or null if not loaded.
*/
public MavenProject getMavenProject() {
@@ -719,10 +729,11 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
/**
- * either returns the cached MavenProject instance or reads it, please note that if you want your method to always return fast
- * getMavenProject() is preferable
- * please see <code>mavenProjectChanged()</code> for explanation why even force==true might not give you the latest uptodate
- * MavenProject instance matching the current saved file in some circumstances.
+ * either returns the cached MavenProject instance or reads it, please note that if you want your method to always
+ * return fast getMavenProject() is preferable please see <code>mavenProjectChanged()</code> for explanation why even
+ * force==true might not give you the latest uptodate MavenProject instance matching the current saved file in some
+ * circumstances.
+ *
* @param force
* @param monitor
* @return
@@ -730,18 +741,18 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
*/
public MavenProject readMavenProject(boolean force, IProgressMonitor monitor) throws CoreException {
if(force || mavenProject == null) {
-
+
IEditorInput input = getEditorInput();
-
+
if(input instanceof IFileEditorInput) {
IFileEditorInput fileInput = (IFileEditorInput) input;
pomFile = fileInput.getFile();
pomFile.refreshLocal(1, null);
}
-
+
//never overwrite by null, rather keep old value than null..
MavenProject prj = SelectionUtil.getMavenProject(input, monitor);
- if (prj != null) {
+ if(prj != null) {
mavenProject = prj;
}
}
@@ -803,7 +814,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
if(editorInput instanceof IFileEditorInput) {
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
-
+
reloadMavenProjectCache();
MavenPluginActivator.getDefault().getMavenProjectManager().addMavenProjectChangedListener(this);
@@ -863,16 +874,18 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
/**
- * returns only the pages that implement MavenPomEditorPage
- * will not return the effective pom and xml editor page for example..
+ * returns only the pages that implement MavenPomEditorPage will not return the effective pom and xml editor page for
+ * example..
+ *
* @return
*/
public List<MavenPomEditorPage> getMavenPomEditorPages() {
return mavenpomEditorPages;
}
-
+
/**
* use the <code>getMavenPomEditorPages()</code> method instead
+ *
* @return
*/
@Deprecated
@@ -884,25 +897,27 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
setActivePage(dependencyTreePage.getId());
dependencyTreePage.selectDepedency(artifactKey);
}
-
+
private boolean checkedWritableStatus;
+
private boolean readOnly;
- /** read/write check for read only pom files -- called when the file is opened
- * and will validateEdit -- so files will be checked out of src control, etc
- * Note: this is actually done separately from isReadOnly() because there are 2 notions of 'read only'
- * for a POM. The first is for a file downloaded from a repo, like maven central. That one
- * is never editable. The second is for a local file that is read only because its been marked
- * that way by an SCM, etc. This method will do a one-time check/validateEdit for the life of the POM
- * editor.
- **/
- protected boolean checkReadOnly(){
- if(checkedWritableStatus){
+
+ /**
+ * read/write check for read only pom files -- called when the file is opened and will validateEdit -- so files will
+ * be checked out of src control, etc Note: this is actually done separately from isReadOnly() because there are 2
+ * notions of 'read only' for a POM. The first is for a file downloaded from a repo, like maven central. That one is
+ * never editable. The second is for a local file that is read only because its been marked that way by an SCM, etc.
+ * This method will do a one-time check/validateEdit for the life of the POM editor.
+ **/
+ protected boolean checkReadOnly() {
+ if(checkedWritableStatus) {
return readOnly;
}
checkedWritableStatus = true;
- if(getPomFile() != null && getPomFile().isReadOnly()){
- IStatus validateEdit = ResourcesPlugin.getWorkspace().validateEdit(new IFile[]{getPomFile()}, getEditorSite().getShell());
- if(!validateEdit.isOK()){
+ if(getPomFile() != null && getPomFile().isReadOnly()) {
+ IStatus validateEdit = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] {getPomFile()},
+ getEditorSite().getShell());
+ if(!validateEdit.isOK()) {
readOnly = true;
} else {
readOnly = isReadOnly();
@@ -912,7 +927,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
return readOnly;
}
-
+
/**
* Adapted from <code>org.eclipse.ui.texteditor.AbstractTextEditor.ActivationListener</code>
*/
@@ -922,7 +937,6 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
private boolean isHandlingActivation = false;
-
public MavenPomActivationListener(IPartService partService) {
partService.addPartListener(this);
PlatformUI.getWorkbench().addWindowListener(this);
@@ -933,7 +947,6 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
PlatformUI.getWorkbench().removeWindowListener(this);
}
-
// IPartListener
public void partActivated(IWorkbenchPart part) {
@@ -993,13 +1006,13 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
isHandlingActivation = true;
final boolean[] changed = new boolean[] {false};
try {
-
+
ITextListener listener = new ITextListener() {
public void textChanged(TextEvent event) {
changed[0] = true;
}
};
- if (sourcePage != null && sourcePage.getTextViewer() != null) {
+ if(sourcePage != null && sourcePage.getTextViewer() != null) {
sourcePage.getTextViewer().addTextListener(listener);
try {
sourcePage.safelySanityCheckState(getEditorInput());
@@ -1008,15 +1021,15 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
sourcePage.update();
}
-
+
if(changed[0]) {
try {
pomFile.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch(CoreException e) {
log.error(e.getMessage(), e);
- }
+ }
}
-
+
} finally {
isHandlingActivation = false;
@@ -1042,7 +1055,7 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
public Object getAdapter(Class adapter) {
Object result = super.getAdapter(adapter);
if(result != null && Display.getCurrent() == null) {
- return result;
+ return result;
}
return sourcePage.getAdapter(adapter);
}
@@ -1073,41 +1086,37 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
/**
- * you may be asking why we have this method here.. sit back, relax and let me tell you the epic story of it..
- *
- * 1. we attempt to keep an instance of MavenProject instance around - to make queries from xml editor and elsewhere easy and *fast*.
- * 2. in init() we read it and store
- * 3. however how do we update the value when stuff changes?
- * 4. only IFileEditorInputs are really update-able, everything else is a read-only editor.
- * 5. so how do we listen on the resource being changed and update the value accordingly?
- * it appears that Selectionutil.getMavenProject(EditorInput) relies on MavenProjectManager.create() which
- * appears to have rather tricky behaviour. It either gives you the cached instance or if not around creates one on the fly.
- * 5a. The fly one is however not added to the cache. As a consequence the fly ones are always recreated each time you ask.
- * 5b. The cached ones react quite in opposite way, no matter when you ask (even if you know the file has changed) you always get the cached value until the registry gets updated.
- * 6. so to keep our MavenProject instance uptodate for both 5a and 5b cases, we need to:
- * 6a. listen on workspace resources and try loading the MavenProject. for 5a it will load the new instance but for 5b it will keep returning the old value.
- * 6b. so we also listen on MavenProjectChangedEvents and for 5b cases get the correct, fresh new MavenProject instance here.
- *
- * 7. please note that 6a comes before 6b and is done for both 5a and 5b as it's hard to tell those IMavenprojectfacade instances apart..
- *
- * Your storyteller for tonite was mkleint
+ * you may be asking why we have this method here.. sit back, relax and let me tell you the epic story of it.. 1. we
+ * attempt to keep an instance of MavenProject instance around - to make queries from xml editor and elsewhere easy
+ * and *fast*. 2. in init() we read it and store 3. however how do we update the value when stuff changes? 4. only
+ * IFileEditorInputs are really update-able, everything else is a read-only editor. 5. so how do we listen on the
+ * resource being changed and update the value accordingly? it appears that Selectionutil.getMavenProject(EditorInput)
+ * relies on MavenProjectManager.create() which appears to have rather tricky behaviour. It either gives you the
+ * cached instance or if not around creates one on the fly. 5a. The fly one is however not added to the cache. As a
+ * consequence the fly ones are always recreated each time you ask. 5b. The cached ones react quite in opposite way,
+ * no matter when you ask (even if you know the file has changed) you always get the cached value until the registry
+ * gets updated. 6. so to keep our MavenProject instance uptodate for both 5a and 5b cases, we need to: 6a. listen on
+ * workspace resources and try loading the MavenProject. for 5a it will load the new instance but for 5b it will keep
+ * returning the old value. 6b. so we also listen on MavenProjectChangedEvents and for 5b cases get the correct, fresh
+ * new MavenProject instance here. 7. please note that 6a comes before 6b and is done for both 5a and 5b as it's hard
+ * to tell those IMavenprojectfacade instances apart.. Your storyteller for tonite was mkleint
*/
-
+
public void mavenProjectChanged(MavenProjectChangedEvent[] events, IProgressMonitor monitor) {
IEditorInput input = getEditorInput();
- if (input instanceof IFileEditorInput) {
+ if(input instanceof IFileEditorInput) {
IFileEditorInput fileinput = (IFileEditorInput) input;
- for (MavenProjectChangedEvent event : events) {
- if (fileinput.getFile().equals(event.getSource())) {
+ for(MavenProjectChangedEvent event : events) {
+ if(fileinput.getFile().equals(event.getSource())) {
IMavenProjectFacade facade = event.getMavenProject();
- if (facade != null) {
- MavenProject mp = facade.getMavenProject();
- if (mp != null) {
+ if(facade != null) {
+ MavenProject mp = facade.getMavenProject();
+ if(mp != null) {
mavenProject = mp;
- if (getContainer() != null && !getContainer().isDisposed())
+ if(getContainer() != null && !getContainer().isDisposed())
getContainer().getDisplay().asyncExec(new Runnable() {
public void run() {
- for (MavenPomEditorPage page : getMavenPomEditorPages()) {
+ for(MavenPomEditorPage page : getMavenPomEditorPages()) {
page.mavenProjectHasChanged();
}
}
@@ -1119,5 +1128,4 @@ public class MavenPomEditor extends FormEditor implements IResourceChangeListene
}
}
-
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorContributor.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorContributor.java
index d10be490..bdb29f73 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorContributor.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorContributor.java
@@ -20,17 +20,17 @@ import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
/**
- * Manages the installation/deinstallation of global actions for multi-page
- * editors. Responsible for the redirection of global actions to the active
- * editor. Multi-page contributor replaces the contributors for the individual
- * editors in the multi-page editor.
+ * Manages the installation/deinstallation of global actions for multi-page editors. Responsible for the redirection of
+ * global actions to the active editor. Multi-page contributor replaces the contributors for the individual editors in
+ * the multi-page editor.
*/
public class MavenPomEditorContributor extends MultiPageEditorActionBarContributor {
private MavenPomEditor editorPart;
public void setActiveEditor(IEditorPart targetEditor) {
- if (targetEditor instanceof MavenPomEditor) {
+ if(targetEditor instanceof MavenPomEditor) {
editorPart = (MavenPomEditor) targetEditor;
setActivePage(editorPart.getActiveEditor());
}
@@ -39,18 +39,18 @@ public class MavenPomEditorContributor extends MultiPageEditorActionBarContribut
public void setActivePage(IEditorPart part) {
//set the text editor
IActionBars actionBars = getActionBars();
- if(editorPart !=null) {
- if (actionBars != null) {
+ if(editorPart != null) {
+ if(actionBars != null) {
actionBars.clearGlobalActionHandlers();
-
+
// undo/redo always enabled
actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), //
getAction(ITextEditorActionConstants.UNDO));
actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), //
getAction(ITextEditorActionConstants.REDO));
-
+
// all other action, for text editor only (FormPage doesn't provide for these actions...)
- if (part instanceof ITextEditor) {
+ if(part instanceof ITextEditor) {
actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), //
getAction(ITextEditorActionConstants.DELETE));
actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), //
@@ -66,13 +66,13 @@ public class MavenPomEditorContributor extends MultiPageEditorActionBarContribut
actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), //
getAction(IDEActionFactory.BOOKMARK.getId()));
}
-
+
actionBars.updateActionBars();
}
}
}
-
+
/**
* Returns the action registered with the given text editor.
*
@@ -82,11 +82,11 @@ public class MavenPomEditorContributor extends MultiPageEditorActionBarContribut
if(editorPart != null) {
try {
return editorPart.getSourcePage().getAction(actionId);
- } catch (NullPointerException e) {
+ } catch(NullPointerException e) {
//editor has been disposed, ignore
}
}
return null;
}
-
+
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
index 3ca126af..7441dc4b 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPage.java
@@ -11,9 +11,25 @@
package org.eclipse.m2e.editor.pom;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.ARTIFACT_ID;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.GROUP_ID;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.PARENT;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.VERSION;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getTextValue;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.performOnDOMDocument;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeIfNoChildElement;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.setText;
import static org.eclipse.m2e.editor.pom.FormUtils.isEmpty;
-import org.apache.maven.project.MavenProject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
@@ -34,21 +50,6 @@ import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.fieldassist.FieldDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.m2e.core.MavenPlugin;
-import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.m2e.core.project.IMavenProjectRegistry;
-import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction;
-import org.eclipse.m2e.core.ui.internal.dialogs.InputHistory;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple;
-
-import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.*;
-
-import org.eclipse.m2e.editor.MavenEditorImages;
-import org.eclipse.m2e.editor.internal.Messages;
-import org.eclipse.m2e.editor.xml.internal.FormHoverProvider;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
@@ -68,11 +69,21 @@ import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.wst.sse.core.internal.provisional.IModelStateListener;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
+
+import org.apache.maven.project.MavenProject;
+
+import org.eclipse.m2e.core.MavenPlugin;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.project.IMavenProjectRegistry;
+import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction;
+import org.eclipse.m2e.core.ui.internal.dialogs.InputHistory;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple;
+import org.eclipse.m2e.editor.MavenEditorImages;
+import org.eclipse.m2e.editor.internal.Messages;
+import org.eclipse.m2e.editor.xml.internal.FormHoverProvider;
/**
@@ -97,15 +108,13 @@ public abstract class MavenPomEditorPage extends FormPage {
private boolean dataLoaded;
private InputHistory inputHistory;
-
+
private Action selectParentAction;
private IModelStateListener listener;
-
+
private boolean alreadyShown = false;
-
-
public MavenPomEditorPage(MavenPomEditor pomEditor, String id, String title) {
super(pomEditor, id, title);
this.pomEditor = pomEditor;
@@ -113,31 +122,38 @@ public abstract class MavenPomEditorPage extends FormPage {
listener = new IModelStateListener() {
public void modelResourceMoved(IStructuredModel oldModel, IStructuredModel newModel) {
}
+
public void modelResourceDeleted(IStructuredModel model) {
}
+
public void modelReinitialized(IStructuredModel structuredModel) {
}
+
public void modelDirtyStateChanged(IStructuredModel model, boolean isDirty) {
}
+
public void modelChanged(IStructuredModel model) {
- if (!updatingModel2) {
+ if(!updatingModel2) {
loadData();
}
}
+
public void modelAboutToBeReinitialized(IStructuredModel structuredModel) {
}
+
public void modelAboutToBeChanged(IStructuredModel model) {
}
};
-
+
}
-
+
public MavenPomEditor getPomEditor() {
return pomEditor;
}
-
+
/**
* all edits in the editor to be channeled through this method..
+ *
* @param operation
* @param logger
* @param logMessage
@@ -159,7 +175,7 @@ public abstract class MavenPomEditorPage extends FormPage {
IToolBarManager toolBarManager = form.getToolBarManager();
// toolBarManager.add(pomEditor.showAdvancedTabsAction);
-
+
selectParentAction = new Action(Messages.MavenPomEditorPage_action_open, MavenEditorImages.PARENT_POM) {
public void run() {
final String[] ret = new String[3];
@@ -184,46 +200,45 @@ public abstract class MavenPomEditorPage extends FormPage {
} catch(Exception e) {
LOG.error("Error finding parent element", e);
}
-
+
}
};
toolBarManager.add(selectParentAction);
updateParentAction();
-
-
+
toolBarManager.add(new Action(Messages.MavenPomEditorPage_actio_refresh, MavenEditorImages.REFRESH) {
public void run() {
pomEditor.reload();
}
});
-
+
form.updateToolBar();
// compatibility proxy to support Eclipse 3.2
FormUtils.decorateHeader(managedForm.getToolkit(), form.getForm());
-
+
inputHistory.load();
}
-
+
public void setActive(boolean active) {
super.setActive(active);
-
+
doLoadData(active);
- if (active) {
- getPomEditor().getModel().addModelStateListener(listener);
+ if(active) {
+ getPomEditor().getModel().addModelStateListener(listener);
} else {
- getPomEditor().getModel().removeModelStateListener(listener);
+ getPomEditor().getModel().removeModelStateListener(listener);
}
- if (active && alreadyShown) {
+ if(active && alreadyShown) {
loadData();
updateParentAction();
- }
- alreadyShown = true;
-
+ }
+ alreadyShown = true;
+
//MNGECLIPSE-2674 checkreadonly is only calculated once, no need
// to update everytime this page gets active
boolean readOnly = pomEditor.checkReadOnly();
- if (readOnly) {
+ if(readOnly) {
// only perform when readonly==true, to prevent enabling all buttons on the page.
FormUtils.setReadonly((Composite) getPartControl(), readOnly);
}
@@ -232,30 +247,30 @@ public abstract class MavenPomEditorPage extends FormPage {
public boolean isReadOnly() {
return pomEditor.checkReadOnly();
}
-
+
private void doLoadData(boolean active) {
try {
if(active && !dataLoaded) {
dataLoaded = true;
- if(getPartControl() != null) {
- getPartControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- loadData();
- updateParentAction();
- } catch(Throwable e) {
- LOG.error("Error loading data", e); //$NON-NLS-1$
- }
+ if(getPartControl() != null) {
+ getPartControl().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ try {
+ loadData();
+ updateParentAction();
+ } catch(Throwable e) {
+ LOG.error("Error loading data", e); //$NON-NLS-1$
}
- });
- }
+ }
+ });
+ }
}
-
+
//error markers have to be always updated..
IFile pomFile = pomEditor.getPomFile();
if(pomFile != null) {
- String text = ""; //$NON-NLS-1$
+ String text = ""; //$NON-NLS-1$
IMarker[] markers = pomFile.findMarkers(IMavenConstants.MARKER_ID, true, IResource.DEPTH_ZERO);
IMarker max = null;
int maxSev = -1;
@@ -269,29 +284,31 @@ public abstract class MavenPomEditorPage extends FormPage {
} else {
toAdd = mark;
}
- if (toAdd != null) {
+ if(toAdd != null) {
//errors get prepended while warnings get appended.
- if (toAdd.getAttribute(IMarker.SEVERITY, -1) == IMarker.SEVERITY_ERROR) {
+ if(toAdd.getAttribute(IMarker.SEVERITY, -1) == IMarker.SEVERITY_ERROR) {
text = NLS.bind(Messages.MavenPomEditorPage_error_add, toAdd.getAttribute(IMarker.MESSAGE, "")) + text; //$NON-NLS-2$
} else {
- text = text + NLS.bind(Messages.MavenPomEditorPage_warning_add, toAdd.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-2$
+ text = text
+ + NLS.bind(Messages.MavenPomEditorPage_warning_add, toAdd.getAttribute(IMarker.MESSAGE, "")); //$NON-NLS-2$
}
}
}
}
if(max != null) {
- String head;
+ String head;
String maxText = max.getAttribute(IMarker.MESSAGE, Messages.MavenPomEditorPage_error_unknown);
- if (text.length() > 0) {
+ if(text.length() > 0) {
//if we have multiple errors
- text = NLS.bind(Messages.MavenPomEditorPage_add_desc,
- maxText, text);
- if (markers != null) {
+ text = NLS.bind(Messages.MavenPomEditorPage_add_desc, maxText, text);
+ if(markers != null) {
String number = new Integer(markers.length - 1).toString();
- head = NLS.bind(Messages.FormUtils_click_for_details2, maxText.length() > FormUtils.MAX_MSG_LENGTH ? maxText.substring(0, FormUtils.MAX_MSG_LENGTH) : maxText, number);
+ head = NLS.bind(Messages.FormUtils_click_for_details2,
+ maxText.length() > FormUtils.MAX_MSG_LENGTH ? maxText.substring(0, FormUtils.MAX_MSG_LENGTH)
+ : maxText, number);
} else {
head = maxText;
- if (head.length() > FormUtils.MAX_MSG_LENGTH) {
+ if(head.length() > FormUtils.MAX_MSG_LENGTH) {
head = NLS.bind(Messages.FormUtils_click_for_details, head.substring(0, FormUtils.MAX_MSG_LENGTH));
}
}
@@ -299,7 +316,7 @@ public abstract class MavenPomEditorPage extends FormPage {
//only this one
text = maxText;
head = maxText;
- if (head.length() > FormUtils.MAX_MSG_LENGTH) {
+ if(head.length() > FormUtils.MAX_MSG_LENGTH) {
head = NLS.bind(Messages.FormUtils_click_for_details, head.substring(0, FormUtils.MAX_MSG_LENGTH));
}
}
@@ -333,14 +350,15 @@ public abstract class MavenPomEditorPage extends FormPage {
}
}
-
+
private void setErrorMessageForMarkers(final String msg, final String tip, final int severity, final IMarker[] markers) {
- if (getPartControl() != null && !getPartControl().isDisposed()) {
+ if(getPartControl() != null && !getPartControl().isDisposed()) {
getPartControl().getDisplay().asyncExec(new Runnable() {
public void run() {
- if (!getManagedForm().getForm().isDisposed()) {
- FormHoverProvider.Execute runnable = FormHoverProvider.createHoverRunnable(getManagedForm().getForm().getShell(), markers, getPomEditor().getSourcePage().getTextViewer());
- if (runnable != null) {
+ if(!getManagedForm().getForm().isDisposed()) {
+ FormHoverProvider.Execute runnable = FormHoverProvider.createHoverRunnable(getManagedForm().getForm()
+ .getShell(), markers, getPomEditor().getSourcePage().getTextViewer());
+ if(runnable != null) {
FormUtils.setMessageWithPerformer(getManagedForm().getForm(), msg, severity, runnable);
} else {
FormUtils.setMessageAndTTip(getManagedForm().getForm(), msg, tip, severity);
@@ -352,10 +370,10 @@ public abstract class MavenPomEditorPage extends FormPage {
}
public void setErrorMessage(final String msg, final int severity) {
- if(getPartControl()!=null && !getPartControl().isDisposed()) {
+ if(getPartControl() != null && !getPartControl().isDisposed()) {
getPartControl().getDisplay().asyncExec(new Runnable() {
public void run() {
- if (!getManagedForm().getForm().isDisposed()) {
+ if(!getManagedForm().getForm().isDisposed()) {
FormUtils.setMessage(getManagedForm().getForm(), msg, severity);
}
}
@@ -363,13 +381,12 @@ public abstract class MavenPomEditorPage extends FormPage {
}
}
-
public boolean isAdapterForType(Object type) {
return false;
}
-
+
private void updateParentAction() {
- if (selectParentAction != null) {
+ if(selectParentAction != null) {
final boolean[] ret = new boolean[1];
try {
performOnDOMDocument(new OperationTuple(getPomEditor().getDocument(), new Operation() {
@@ -384,20 +401,21 @@ public abstract class MavenPomEditorPage extends FormPage {
} catch(Exception e) {
ret[0] = false;
}
- if (ret[0]) {
+ if(ret[0]) {
selectParentAction.setEnabled(true);
} else {
selectParentAction.setEnabled(false);
}
}
}
-
+
/**
- * creates a text field/Ccombo decoration that shows the evaluated value
+ * creates a text field/Ccombo decoration that shows the evaluated value
+ *
* @param control
*/
public final void createEvaluatorInfo(final Control control) {
- if (!(control instanceof Text || control instanceof CCombo)) {
+ if(!(control instanceof Text || control instanceof CCombo)) {
throw new IllegalArgumentException("Not a Text or CCombo");
}
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
@@ -410,12 +428,13 @@ public abstract class MavenPomEditorPage extends FormPage {
@Override
public String getDescriptionText() {
MavenProject mp = getPomEditor().getMavenProject();
- if (mp != null) {
- return FormUtils.simpleInterpolate(mp, control instanceof Text ? ((Text)control).getText() : ((CCombo)control).getText());
+ if(mp != null) {
+ return FormUtils.simpleInterpolate(mp, control instanceof Text ? ((Text) control).getText()
+ : ((CCombo) control).getText());
}
return "Cannot interpolate expressions, not resolvable file.";
}
-
+
};
decoration.setShowOnlyOnFocus(false);
decoration.setImage(fieldDecoration.getImage());
@@ -428,83 +447,82 @@ public abstract class MavenPomEditorPage extends FormPage {
});
ModifyListener listener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
- String text = control instanceof Text ? ((Text)control).getText() : ((CCombo)control).getText();
- if (text.indexOf("${") != -1 && text.indexOf("}") != -1) {
+ String text = control instanceof Text ? ((Text) control).getText() : ((CCombo) control).getText();
+ if(text.indexOf("${") != -1 && text.indexOf("}") != -1) {
decoration.show();
} else {
decoration.hide();
}
}
};
- if (control instanceof Text) {
- ((Text)control).addModifyListener(listener);
+ if(control instanceof Text) {
+ ((Text) control).addModifyListener(listener);
} else {
- ((CCombo)control).addModifyListener(listener);
+ ((CCombo) control).addModifyListener(listener);
}
control.addMouseTrackListener(new MouseTrackListener() {
public void mouseHover(MouseEvent e) {
decoration.showHoverText(decoration.getDescriptionText());
}
-
+
public void mouseExit(MouseEvent e) {
decoration.hideHover();
}
-
+
public void mouseEnter(MouseEvent e) {
}
});
- }
+ }
public void dispose() {
inputHistory.save();
MavenPomEditor pe = getPomEditor();
- if (pe != null && pe.getModel() != null) {
+ if(pe != null && pe.getModel() != null) {
pe.getModel().removeModelStateListener(listener);
}
-
+
super.dispose();
}
public abstract void loadData();
-
public void setElementValueProvider(Control control, ElementValueProvider provider) {
control.setData(VALUE_PROVIDER, provider);
}
-
+
public void setModifyListener(final Control control) {
Assert.isTrue(control instanceof CCombo || control instanceof Text || control instanceof Combo);
-
+
ModifyListener ml = new ModifyListener() {
String getText(Control control) {
- if (control instanceof Text) {
- return ((Text)control).getText();
+ if(control instanceof Text) {
+ return ((Text) control).getText();
}
- if (control instanceof Combo) {
- return ((Combo)control).getText();
+ if(control instanceof Combo) {
+ return ((Combo) control).getText();
}
- if (control instanceof CCombo) {
- return ((CCombo)control).getText();
+ if(control instanceof CCombo) {
+ return ((CCombo) control).getText();
}
throw new IllegalStateException();
}
-
+
public void modifyText(ModifyEvent e) {
final ElementValueProvider provider = (ElementValueProvider) control.getData(VALUE_PROVIDER);
- if (provider == null) {
+ if(provider == null) {
throw new IllegalStateException("no value provider for " + control);
}
performEditOperation(new Operation() {
public void process(Document document) {
String text = getText(control);
- if (isEmpty(text) || text.equals(provider.getDefaultValue())) {
+ if(isEmpty(text) || text.equals(provider.getDefaultValue())) {
//remove value
Element el = provider.find(document);
- if (el != null) {
+ if(el != null) {
Node parent = el.getParentNode();
- if (parent instanceof Element) {
- removeChild((Element)parent, el);
- removeIfNoChildElement((Element)parent);
+ if(parent instanceof Element) {
+ removeChild((Element) parent, el);
+ removeIfNoChildElement((Element) parent);
}
}
} else {
@@ -519,39 +537,37 @@ public abstract class MavenPomEditorPage extends FormPage {
control.setData(MODIFY_LISTENER, ml);
}
-
public void removeNotifyListener(Text control) {
if(!control.isDisposed()) {
ModifyListener listener = (ModifyListener) control.getData(MODIFY_LISTENER);
- if (listener != null) {
+ if(listener != null) {
control.removeModifyListener(listener);
}
}
}
-
+
public void addNotifyListener(Text control) {
if(!control.isDisposed()) {
ModifyListener listener = (ModifyListener) control.getData(MODIFY_LISTENER);
- if (listener != null) {
+ if(listener != null) {
control.addModifyListener(listener);
}
}
}
-
public void removeNotifyListener(CCombo control) {
if(!control.isDisposed()) {
ModifyListener listener = (ModifyListener) control.getData(MODIFY_LISTENER);
- if (listener != null) {
+ if(listener != null) {
control.removeModifyListener(listener);
}
}
}
-
+
public void addNotifyListener(CCombo control) {
if(!control.isDisposed()) {
ModifyListener listener = (ModifyListener) control.getData(MODIFY_LISTENER);
- if (listener != null) {
+ if(listener != null) {
control.addModifyListener(listener);
}
}
@@ -560,16 +576,16 @@ public abstract class MavenPomEditorPage extends FormPage {
public void removeNotifyListener(Combo control) {
if(!control.isDisposed()) {
ModifyListener listener = (ModifyListener) control.getData(MODIFY_LISTENER);
- if (listener != null) {
+ if(listener != null) {
control.removeModifyListener(listener);
}
}
}
-
+
public void addNotifyListener(Combo control) {
if(!control.isDisposed()) {
ModifyListener listener = (ModifyListener) control.getData(MODIFY_LISTENER);
- if (listener != null) {
+ if(listener != null) {
control.addModifyListener(listener);
}
}
@@ -585,10 +601,11 @@ public abstract class MavenPomEditorPage extends FormPage {
private IMavenProjectFacade findModuleProject(IFile pomFile, String module) {
IPath modulePath = pomFile.getParent().getLocation();
- if (modulePath == null) return null;
+ if(modulePath == null)
+ return null;
modulePath = modulePath.append(module);
//it's possible to have the pom file name in the module path..
- if (!modulePath.lastSegment().endsWith("pom.xml")) { //$NON-NLS-1$
+ if(!modulePath.lastSegment().endsWith("pom.xml")) { //$NON-NLS-1$
modulePath = modulePath.append("pom.xml"); //$NON-NLS-1$
}
IMavenProjectRegistry projectManager = MavenPlugin.getMavenProjectRegistry();
@@ -600,15 +617,16 @@ public abstract class MavenPomEditorPage extends FormPage {
}
return null;
}
-
+
public IFile findModuleFile(String moduleName) {
IFile pomFile = pomEditor.getPomFile();
- if(pomFile!=null) {
+ if(pomFile != null) {
IPath modulePath = pomFile.getParent().getLocation();
- if (modulePath == null) return null;
+ if(modulePath == null)
+ return null;
modulePath = modulePath.append(moduleName);
//it's possible to have the pom file name in the module path..
- if (!modulePath.lastSegment().endsWith("pom.xml")) { //$NON-NLS-1$
+ if(!modulePath.lastSegment().endsWith("pom.xml")) { //$NON-NLS-1$
modulePath = modulePath.append("pom.xml"); //$NON-NLS-1$
}
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(modulePath);
@@ -616,30 +634,30 @@ public abstract class MavenPomEditorPage extends FormPage {
}
return null;
}
-
+
public void initPopupMenu(Viewer viewer, String id) {
MenuManager menuMgr = new MenuManager("#PopupMenu-" + id); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
-
+
Menu menu = menuMgr.createContextMenu(viewer.getControl());
-
+
viewer.getControl().setMenu(menu);
-
+
getEditorSite().registerContextMenu(MavenPomEditor.EDITOR_ID + id, menuMgr, viewer, false);
}
-
/**
- * Adapter for Text, Combo and CCombo widgets
+ * Adapter for Text, Combo and CCombo widgets
*/
public interface TextAdapter {
String getText();
+
void addModifyListener(ModifyListener listener);
}
public IProject getProject() {
IFile pomFile = pomEditor.getPomFile();
- return pomFile != null? pomFile.getProject(): null;
+ return pomFile != null ? pomFile.getProject() : null;
}
protected void addToHistory(Control control) {
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPageFactory.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPageFactory.java
index 1560d66c..2f5e2efe 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPageFactory.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/MavenPomEditorPageFactory.java
@@ -19,5 +19,5 @@ package org.eclipse.m2e.editor.pom;
public abstract class MavenPomEditorPageFactory {
public abstract void addPages(MavenPomEditor pomEditor);
-
+
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
index 97acc237..c27d2458 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/OverviewPage.java
@@ -11,6 +11,39 @@
package org.eclipse.m2e.editor.pom;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.ARTIFACT_ID;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.CI_MANAGEMENT;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.CONNECTION;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DESCRIPTION;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.DEV_CONNECTION;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.GROUP_ID;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.INCEPTION_YEAR;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.ISSUE_MANAGEMENT;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.MODULE;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.MODULES;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.NAME;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.ORGANIZATION;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.PACKAGING;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.PARENT;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.PROPERTIES;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.RELATIVE_PATH;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.SCM;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.SYSTEM;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.TAG;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.URL;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.VERSION;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.childAt;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.createElementWithText;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChilds;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.format;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getTextValue;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.performOnDOMDocument;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeIfNoChildElement;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.setText;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.textEquals;
import static org.eclipse.m2e.editor.pom.FormUtils.nvl;
import static org.eclipse.m2e.editor.pom.FormUtils.setText;
@@ -19,6 +52,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
@@ -36,25 +75,6 @@ import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.m2e.core.embedder.ArtifactKey;
-import org.eclipse.m2e.core.internal.IMavenConstants;
-import org.eclipse.m2e.core.internal.index.IndexedArtifactFile;
-import org.eclipse.m2e.core.project.IMavenProjectFacade;
-import org.eclipse.m2e.core.ui.internal.MavenImages;
-import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction;
-import org.eclipse.m2e.core.ui.internal.dialogs.MavenRepositorySearchDialog;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
-import org.eclipse.m2e.core.ui.internal.search.util.Packaging;
-import org.eclipse.m2e.core.ui.internal.util.M2EUIUtils;
-import org.eclipse.m2e.core.ui.internal.util.ProposalUtil;
-import org.eclipse.m2e.core.ui.internal.wizards.MavenModuleWizard;
-import org.eclipse.m2e.core.ui.internal.wizards.WidthGroup;
-import org.eclipse.m2e.editor.MavenEditorImages;
-import org.eclipse.m2e.editor.composites.ListEditorComposite;
-import org.eclipse.m2e.editor.composites.ListEditorContentProvider;
-import org.eclipse.m2e.editor.composites.StringLabelProvider;
-import org.eclipse.m2e.editor.dialogs.MavenModuleSelectionDialog;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
@@ -89,12 +109,28 @@ import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.part.ResourceTransfer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.*;
+import org.eclipse.m2e.core.embedder.ArtifactKey;
+import org.eclipse.m2e.core.internal.IMavenConstants;
+import org.eclipse.m2e.core.internal.index.IndexedArtifactFile;
+import org.eclipse.m2e.core.project.IMavenProjectFacade;
+import org.eclipse.m2e.core.ui.internal.MavenImages;
+import org.eclipse.m2e.core.ui.internal.actions.OpenPomAction;
+import org.eclipse.m2e.core.ui.internal.dialogs.MavenRepositorySearchDialog;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple;
+import org.eclipse.m2e.core.ui.internal.search.util.Packaging;
+import org.eclipse.m2e.core.ui.internal.util.M2EUIUtils;
+import org.eclipse.m2e.core.ui.internal.util.ProposalUtil;
+import org.eclipse.m2e.core.ui.internal.wizards.MavenModuleWizard;
+import org.eclipse.m2e.core.ui.internal.wizards.WidthGroup;
+import org.eclipse.m2e.editor.MavenEditorImages;
+import org.eclipse.m2e.editor.composites.ListEditorComposite;
+import org.eclipse.m2e.editor.composites.ListEditorContentProvider;
+import org.eclipse.m2e.editor.composites.StringLabelProvider;
+import org.eclipse.m2e.editor.dialogs.MavenModuleSelectionDialog;
+import org.eclipse.m2e.editor.internal.Messages;
/**
@@ -107,16 +143,24 @@ public class OverviewPage extends MavenPomEditorPage {
//define more as the need arises
private static final int RELOAD_MODULES = 1;
+
private static final int RELOAD_BASE = 2;
+
private static final int RELOAD_CI = 4;
+
private static final int RELOAD_SCM = 8;
+
private static final int RELOAD_IM = 16;
+
private static final int RELOAD_PROPERTIES = 32;
+
private static final int RELOAD_PARENT = 64;
+
private static final int RELOAD_ORG = 128;
-
- private static final int RELOAD_ALL = RELOAD_MODULES + RELOAD_BASE + RELOAD_CI + RELOAD_SCM + RELOAD_IM + RELOAD_PROPERTIES + RELOAD_ORG + RELOAD_PARENT;
-
+
+ private static final int RELOAD_ALL = RELOAD_MODULES + RELOAD_BASE + RELOAD_CI + RELOAD_SCM + RELOAD_IM
+ + RELOAD_PROPERTIES + RELOAD_ORG + RELOAD_PARENT;
+
//controls
Text artifactIdText;
@@ -332,8 +376,6 @@ public class OverviewPage extends MavenPomEditorPage {
toolkit.paintBordersFor(artifactComposite);
}
-
-
private void createParentsection(FormToolkit toolkit, Composite composite, WidthGroup widthGroup) {
parentSection = toolkit.createSection(composite, //
@@ -349,11 +391,12 @@ public class OverviewPage extends MavenPomEditorPage {
String parentGroup = parentGroupIdText.getText();
String parentArtifact = parentArtifactIdText.getText();
String parentVersion = parentVersionText.getText();
- if (parentGroup != null && parentArtifact != null && parentVersion != null) {
+ if(parentGroup != null && parentArtifact != null && parentVersion != null) {
current.add(new ArtifactKey(parentGroup, parentArtifact, parentVersion, null));
}
- MavenRepositorySearchDialog dialog = MavenRepositorySearchDialog.createSearchParentDialog(
- getEditorSite().getShell(), Messages.OverviewPage_searchDialog_selectParent, getPomEditor().getMavenProject(), getProject());
+ MavenRepositorySearchDialog dialog = MavenRepositorySearchDialog.createSearchParentDialog(getEditorSite()
+ .getShell(), Messages.OverviewPage_searchDialog_selectParent, getPomEditor().getMavenProject(),
+ getProject());
if(parentGroup != null && parentGroup.trim().length() != 0) {
//chances are we will get good match by adding the groupid here..
dialog.setQuery(parentGroupIdText.getText());
@@ -435,7 +478,6 @@ public class OverviewPage extends MavenPomEditorPage {
createEvaluatorInfo(parentGroupIdText);
setElementValueProvider(parentGroupIdText, new ElementValueProvider(PomEdits.PARENT, PomEdits.GROUP_ID));
setModifyListener(parentGroupIdText);
-
final Label parentArtifactIdLabel = toolkit.createLabel(parentComposite, Messages.OverviewPage_lblArtifactId,
SWT.NONE);
@@ -450,7 +492,6 @@ public class OverviewPage extends MavenPomEditorPage {
createEvaluatorInfo(parentArtifactIdText);
setElementValueProvider(parentArtifactIdText, new ElementValueProvider(PomEdits.PARENT, PomEdits.ARTIFACT_ID));
setModifyListener(parentArtifactIdText);
-
Label parentVersionLabel = toolkit.createLabel(parentComposite, Messages.OverviewPage_lblVersion2, SWT.NONE);
parentVersionLabel.setLayoutData(new GridData());
@@ -461,14 +502,12 @@ public class OverviewPage extends MavenPomEditorPage {
parentVersionTextData.widthHint = 200;
parentVersionText.setLayoutData(parentVersionTextData);
parentVersionText.setData("name", "parentVersion"); //$NON-NLS-1$ //$NON-NLS-2$
- ProposalUtil.addVersionProposal(getProject(), null/** null because we don't want expressions from parent pom here */,
- parentGroupIdText, parentArtifactIdText, parentVersionText,
- Packaging.POM);
+ ProposalUtil.addVersionProposal(getProject(), null/** null because we don't want expressions from parent pom here */
+ , parentGroupIdText, parentArtifactIdText, parentVersionText, Packaging.POM);
M2EUIUtils.addRequiredDecoration(parentVersionText);
createEvaluatorInfo(parentVersionText);
setElementValueProvider(parentVersionText, new ElementValueProvider(PomEdits.PARENT, PomEdits.VERSION));
setModifyListener(parentVersionText);
-
ModifyListener ml = new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -575,9 +614,9 @@ public class OverviewPage extends MavenPomEditorPage {
performOnDOMDocument(new OperationTuple(getPomEditor().getDocument(), new Operation() {
public void process(Document document) {
Element modsEl = findChild(document.getDocumentElement(), MODULES);
- for (Element el : findChilds(modsEl, MODULE)) {
+ for(Element el : findChilds(modsEl, MODULE)) {
String m = getTextValue(el);
- if (m != null) {
+ if(m != null) {
modules.add(m);
}
}
@@ -586,7 +625,7 @@ public class OverviewPage extends MavenPomEditorPage {
} catch(Exception e1) {
LOG.error("Cannot load modules", e1);
}
-
+
for(String module : modules) {
IMavenProjectFacade facade = findModuleProject(module);
if(facade != null) {
@@ -625,14 +664,14 @@ public class OverviewPage extends MavenPomEditorPage {
modulesEditor.setRemoveButtonListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
try {
- performEditOperation( new Operation() {
+ performEditOperation(new Operation() {
public void process(Document document) {
Element root = document.getDocumentElement();
Element modules = findChild(root, MODULES);
- if (modules != null) {
- for (String module : modulesEditor.getSelection()) {
+ if(modules != null) {
+ for(String module : modulesEditor.getSelection()) {
Element modEl = findChild(modules, MODULE, textEquals(module));
- if (modEl != null) {
+ if(modEl != null) {
modules.removeChild(modEl);
}
}
@@ -658,20 +697,20 @@ public class OverviewPage extends MavenPomEditorPage {
public void modify(Object element, String property, final Object value) {
final int n = modulesEditor.getViewer().getTable().getSelectionIndex();
- try {
- performEditOperation( new Operation() {
- public void process(Document document) {
- Element root = document.getDocumentElement();
- Element module = findChild(findChild(root, MODULES), MODULE, childAt(n));
- if (module != null && !value.equals(getTextValue(module))) {
- setText(module, value.toString());
- }
+ try {
+ performEditOperation(new Operation() {
+ public void process(Document document) {
+ Element root = document.getDocumentElement();
+ Element module = findChild(findChild(root, MODULES), MODULE, childAt(n));
+ if(module != null && !value.equals(getTextValue(module))) {
+ setText(module, value.toString());
}
- }, LOG, "error changing module entry");
- } finally {
- loadThis(RELOAD_MODULES);
- }
+ }
+ }, LOG, "error changing module entry");
+ } finally {
+ loadThis(RELOAD_MODULES);
}
+ }
});
modulesEditor.getViewer().addDropSupport(DND.DROP_COPY | DND.DROP_LINK | DND.DROP_MOVE,
@@ -911,7 +950,7 @@ public class OverviewPage extends MavenPomEditorPage {
createEvaluatorInfo(scmDevConnectionText);
setElementValueProvider(scmDevConnectionText, new ElementValueProvider(PomEdits.SCM, PomEdits.DEV_CONNECTION));
setModifyListener(scmDevConnectionText);
-
+
Label scmTagLabel = toolkit.createLabel(scmComposite, Messages.OverviewPage_lblTag, SWT.NONE);
scmTagText = toolkit.createText(scmComposite, null, SWT.NONE);
@@ -922,7 +961,7 @@ public class OverviewPage extends MavenPomEditorPage {
createEvaluatorInfo(scmTagText);
setElementValueProvider(scmTagText, new ElementValueProvider(PomEdits.SCM, PomEdits.TAG));
setModifyListener(scmTagText);
-
+
widthGroup.addControl(scmUrlLabel);
widthGroup.addControl(scmConnectionLabel);
widthGroup.addControl(scmDevConnectionLabel);
@@ -955,7 +994,8 @@ public class OverviewPage extends MavenPomEditorPage {
toolkit.paintBordersFor(issueManagementSystemCombo);
toolkit.adapt(issueManagementSystemCombo, true, true);
createEvaluatorInfo(issueManagementSystemCombo);
- setElementValueProvider(issueManagementSystemCombo, new ElementValueProvider(PomEdits.ISSUE_MANAGEMENT, PomEdits.SYSTEM));
+ setElementValueProvider(issueManagementSystemCombo, new ElementValueProvider(PomEdits.ISSUE_MANAGEMENT,
+ PomEdits.SYSTEM));
setModifyListener(issueManagementSystemCombo);
Hyperlink issueManagementUrlLabel = toolkit.createHyperlink(issueManagementComposite, Messages.OverviewPage_lblUrl,
@@ -1033,7 +1073,6 @@ public class OverviewPage extends MavenPomEditorPage {
createEvaluatorInfo(ciManagementUrlCombo);
setElementValueProvider(ciManagementUrlCombo, new ElementValueProvider(PomEdits.CI_MANAGEMENT, PomEdits.URL));
setModifyListener(ciManagementUrlCombo);
-
widthGroup.addControl(ciManagementSystemLabel);
widthGroup.addControl(ciManagementUrlLabel);
@@ -1042,7 +1081,6 @@ public class OverviewPage extends MavenPomEditorPage {
ciManagementComposite.setTabList(new Control[] {ciManagementSystemCombo, ciManagementUrlCombo});
}
-
public void updateView(final Notification notification) {
//noop now
}
@@ -1057,7 +1095,7 @@ public class OverviewPage extends MavenPomEditorPage {
private void loadThis(final int mask) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
-
+
removeNotifyListener(parentGroupIdText);
removeNotifyListener(parentArtifactIdText);
removeNotifyListener(parentVersionText);
@@ -1071,7 +1109,7 @@ public class OverviewPage extends MavenPomEditorPage {
removeNotifyListener(projectDescriptionText);
removeNotifyListener(projectUrlText);
removeNotifyListener(inceptionYearText);
-
+
removeNotifyListener(organizationNameText);
removeNotifyListener(organizationUrlText);
@@ -1085,34 +1123,32 @@ public class OverviewPage extends MavenPomEditorPage {
removeNotifyListener(issueManagementUrlCombo);
removeNotifyListener(issueManagementSystemCombo);
-
-
+
try {
performOnDOMDocument(new OperationTuple(getPomEditor().getDocument(), new Operation() {
public void process(Document document) {
Element root = document.getDocumentElement();
String pack = nvl(getTextValue(findChild(root, PACKAGING)));
pack = "".equals(pack) ? "jar" : pack; //$NON-NLS-1$ //$NON-NLS-2$
- if ((mask & RELOAD_BASE) != 0) {
+ if((mask & RELOAD_BASE) != 0) {
setText(artifactGroupIdText, nvl(getTextValue(findChild(root, GROUP_ID))));
setText(artifactIdText, nvl(getTextValue(findChild(root, ARTIFACT_ID))));
setText(artifactVersionText, nvl(getTextValue(findChild(root, VERSION))));
setText(artifactPackagingCombo, pack);
-
+
String name = getTextValue(findChild(root, NAME));
setText(projectNameText, nvl(name));
String desc = getTextValue(findChild(root, DESCRIPTION));
setText(projectDescriptionText, nvl(desc));
- String url = getTextValue(findChild(root, URL));
+ String url = getTextValue(findChild(root, URL));
setText(projectUrlText, nvl(url));
String incep = getTextValue(findChild(root, INCEPTION_YEAR));
setText(inceptionYearText, nvl(incep));
- boolean expandProjectSection = name != null || desc != null
- || url != null || incep != null;
+ boolean expandProjectSection = name != null || desc != null || url != null || incep != null;
projectSectionData.grabExcessVerticalSpace = expandProjectSection;
projectSection.setExpanded(expandProjectSection);
}
- if ((mask & RELOAD_PARENT) != 0) {
+ if((mask & RELOAD_PARENT) != 0) {
//parent section
Element parent = findChild(root, PARENT);
String parentGrId = getTextValue(findChild(parent, GROUP_ID));
@@ -1122,20 +1158,21 @@ public class OverviewPage extends MavenPomEditorPage {
setText(parentArtifactIdText, nvl(parentArtId));
setText(parentVersionText, nvl(parentVers));
setText(parentRelativePathText, nvl(getTextValue(findChild(parent, RELATIVE_PATH))));
-
+
parentSelectAction.setEnabled(!isReadOnly());
// only enable when all 3 coordinates are actually present.
- parentOpenAction.setEnabled(root != null && parentGrId != null && parentArtId != null && parentVers != null);
+ parentOpenAction.setEnabled(root != null && parentGrId != null && parentArtId != null
+ && parentVers != null);
parentSection.setExpanded(parent != null);
}
- if ((mask & RELOAD_ORG) != 0) {
+ if((mask & RELOAD_ORG) != 0) {
//organization section
Element org = findChild(root, ORGANIZATION);
setText(organizationNameText, nvl(getTextValue(findChild(org, NAME))));
setText(organizationUrlText, nvl(getTextValue(findChild(org, URL))));
organizationSection.setExpanded(org != null);
}
- if ((mask & RELOAD_SCM) != 0) {
+ if((mask & RELOAD_SCM) != 0) {
//scm section
Element scm = findChild(root, SCM);
setText(scmUrlText, nvl(getTextValue(findChild(scm, URL))));
@@ -1144,52 +1181,52 @@ public class OverviewPage extends MavenPomEditorPage {
setText(scmTagText, nvl(getTextValue(findChild(scm, TAG))));
scmSection.setExpanded(scm != null);
}
- if ((mask & RELOAD_CI) != 0) {
+ if((mask & RELOAD_CI) != 0) {
//ci section
Element ci = findChild(root, CI_MANAGEMENT);
setText(ciManagementSystemCombo, nvl(getTextValue(findChild(ci, SYSTEM))));
setText(ciManagementUrlCombo, nvl(getTextValue(findChild(ci, URL))));
ciManagementSection.setExpanded(ci != null);
}
- if ((mask & RELOAD_IM) != 0) {
+ if((mask & RELOAD_IM) != 0) {
// issue management
Element im = findChild(root, ISSUE_MANAGEMENT);
setText(issueManagementSystemCombo, nvl(getTextValue(findChild(im, SYSTEM))));
setText(issueManagementUrlCombo, nvl(getTextValue(findChild(im, URL))));
issueManagementSection.setExpanded(im != null);
}
-
- if ((mask & RELOAD_MODULES) != 0) {
- //modules section..
+
+ if((mask & RELOAD_MODULES) != 0) {
+ //modules section..
List<Element> moduleEls = findChilds(findChild(root, MODULES), MODULE);
List<String> modules = new ArrayList<String>();
- for (Element moduleEl : moduleEls) {
+ for(Element moduleEl : moduleEls) {
String text = getTextValue(moduleEl);
- if (text != null) {
+ if(text != null) {
modules.add(text);
}
}
loadModules(modules, pack);
//#335337 no editing of packaging when there are modules, results in error anyway
- if (modules.size() > 0) {
+ if(modules.size() > 0) {
artifactPackagingCombo.setEnabled(false);
} else {
artifactPackagingCombo.setEnabled(true);
}
}
-
- if ((mask & RELOAD_PROPERTIES) != 0) {
+
+ if((mask & RELOAD_PROPERTIES) != 0) {
propertiesSection.refresh();
Element props = findChild(root, PROPERTIES);
propertiesSection.getSection().setExpanded(props != null);
- //TODO used to check teh model's empty state as well, not done now..
+ //TODO used to check teh model's empty state as well, not done now..
}
}
}, true));
} catch(Exception e) {
LOG.error("Failed to populate overview panel", e);
}
-
+
addNotifyListener(artifactGroupIdText);
addNotifyListener(artifactIdText);
addNotifyListener(artifactVersionText);
@@ -1198,7 +1235,7 @@ public class OverviewPage extends MavenPomEditorPage {
addNotifyListener(projectDescriptionText);
addNotifyListener(projectUrlText);
addNotifyListener(inceptionYearText);
-
+
addNotifyListener(parentGroupIdText);
addNotifyListener(parentArtifactIdText);
addNotifyListener(parentVersionText);
@@ -1206,15 +1243,15 @@ public class OverviewPage extends MavenPomEditorPage {
addNotifyListener(organizationNameText);
addNotifyListener(organizationUrlText);
-
+
addNotifyListener(scmUrlText);
addNotifyListener(scmConnectionText);
addNotifyListener(scmDevConnectionText);
addNotifyListener(scmTagText);
-
+
addNotifyListener(ciManagementUrlCombo);
addNotifyListener(ciManagementSystemCombo);
-
+
addNotifyListener(issueManagementUrlCombo);
addNotifyListener(issueManagementSystemCombo);
}
@@ -1246,7 +1283,7 @@ public class OverviewPage extends MavenPomEditorPage {
public void process(Document document) {
Element root = document.getDocumentElement();
Element modules = getChild(root, MODULES);
- if (findChild(modules, MODULE, textEquals(moduleName)) == null) {
+ if(findChild(modules, MODULE, textEquals(moduleName)) == null) {
format(createElementWithText(modules, MODULE, moduleName));
}
}
@@ -1264,19 +1301,19 @@ public class OverviewPage extends MavenPomEditorPage {
Element root = document.getDocumentElement();
String grid = getTextValue(findChild(root, GROUP_ID));
Element parent = findChild(root, PARENT);
- if (grid == null) {
+ if(grid == null) {
grid = getTextValue(findChild(parent, GROUP_ID));
}
String artifactId = getTextValue(findChild(root, ARTIFACT_ID));
String version = getTextValue(findChild(root, VERSION));
- if (version == null) {
+ if(version == null) {
version = getTextValue(findChild(parent, VERSION));
}
vals[0] = grid;
vals[1] = artifactId;
vals[2] = version;
}
- },true));
+ }, true));
} catch(Exception ex) {
LOG.error("Error getting values from document", ex);
}
@@ -1307,40 +1344,40 @@ public class OverviewPage extends MavenPomEditorPage {
IPath resultPath = container.getLocation();
String path = resultPath.makeRelativeTo(projectPath).toString();
- if (updateParentSection) {
- final String relativePath = projectPath.makeRelativeTo(resultPath).toString();
- try {
- performOnDOMDocument(new OperationTuple(pomFile, new Operation() {
- public void process(Document document) {
- Element root = document.getDocumentElement();
- Element parent = getChild(root, PARENT);
- setText(getChild(parent, GROUP_ID), parentGroupId);
- setText(getChild(parent, ARTIFACT_ID), parentArtifactId);
- setText(getChild(parent, VERSION), parentVersion);
- setText(getChild(parent, RELATIVE_PATH), relativePath);
- Element grId = findChild(root, GROUP_ID);
- String grIdText = getTextValue(grId);
- if (grIdText != null && grIdText.equals(parentGroupId)) {
- removeChild(root, grId);
- }
- Element ver = findChild(root, VERSION);
- String verText = getTextValue(ver);
- if (verText != null && verText.equals(parentVersion)) {
- removeChild(root, ver);
- }
+ if(updateParentSection) {
+ final String relativePath = projectPath.makeRelativeTo(resultPath).toString();
+ try {
+ performOnDOMDocument(new OperationTuple(pomFile, new Operation() {
+ public void process(Document document) {
+ Element root = document.getDocumentElement();
+ Element parent = getChild(root, PARENT);
+ setText(getChild(parent, GROUP_ID), parentGroupId);
+ setText(getChild(parent, ARTIFACT_ID), parentArtifactId);
+ setText(getChild(parent, VERSION), parentVersion);
+ setText(getChild(parent, RELATIVE_PATH), relativePath);
+ Element grId = findChild(root, GROUP_ID);
+ String grIdText = getTextValue(grId);
+ if(grIdText != null && grIdText.equals(parentGroupId)) {
+ removeChild(root, grId);
}
- }));
- } catch(Exception e) {
- LOG.error("Error updating parent reference in file:" + pomFile, e);
- }
+ Element ver = findChild(root, VERSION);
+ String verText = getTextValue(ver);
+ if(verText != null && verText.equals(parentVersion)) {
+ removeChild(root, ver);
+ }
+ }
+ }));
+ } catch(Exception e) {
+ LOG.error("Error updating parent reference in file:" + pomFile, e);
}
+ }
- createNewModule(path);
+ createNewModule(path);
}
}
public class ModulesLabelProvider extends StringLabelProvider {
-
+
private final MavenPomEditorPage editorPage;
public ModulesLabelProvider(MavenPomEditorPage editorPage) {
@@ -1353,16 +1390,16 @@ public class OverviewPage extends MavenPomEditorPage {
if(element instanceof String) {
String moduleName = (String) element;
IMavenProjectFacade projectFacade = editorPage.findModuleProject(moduleName);
- if(projectFacade!=null) {
+ if(projectFacade != null) {
return MavenEditorImages.IMG_PROJECT;
}
-
+
IFile moduleFile = editorPage.findModuleFile(moduleName);
- if(moduleFile!=null && moduleFile.isAccessible()) {
+ if(moduleFile != null && moduleFile.isAccessible()) {
return MavenEditorImages.IMG_PROJECT;
}
}
return super.getImage(element);
}
- }
+ }
}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java
index a8073dac..25237339 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/PropertiesSection.java
@@ -11,23 +11,31 @@
package org.eclipse.m2e.editor.pom;
-import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.*;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.PROPERTIES;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.findChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.getTextValue;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.performOnDOMDocument;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeChild;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.removeIfNoChildElement;
+import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.setText;
import java.util.ArrayList;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
import org.eclipse.emf.ecore.xml.type.internal.DataValue.XMLChar;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.m2e.core.ui.internal.dialogs.MavenPropertyDialog;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation;
-import org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple;
-import org.eclipse.m2e.editor.MavenEditorImages;
-import org.eclipse.m2e.editor.composites.ListEditorComposite;
-import org.eclipse.m2e.editor.composites.ListEditorContentProvider;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -40,12 +48,15 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+
+import org.eclipse.m2e.core.ui.internal.dialogs.MavenPropertyDialog;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Operation;
+import org.eclipse.m2e.core.ui.internal.editing.PomEdits.OperationTuple;
+import org.eclipse.m2e.editor.MavenEditorImages;
+import org.eclipse.m2e.editor.composites.ListEditorComposite;
+import org.eclipse.m2e.editor.composites.ListEditorContentProvider;
+import org.eclipse.m2e.editor.internal.Messages;
+
/**
* This is properties editor (double click edits the property)
@@ -53,15 +64,19 @@ import org.w3c.dom.NodeList;
* @author Anton Kraev, Milos Kleint
*/
public class PropertiesSection {
-
+
private static Logger LOG = LoggerFactory.getLogger(PropertiesSection.class);
-
+
private final MavenPomEditorPage page;
+
private FormToolkit toolkit;
+
private Composite composite;
+
private Section propertiesSection;
+
ListEditorComposite<PropertyElement> propertiesEditor;
-
+
private VerifyListener listener = new VerifyListener() {
public void verifyText(VerifyEvent e) {
e.doit = XMLChar.isValidName(e.text);
@@ -74,19 +89,19 @@ public class PropertiesSection {
this.page = page;
createSection();
}
-
+
private List<PropertyElement> getProperties() {
final List<PropertyElement> toRet = new ArrayList<PropertyElement>();
-
+
try {
performOnDOMDocument(new OperationTuple(page.getPomEditor().getDocument(), new Operation() {
public void process(Document document) {
Element properties = findChild(document.getDocumentElement(), PROPERTIES);
- if (properties != null) {
+ if(properties != null) {
NodeList nl = properties.getChildNodes();
- for (int i = 0; i < nl.getLength(); i++) {
+ for(int i = 0; i < nl.getLength(); i++ ) {
Node child = nl.item(i);
- if (child instanceof Element) {
+ if(child instanceof Element) {
toRet.add(new PropertyElement(child.getNodeName(), getTextValue(child)));
}
}
@@ -98,7 +113,7 @@ public class PropertiesSection {
}
return toRet;
}
-
+
private Section createSection() {
propertiesSection = toolkit.createSection(composite, //
ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE);
@@ -110,7 +125,7 @@ public class PropertiesSection {
propertiesEditor = new ListEditorComposite<PropertyElement>(propertiesSection, SWT.NONE);
propertiesSection.setClient(propertiesEditor);
propertiesEditor.getViewer().getTable().setData("name", "properties"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
propertiesEditor.setContentProvider(new ListEditorContentProvider<PropertyElement>());
propertiesEditor.setLabelProvider(new PropertyPairLabelProvider());
@@ -128,47 +143,47 @@ public class PropertiesSection {
public void doubleClick(DoubleClickEvent event) {
editProperty(propertiesEditor.getSelection());
}
- }) ;
-
+ });
+
toolkit.paintBordersFor(propertiesEditor);
toolkit.adapt(propertiesEditor);
-
+
return propertiesSection;
}
-
+
public void refresh() {
propertiesEditor.setInput(getProperties());
propertiesEditor.refresh();
}
-
+
void editProperty(List<PropertyElement> list) {
- if (list.size() != 1) {
+ if(list.size() != 1) {
return;
}
-
+
final PropertyElement pp = list.get(0);
-
+
MavenPropertyDialog dialog = new MavenPropertyDialog(propertiesSection.getShell(), //
Messages.PropertiesSection_title_editProperty, pp.getName(), pp.getValue(), listener);
if(dialog.open() == IDialogConstants.OK_ID) {
final String key = dialog.getName();
final String value = dialog.getValue();
try {
- page.performEditOperation( new Operation() {
+ page.performEditOperation(new Operation() {
public void process(Document document) {
Element properties = getChild(document.getDocumentElement(), PROPERTIES);
Element old = findChild(properties, pp.getName());
- if (old == null) {
+ if(old == null) {
//should never happen..
old = getChild(properties, pp.getName());
}
- if (!pp.getName().equals(key)) {
+ if(!pp.getName().equals(key)) {
Element newElement = document.createElement(key);
properties.replaceChild(newElement, old);
setText(newElement, pp.getValue());
old = newElement;
}
- if (!pp.getValue().equals(value)) {
+ if(!pp.getValue().equals(value)) {
setText(old, value);
}
}
@@ -181,12 +196,12 @@ public class PropertiesSection {
void createNewProperty() {
MavenPropertyDialog dialog = new MavenPropertyDialog(propertiesSection.getShell(), //
- Messages.PropertiesSection_title_addProperty, "", "", listener); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ Messages.PropertiesSection_title_addProperty, "", "", listener); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
if(dialog.open() == IDialogConstants.OK_ID) {
final String key = dialog.getName();
final String value = dialog.getValue();
try {
- page.performEditOperation( new Operation() {
+ page.performEditOperation(new Operation() {
public void process(Document document) {
Element prop = getChild(document.getDocumentElement(), PROPERTIES, key);
setText(prop, value);
@@ -203,9 +218,9 @@ public class PropertiesSection {
page.performEditOperation(new Operation() {
public void process(Document document) {
Element props = findChild(document.getDocumentElement(), PROPERTIES);
- if (props != null) {
+ if(props != null) {
//now what if we don't find the props? profile or parent? or out of sync?
- for (PropertyElement el : selection) {
+ for(PropertyElement el : selection) {
Element prop = findChild(props, el.getName());
removeChild(props, prop);
}
@@ -221,7 +236,7 @@ public class PropertiesSection {
public ExpandableComposite getSection() {
return propertiesSection;
}
-
+
static class PropertyPairLabelProvider extends LabelProvider {
public String getText(Object element) {
@@ -231,14 +246,15 @@ public class PropertiesSection {
}
return super.getText(element);
}
-
+
public Image getImage(Object element) {
return MavenEditorImages.IMG_PROPERTY;
}
}
-
+
static class PropertyElement {
private final String name;
+
private final String value;
public PropertyElement(String name, String value) {
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ScopeArtifactFilter.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ScopeArtifactFilter.java
index 124e90a1..54123441 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ScopeArtifactFilter.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ScopeArtifactFilter.java
@@ -14,6 +14,7 @@ package org.eclipse.m2e.editor.pom;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+
/**
* An artifact filter supporting all dependency scopes
*
@@ -21,9 +22,13 @@ import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
*/
public class ScopeArtifactFilter implements ArtifactFilter {
private final boolean compileScope;
+
private final boolean runtimeScope;
+
private final boolean testScope;
+
private final boolean providedScope;
+
private final boolean systemScope;
public ScopeArtifactFilter(String scope) {
@@ -80,6 +85,5 @@ public class ScopeArtifactFilter implements ArtifactFilter {
}
return true;
}
-
-}
+}
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchControl.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchControl.java
index d74b39b0..e71b2429 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchControl.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchControl.java
@@ -12,8 +12,6 @@
package org.eclipse.m2e.editor.pom;
import org.eclipse.jface.action.ControlContribution;
-import org.eclipse.m2e.editor.MavenEditorImages;
-import org.eclipse.m2e.editor.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -29,6 +27,9 @@ import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.m2e.editor.MavenEditorImages;
+import org.eclipse.m2e.editor.internal.Messages;
+
/**
* @author Eugene Kuleshov
@@ -47,11 +48,11 @@ public class SearchControl extends ControlContribution {
return searchText;
}
- private boolean isMac(){
- String os =System.getProperty("os.name"); //$NON-NLS-1$
+ private boolean isMac() {
+ String os = System.getProperty("os.name"); //$NON-NLS-1$
return os != null && os.startsWith("Mac"); //$NON-NLS-1$
}
-
+
protected Control createControl(Composite parent) {
if(parent instanceof ToolBar) {
// the FormHeading class sets the toolbar cursor to hand for some reason,
@@ -66,7 +67,7 @@ public class SearchControl extends ControlContribution {
layout.marginWidth = 0;
//gross, but on the Mac the search controls are cut off on the bottom,
//so they need to be bumped up a little. other OSs are fine.
- if(isMac()){
+ if(isMac()) {
layout.marginHeight = -1;
}
layout.verticalSpacing = 0;
@@ -78,7 +79,7 @@ public class SearchControl extends ControlContribution {
searchText = toolkit.createText(composite, "", SWT.FLAT | SWT.SEARCH); //$NON-NLS-1$
searchText.setData(FormToolkit.TEXT_BORDER, Boolean.TRUE);
-
+
searchText.setLayoutData(new GridData(200, -1));
ToolBar cancelBar = new ToolBar(composite, SWT.FLAT);
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchMatcher.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchMatcher.java
index 2e244fea..d7e35675 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchMatcher.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/SearchMatcher.java
@@ -11,7 +11,6 @@
package org.eclipse.m2e.editor.pom;
-
/**
* @author Eugene Kuleshov
*/
@@ -28,7 +27,7 @@ public class SearchMatcher extends Matcher {
return (groupId != null && groupId.indexOf(text) > -1) //
|| (artifactId != null && artifactId.indexOf(text) > -1);
}
-
+
public boolean isEmpty() {
return searchControl.getSearchText().getText() == null //
|| searchControl.getSearchText().getText().trim().length() == 0;
diff --git a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ValueProvider.java b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ValueProvider.java
index ea56306a..3d428e34 100644
--- a/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ValueProvider.java
+++ b/org.eclipse.m2e.editor/src/org/eclipse/m2e/editor/pom/ValueProvider.java
@@ -11,7 +11,6 @@
package org.eclipse.m2e.editor.pom;
-
/**
* Value provider for retrieving and creating holder element values
*
@@ -20,10 +19,9 @@ package org.eclipse.m2e.editor.pom;
public abstract class ValueProvider<T> {
public abstract T getValue();
-
+
public boolean isEmpty() {
return false;
}
-
}

Back to the top