Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Newton2012-05-17 05:57:57 -0400
committerIgor Fedorenko2012-05-17 07:40:40 -0400
commit0fcd714ad71be4425786714ceec14b24221aef13 (patch)
tree34d6a3a40dcfb6065f3d100c1c65c41c8b6636d3 /org.eclipse.m2e.editor.xml
parenta88c873eb0401be2337d44e7fe32a0fccb84d06a (diff)
downloadm2e-core-0fcd714ad71be4425786714ceec14b24221aef13.tar.gz
m2e-core-0fcd714ad71be4425786714ceec14b24221aef13.tar.xz
m2e-core-0fcd714ad71be4425786714ceec14b24221aef13.zip
Bug 356796: Add a Warnings preference page with options to disable warnings when <GroupId is duplicate of parent groupId> and <Version is duplicate of parent version>. Also mod MarkerLocationServer to respect these new preferences.
Diffstat (limited to 'org.eclipse.m2e.editor.xml')
-rw-r--r--org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerLocationService.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerLocationService.java b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerLocationService.java
index 482f2bc6..75577ee4 100644
--- a/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerLocationService.java
+++ b/org.eclipse.m2e.editor.xml/src/main/java/org/eclipse/m2e/editor/xml/internal/MarkerLocationService.java
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008-2010 Sonatype, Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype, Inc. - initial API and implementation
+ * Rob Newton - added warning preferences page for disabling warnings
+ *******************************************************************************/
+
package org.eclipse.m2e.editor.xml.internal;
import static org.eclipse.m2e.core.ui.internal.editing.PomEdits.childEquals;
@@ -45,6 +57,8 @@ import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.internal.markers.IEditorMarkerService;
import org.eclipse.m2e.core.internal.markers.IMarkerLocationService;
import org.eclipse.m2e.core.internal.markers.IMavenMarkerManager;
+import org.eclipse.m2e.core.internal.preferences.MavenPreferenceConstants;
+import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator;
import org.eclipse.m2e.core.ui.internal.editing.PomEdits;
import org.eclipse.m2e.core.ui.internal.editing.PomEdits.Matcher;
@@ -472,7 +486,8 @@ public class MarkerLocationService implements IMarkerLocationService, IEditorMar
IStructuredDocument document) throws CoreException {
Element parent = findChild(root, PomEdits.PARENT);
Element groupId = findChild(root, PomEdits.GROUP_ID);
- if(parent != null && groupId != null) {
+ if(parent != null && groupId != null
+ && !skipParentMatchingGroupIdWarning()) {
//now compare the values of parent and project groupid..
String parentString = getTextValue(findChild(parent, PomEdits.GROUP_ID));
String childString = getTextValue(groupId);
@@ -491,7 +506,8 @@ public class MarkerLocationService implements IMarkerLocationService, IEditorMar
}
}
Element version = findChild(root, PomEdits.VERSION); //$NON-NLS-1$
- if(parent != null && version != null) {
+ if(parent != null && version != null
+ && !skipParentMatchingVersionWarning()) {
//now compare the values of parent and project version..
String parentString = getTextValue(findChild(parent, PomEdits.VERSION)); //$NON-NLS-1$
String childString = getTextValue(version);
@@ -511,6 +527,16 @@ public class MarkerLocationService implements IMarkerLocationService, IEditorMar
}
}
+ private static boolean skipParentMatchingGroupIdWarning() {
+ return M2EUIPluginActivator.getDefault().getPreferenceStore().getBoolean(
+ MavenPreferenceConstants.P_DISABLE_GROUPID_DUP_OF_PARENT_WARNING);
+ }
+
+ private static boolean skipParentMatchingVersionWarning() {
+ return M2EUIPluginActivator.getDefault().getPreferenceStore().getBoolean(
+ MavenPreferenceConstants.P_DISABLE_VERSION_DUP_OF_PARENT_WARNING);
+ }
+
/**
* @param mavenMarkerManager
* @param pomFile

Back to the top