Bug 539998 - Report error if project without test sources has project
with only test sources on build path

Change-Id: Idd3016a0f13893a898fda671988faaf56ab36f5d
diff --git a/org.eclipse.jdt.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.ui/META-INF/MANIFEST.MF
index 75fad78..e24dcf1 100644
--- a/org.eclipse.jdt.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.ui/META-INF/MANIFEST.MF
@@ -116,7 +116,7 @@
  org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)",
  org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
  org.eclipse.core.variables;bundle-version="[3.2.200,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.15.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.16.0,4.0.0)",
  org.eclipse.search;bundle-version="[3.10.0,4.0.0)",
  org.eclipse.debug.core;bundle-version="[3.10.0,4.0.0)",
  org.eclipse.debug.ui;bundle-version="[3.11.0,4.0.0)",
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaBuildConfigurationBlock.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaBuildConfigurationBlock.java
index 0e40cbc..048d5cd 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaBuildConfigurationBlock.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/JavaBuildConfigurationBlock.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
  *
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
@@ -61,6 +61,7 @@
 	private static final Key PREF_PB_INCOMPLETE_BUILDPATH= getJDTCoreKey(JavaCore.CORE_INCOMPLETE_CLASSPATH);
 	private static final Key PREF_PB_CIRCULAR_BUILDPATH= getJDTCoreKey(JavaCore.CORE_CIRCULAR_CLASSPATH);
 	private static final Key PREF_PB_INCOMPATIBLE_JDK_LEVEL= getJDTCoreKey(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL);
+	private static final Key PREF_PB_MAIN_ONLY_PROJECT_HAS_TEST_ONLY_DEPENDENCY= getJDTCoreKey(JavaCore.CORE_MAIN_ONLY_PROJECT_HAS_TEST_ONLY_DEPENDENCY);
 	private static final Key PREF_PB_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE= getJDTCoreKey(JavaCore.CORE_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE);
 	private static final Key PREF_PB_DUPLICATE_RESOURCE= getJDTCoreKey(JavaCore.CORE_JAVA_BUILD_DUPLICATE_RESOURCE);
 	private static final Key PREF_RECREATE_MODIFIED_CLASS_FILES= getJDTCoreKey(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER);
@@ -96,7 +97,8 @@
 				PREF_PB_MAX_PER_UNIT, PREF_RESOURCE_FILTER, PREF_BUILD_INVALID_CLASSPATH, PREF_PB_INCOMPLETE_BUILDPATH, PREF_PB_CIRCULAR_BUILDPATH,
 				PREF_BUILD_CLEAN_OUTPUT_FOLDER, PREF_PB_DUPLICATE_RESOURCE,
 				PREF_PB_INCOMPATIBLE_JDK_LEVEL, PREF_PB_OUTPUT_LOCATION_OVERLAPPING_ANOTHER_SOURCE, PREF_ENABLE_EXCLUSION_PATTERNS, PREF_ENABLE_MULTIPLE_OUTPUT_LOCATIONS, 
-				PREF_RECREATE_MODIFIED_CLASS_FILES,	PREF_PB_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE, PREF_PB_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE
+				PREF_RECREATE_MODIFIED_CLASS_FILES,	PREF_PB_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE, PREF_PB_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE, 
+				PREF_PB_MAIN_ONLY_PROJECT_HAS_TEST_ONLY_DEPENDENCY
 			};
 		return keys;
 	}
@@ -141,6 +143,13 @@
 			PreferencesMessages.JavaBuildConfigurationBlock_warning
 		};
 
+		String[] errorIgnore= new String[] { ERROR, IGNORE };
+
+		String[] errorIgnoreLabels= new String[] {
+			PreferencesMessages.JavaBuildConfigurationBlock_error,
+			PreferencesMessages.JavaBuildConfigurationBlock_ignore
+		};
+
 		String[] errorWarningInfoIgnore= new String[] { ERROR, WARNING, INFO, IGNORE };
 		String[] errorWarningInfoIgnoreLabels= new String[] {
 			PreferencesMessages.JavaBuildConfigurationBlock_error,
@@ -209,6 +218,9 @@
 		label= PreferencesMessages.JavaBuildConfigurationBlock_pb_compiler_compliance_does_not_match_jre_label;
 		addComboBox(othersComposite, label, PREF_PB_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE, errorWarningInfoIgnore, errorWarningInfoIgnoreLabels, 0);
 
+		label= PreferencesMessages.JavaBuildConfigurationBlock_pb_main_only_project_has_test_only_dependency_label;
+		addComboBox(othersComposite, label, PREF_PB_MAIN_ONLY_PROJECT_HAS_TEST_ONLY_DEPENDENCY, errorIgnore, errorIgnoreLabels, 0);
+
 		label= PreferencesMessages.JavaBuildConfigurationBlock_section_output_folder;
 		excomposite= createStyleSection(composite, label, nColumns);
 
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java
index 5558793..d33fd5d 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.java
@@ -377,6 +377,7 @@
 	public static String JavaBuildConfigurationBlock_pb_output_overlapping_with_source_label;
 	public static String JavaBuildConfigurationBlock_pb_strictly_compatible_jre_not_available_label;
 	public static String JavaBuildConfigurationBlock_pb_compiler_compliance_does_not_match_jre_label;
+	public static String JavaBuildConfigurationBlock_pb_main_only_project_has_test_only_dependency_label;
 	public static String JavaBuildConfigurationBlock_empty_input;
 	public static String JavaBuildConfigurationBlock_invalid_input;
 	public static String JavaBuildConfigurationBlock_filter_invalidsegment_error;
diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties
index 077e7c9..f42bbb9 100644
--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties
+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/PreferencesMessages.properties
@@ -393,6 +393,7 @@
 JavaBuildConfigurationBlock_pb_output_overlapping_with_source_label=&Output location overlaps source location:
 JavaBuildConfigurationBlock_pb_strictly_compatible_jre_not_available_label= No &strictly compatible JRE for execution environment available:
 JavaBuildConfigurationBlock_pb_compiler_compliance_does_not_match_jre_label=Comp&iler Compliance does not match used JRE
+JavaBuildConfigurationBlock_pb_main_only_project_has_test_only_dependency_label=Project with only main source folders depends on project with only test sources folders
 
 JavaBuildConfigurationBlock_empty_input=Number of problems cannot be empty.
 JavaBuildConfigurationBlock_invalid_input={0} is not a valid number of problems.