Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Bricon2014-04-29 11:16:01 -0400
committerFred Bricon2014-05-02 11:19:56 -0400
commit8b7cfc032d23d8fe787d08623d7f2a92afce46eb (patch)
treea60920d6de97d34379389e0793bd9a07fedb706e /org.eclipse.m2e.editor.xml
parent1bc6c82fcfdf61ca7205af0685f1efb519d10e64 (diff)
downloadm2e-core-8b7cfc032d23d8fe787d08623d7f2a92afce46eb.tar.gz
m2e-core-8b7cfc032d23d8fe787d08623d7f2a92afce46eb.tar.xz
m2e-core-8b7cfc032d23d8fe787d08623d7f2a92afce46eb.zip
433776 : Add ability to change 'Out-of-date' project errors into warnings
* renamed Warnings preference page into Errors/Warnings (to be consistent with other Eclipse projects) * Added an 'Out-of-date project configuration' problem combo with ignore/warning/error values * Changed existing '*** duplicate of parent version' checkboxes into combos with ignore/warning/error values for more consistency Preference keys for '*** duplicate of parent version' were changed to accomodate the new String values. Existing/Legacy boolean based preferences will not be converted automatically thus will be ignored. Change-Id: Iae61416a2186b28e2a977158174a4bae2accd98a Signed-off-by: Fred Bricon <fbricon@gmail.com>
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.java25
1 files changed, 14 insertions, 11 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 f0e40179..909c46f3 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,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
+ * Copyright (c) 2008-2014 Sonatype, Inc. and others.
* 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
@@ -60,6 +60,7 @@ 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.internal.preferences.ProblemSeverity;
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;
@@ -493,7 +494,8 @@ public class MarkerLocationService implements IMarkerLocationService, IEditorMar
IResource pomFile, String type, IStructuredDocument document) throws CoreException {
Element parent = findChild(root, PomEdits.PARENT);
Element groupId = findChild(root, PomEdits.GROUP_ID);
- if(parent != null && groupId != null && !skipParentMatchingGroupIdWarning()) {
+ ProblemSeverity matchingParentGroupIdSeverity = getMatchingParentGroupIdSeverity();
+ if(parent != null && groupId != null && !ProblemSeverity.ignore.equals(matchingParentGroupIdSeverity)) {
//now compare the values of parent and project groupid..
String parentString = getTextValue(findChild(parent, PomEdits.GROUP_ID));
String childString = getTextValue(groupId);
@@ -503,7 +505,7 @@ public class MarkerLocationService implements IMarkerLocationService, IEditorMar
IndexedRegion off = (IndexedRegion) groupId;
IMarker mark = mavenMarkerManager.addMarker(pomFile, type,
org.eclipse.m2e.core.internal.Messages.MavenMarkerManager_duplicate_groupid,
- document.getLineOfOffset(off.getStartOffset()) + 1, IMarker.SEVERITY_WARNING);
+ document.getLineOfOffset(off.getStartOffset()) + 1, matchingParentGroupIdSeverity.getSeverity());
mark.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_PARENT_GROUP_ID);
mark.setAttribute(IMarker.CHAR_START, off.getStartOffset());
mark.setAttribute(IMarker.CHAR_END, off.getEndOffset());
@@ -512,7 +514,8 @@ public class MarkerLocationService implements IMarkerLocationService, IEditorMar
}
}
Element version = findChild(root, PomEdits.VERSION); //$NON-NLS-1$
- if(parent != null && version != null && !skipParentMatchingVersionWarning()) {
+ ProblemSeverity matchingParentVersionSeverity = getMatchingParentVersionSeverity();
+ if(parent != null && version != null && !ProblemSeverity.ignore.equals(matchingParentVersionSeverity)) {
//now compare the values of parent and project version..
String parentString = getTextValue(findChild(parent, PomEdits.VERSION)); //$NON-NLS-1$
String childString = getTextValue(version);
@@ -522,7 +525,7 @@ public class MarkerLocationService implements IMarkerLocationService, IEditorMar
IndexedRegion off = (IndexedRegion) version;
IMarker mark = mavenMarkerManager.addMarker(pomFile, type,
org.eclipse.m2e.core.internal.Messages.MavenMarkerManager_duplicate_version,
- document.getLineOfOffset(off.getStartOffset()) + 1, IMarker.SEVERITY_WARNING);
+ document.getLineOfOffset(off.getStartOffset()) + 1, matchingParentVersionSeverity.getSeverity());
mark.setAttribute(IMavenConstants.MARKER_ATTR_EDITOR_HINT, IMavenConstants.EDITOR_HINT_PARENT_VERSION);
mark.setAttribute(IMarker.CHAR_START, off.getStartOffset());
mark.setAttribute(IMarker.CHAR_END, off.getEndOffset());
@@ -532,14 +535,14 @@ 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 ProblemSeverity getMatchingParentGroupIdSeverity() {
+ return ProblemSeverity.get(M2EUIPluginActivator.getDefault().getPreferenceStore()
+ .getString(MavenPreferenceConstants.P_DUP_OF_PARENT_GROUPID_PB));
}
- private static boolean skipParentMatchingVersionWarning() {
- return M2EUIPluginActivator.getDefault().getPreferenceStore()
- .getBoolean(MavenPreferenceConstants.P_DISABLE_VERSION_DUP_OF_PARENT_WARNING);
+ private static ProblemSeverity getMatchingParentVersionSeverity() {
+ return ProblemSeverity.get(M2EUIPluginActivator.getDefault().getPreferenceStore()
+ .getString(MavenPreferenceConstants.P_DUP_OF_PARENT_VERSION_PB));
}
/**

Back to the top