diff options
7 files changed, 133 insertions, 2 deletions
diff --git a/org.eclipse.m2e.core.ui/plugin.properties b/org.eclipse.m2e.core.ui/plugin.properties index 8836c143..98629170 100644 --- a/org.eclipse.m2e.core.ui/plugin.properties +++ b/org.eclipse.m2e.core.ui/plugin.properties @@ -5,6 +5,9 @@ # 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 Bundle-Vendor = Eclipse.org - m2e Bundle-Name = Maven Integration for Eclipse @@ -73,6 +76,7 @@ page.installations.name = Installations page.usersettings.name = User Settings page.archetypes.name = Archetypes page.userinterface.name = User Interface +page.warnings.name = Warnings category.general.name = General wizard.install.name = Install or deploy an artifact to a Maven repository wizard.install.description = Install or Deploy an artifact (archive) into a Maven repository diff --git a/org.eclipse.m2e.core.ui/plugin.xml b/org.eclipse.m2e.core.ui/plugin.xml index 367ca148..7bd68a42 100644 --- a/org.eclipse.m2e.core.ui/plugin.xml +++ b/org.eclipse.m2e.core.ui/plugin.xml @@ -1,4 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2007, 2008 Sonatype, Inc. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Sonatype, Inc. - initial API and implementation + Rob Newton - added warning preferences page for disabling warnings +--> <?eclipse version="3.4"?> <plugin> <extension-point id="discoveryLaunch" name="discoveryLaunch" schema="schema/discoveryLaunch.exsd"/> @@ -393,6 +404,12 @@ name="%page.userinterface.name"> <keywordReference id="org.eclipse.m2e.maven"/> </page> + <page id="org.eclipse.m2e.core.ui.preferences.WarningsPreferencePage" + category="org.eclipse.m2e.core.preferences.Maven2PreferencePage" + class="org.eclipse.m2e.core.ui.internal.preferences.WarningsPreferencePage" + name="%page.warnings.name"> + <keywordReference id="org.eclipse.m2e.maven"/> + </page> </extension> <extension point="org.eclipse.ui.newWizards"> diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java index 53967744..3e8955a6 100644 --- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/Messages.java @@ -7,6 +7,7 @@ * * Contributors: * Sonatype, Inc. - initial API and implementation + * Rob Newton - added warning preferences page *******************************************************************************/ package org.eclipse.m2e.core.ui.internal; @@ -548,6 +549,10 @@ public class Messages extends NLS { public static String MavenSettingsPreferencePage_title; + public static String MavenWarningsPreferencePage_groupidDupParent; + + public static String MavenWarningsPreferencePage_versionDupParent; + public static String MavenPreferencePage_warnIncompleteMapping; public static String OpenPomAction_33; diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties index b8522ffc..759f1486 100644 --- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/messages.properties @@ -1,3 +1,14 @@ +# +# Copyright (c) 2007, 2008 Sonatype, Inc. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Sonatype, Inc. - initial API and implementation +# Rob Newton - added warning preferences page for disabling warnings + #Eclipse modern messages class #Tue Jan 10 20:42:30 EST 2012 AddDependencyAction_error_msg=Can't add dependency to {0} @@ -267,6 +278,8 @@ MavenSettingsPreferencePage_link2=User &Settings (<a href\="\#">open file</a>)\: MavenSettingsPreferencePage_link_tooltip=Open editor for user settings MavenSettingsPreferencePage_task_updating=Updating progress for {0} MavenSettingsPreferencePage_title=Maven User Settings +MavenWarningsPreferencePage_groupidDupParent=Disable "{0}" warning +MavenWarningsPreferencePage_versionDupParent=Disable "{0}" warning OpenPomAction_33=Can't open editor for {0}\n{1} OpenPomAction_error_download=Can't download {0} OpenPomAction_error_download_source=Can't download sources for {0} diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/WarningsPreferencePage.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/WarningsPreferencePage.java new file mode 100644 index 00000000..cf6d72f2 --- /dev/null +++ b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/preferences/WarningsPreferencePage.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2012 Rob Newton. + * 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: + * Rob Newton - initial warnings preference page + *******************************************************************************/ + +package org.eclipse.m2e.core.ui.internal.preferences; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +import org.eclipse.m2e.core.internal.preferences.MavenPreferenceConstants; +import org.eclipse.m2e.core.ui.internal.M2EUIPluginActivator; +import org.eclipse.m2e.core.ui.internal.Messages; + + +public class WarningsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + private Composite parent; + + public WarningsPreferencePage() { + super(GRID); + setPreferenceStore(M2EUIPluginActivator.getDefault().getPreferenceStore()); + } + + public void init(IWorkbench workbench) { + } + + /* + * Creates the field editors. Field editors are abstractions of the common GUI + * blocks needed to manipulate various types of preferences. Each field editor + * knows how to save and restore itself. + */ + public void createFieldEditors() { + parent = getFieldEditorParent(); + String text; + + text = NLS.bind(Messages.MavenWarningsPreferencePage_groupidDupParent, + org.eclipse.m2e.core.internal.Messages.MavenMarkerManager_duplicate_groupid); + addField(new BooleanFieldEditor( + MavenPreferenceConstants.P_DISABLE_GROUPID_DUP_OF_PARENT_WARNING, + text, parent)); + + text = NLS.bind(Messages.MavenWarningsPreferencePage_versionDupParent, + org.eclipse.m2e.core.internal.Messages.MavenMarkerManager_duplicate_version); + addField(new BooleanFieldEditor( + MavenPreferenceConstants.P_DISABLE_VERSION_DUP_OF_PARENT_WARNING, + text, parent)); + } +} diff --git a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java index c89df1c8..fdf76d81 100644 --- a/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java +++ b/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/preferences/MavenPreferenceConstants.java @@ -7,6 +7,7 @@ * * Contributors: * Sonatype, Inc. - initial API and implementation + * Rob Newton - added warning preferences page *******************************************************************************/ package org.eclipse.m2e.core.internal.preferences; @@ -88,4 +89,10 @@ public interface MavenPreferenceConstants { /** boolean **/ public static final String P_DEFAULT_POM_EDITOR_PAGE = "eclipse.m2.defaultPomEditorPage"; //$NON-NLS-1$ + + /** boolean **/ + public static final String P_DISABLE_GROUPID_DUP_OF_PARENT_WARNING = PREFIX + ".disableGroupIdDuplicateOfParentWarning"; //$NON-NLS-1$ + + /** boolean **/ + public static final String P_DISABLE_VERSION_DUP_OF_PARENT_WARNING = PREFIX + ".disableVersionDuplicateOfParentWarning"; //$NON-NLS-1$ } 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 |