Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 165606 Details for
Bug 291528
Synchronize project warning/error settings to build.properties
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
PDE UI fix
clipboard.txt (text/plain), 34.77 KB, created by
Curtis Windatt
on 2010-04-21 13:40:52 EDT
(
hide
)
Description:
PDE UI fix
Filename:
MIME Type:
Creator:
Curtis Windatt
Created:
2010-04-21 13:40:52 EDT
Size:
34.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.pde.core >Index: src/org/eclipse/pde/internal/core/PDECoreMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java,v >retrieving revision 1.78 >diff -u -r1.78 PDECoreMessages.java >--- src/org/eclipse/pde/internal/core/PDECoreMessages.java 19 Feb 2010 22:02:34 -0000 1.78 >+++ src/org/eclipse/pde/internal/core/PDECoreMessages.java 21 Apr 2010 17:39:22 -0000 >@@ -226,6 +226,12 @@ > public static String BuildErrorReporter_missingFolder; > public static String BuildErrorReporter_emptyEntry; > public static String BuildErrorReporter_binIncludesMissing; >+ public static String BuildErrorReporter_buildEntryInvalidWhenNoProjectSettings; >+ >+ public static String BuildErrorReporter_buildEntryMissingProjectSpecificSettings; >+ >+ public static String BuildErrorReporter_buildEntryMissingValidPath; >+ > public static String BuildErrorReporter_sourceMissing; > > public static String BuildErrorReporter_srcIncludesSourceFolder; >Index: src/org/eclipse/pde/internal/core/PreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PreferenceInitializer.java,v >retrieving revision 1.18 >diff -u -r1.18 PreferenceInitializer.java >--- src/org/eclipse/pde/internal/core/PreferenceInitializer.java 22 Jan 2010 12:01:07 -0000 1.18 >+++ src/org/eclipse/pde/internal/core/PreferenceInitializer.java 21 Apr 2010 17:39:22 -0000 >@@ -62,6 +62,7 @@ > prefs.putInt(CompilerFlags.P_UNKNOWN_RESOURCE, CompilerFlags.WARNING); > prefs.putInt(CompilerFlags.P_UNKNOWN_IDENTIFIER, CompilerFlags.WARNING); > prefs.putInt(CompilerFlags.P_NOT_EXTERNALIZED, CompilerFlags.IGNORE); >+ > prefs.putInt(CompilerFlags.P_BUILD, CompilerFlags.WARNING); > prefs.putInt(CompilerFlags.P_BUILD_MISSING_OUTPUT, CompilerFlags.IGNORE); > prefs.putInt(CompilerFlags.P_BUILD_SOURCE_LIBRARY, CompilerFlags.WARNING); >@@ -69,6 +70,7 @@ > prefs.putInt(CompilerFlags.P_BUILD_SRC_INCLUDES, CompilerFlags.WARNING); > prefs.putInt(CompilerFlags.P_BUILD_BIN_INCLUDES, CompilerFlags.WARNING); > prefs.putInt(CompilerFlags.P_BUILD_JAVA_COMPLIANCE, CompilerFlags.WARNING); >+ prefs.putInt(CompilerFlags.P_BUILD_JAVA_COMPILER, CompilerFlags.WARNING); > > prefs.putInt(CompilerFlags.P_INCOMPATIBLE_ENV, CompilerFlags.WARNING); > prefs.putInt(CompilerFlags.P_MISSING_EXPORT_PKGS, CompilerFlags.IGNORE); >Index: src/org/eclipse/pde/internal/core/pderesources.properties >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties,v >retrieving revision 1.124 >diff -u -r1.124 pderesources.properties >--- src/org/eclipse/pde/internal/core/pderesources.properties 19 Feb 2010 22:02:34 -0000 1.124 >+++ src/org/eclipse/pde/internal/core/pderesources.properties 21 Apr 2010 17:39:22 -0000 >@@ -89,6 +89,9 @@ > Builders_Manifest_deprecated_element = Element ''{0}'' is deprecated > Builders_Manifest_internal_rootElement = Access to extension point ''{0}'' is discouraged > BuildErrorReporter_binIncludesMissing=An entry for {0} is required in bin.includes >+BuildErrorReporter_buildEntryInvalidWhenNoProjectSettings=The ''{0}'' build entry should not be set when there are no project specific compiler settings >+BuildErrorReporter_buildEntryMissingProjectSpecificSettings=The ''{0}'' build entry should be set when there are project specific compiler settings >+BuildErrorReporter_buildEntryMissingValidPath=The ''{0}'' build entry does not contain a path to an existing properties file > BuildErrorReporter_entiresMustRefDirs={0}: entries ending in / must reference directories > Builders_Manifest_deprecated_rootElement = The extension point ''{0}'' is deprecated > BuildErrorReporter_classpathEntryMissing={0} is not included in any "source.*" build entry >@@ -117,8 +120,8 @@ > BuildErrorReporter_emptyEntry=Build entries must contain at least one value > BuildErrorReporter_GeneratedClassFilesCompatibility=Generated .class files compatibility > BuildErrorReporter_missingFile=The file "{0}" does not exist in the workspace >-BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken=The ''{0}'' build entry does not match the ''{1}'' project setting >-BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry=There is no ''{0}'' build entry and the project specific ''{1}'' setting has been set >+BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken=The ''{0}'' build entry does not match the current project Java compliance settings >+BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry=There is no ''{0}'' build entry and the project has Java compliance preferences set > BuildErrorReporter_SourceCompatibility=Source compatibility > > BundleErrorReporter_lineTooLong = The line is too long >Index: src/org/eclipse/pde/internal/core/builders/BuildErrorReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/BuildErrorReporter.java,v >retrieving revision 1.56 >diff -u -r1.56 BuildErrorReporter.java >--- src/org/eclipse/pde/internal/core/builders/BuildErrorReporter.java 7 Apr 2010 12:46:28 -0000 1.56 >+++ src/org/eclipse/pde/internal/core/builders/BuildErrorReporter.java 21 Apr 2010 17:39:22 -0000 >@@ -44,7 +44,7 @@ > > private static final String DEF_SOURCE_ENTRY = PROPERTY_SOURCE_PREFIX + '.'; > private static final String[] RESERVED_NAMES = new String[] {"meta-inf", "osgi-inf", ICoreConstants.BUILD_FILENAME_DESCRIPTOR, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR, "plugin.properties"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >- private static final String JAVAC_WARNINGS_ENTRY = PROPERTY_JAVAC_WARNINGS_PREFIX + '.'; >+ > private static final String ASSERT_IDENTIFIER = "assertIdentifier"; //$NON-NLS-1$ > private static final String ENUM_IDENTIFIER = "enumIdentifier"; //$NON-NLS-1$ > >@@ -106,7 +106,8 @@ > protected ArrayList fProblemList = new ArrayList(); > protected int fBuildSeverity; > protected int fClasspathSeverity; >- protected int fJavaComplSeverity; >+ protected int fJavaComplianceSeverity; >+ protected int fJavaCompilerSeverity; > protected int fSrcInclSeverity; > protected int fBinInclSeverity; > protected int fMissingOutputLibSeverity; >@@ -120,7 +121,8 @@ > fMissingOutputLibSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_MISSING_OUTPUT); > fSrcLibSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_SOURCE_LIBRARY); > fOututLibSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_OUTPUT_LIBRARY); >- fJavaComplSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_JAVA_COMPLIANCE); >+ fJavaComplianceSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_JAVA_COMPLIANCE); >+ fJavaCompilerSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_JAVA_COMPILER); > fSrcInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_SRC_INCLUDES); > fBinInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_BIN_INCLUDES); > } >@@ -151,7 +153,9 @@ > IBuildEntry javacSource = null; > IBuildEntry javacTarget = null; > IBuildEntry jreCompilationProfile = null; >- IBuildEntry javacWarnings = null; >+ IBuildEntry javaProjectWarnings = null; >+ ArrayList javacWarnings = new ArrayList(); >+ ArrayList javacErrors = new ArrayList(); > ArrayList sourceEntries = new ArrayList(1); > ArrayList sourceEntryKeys = new ArrayList(1); > ArrayList outputEntries = new ArrayList(1); >@@ -173,10 +177,14 @@ > javacSource = entries[i]; > else if (name.equals(PROPERTY_JAVAC_TARGET)) > javacTarget = entries[i]; >- else if (name.equals(JAVAC_WARNINGS_ENTRY)) >- javacWarnings = entries[i]; >+ else if (name.equals(PROPERTY_USE_PROJECT_WARNINGS)) >+ javaProjectWarnings = entries[i]; > else if (name.equals(PROPERTY_JRE_COMPILATION_PROFILE)) > jreCompilationProfile = entries[i]; >+ else if (name.startsWith(PROPERTY_JAVAC_WARNINGS_PREFIX)) >+ javacWarnings.add(entries[i]); >+ else if (name.startsWith(PROPERTY_JAVAC_ERRORS_PREFIX)) >+ javacErrors.add(entries[i]); > else if (name.startsWith(PROPERTY_SOURCE_PREFIX)) > sourceEntries.add(entries[i]); > else if (name.startsWith(PROPERTY_OUTPUT_PREFIX)) >@@ -236,10 +244,9 @@ > > validateMissingSourceInBinIncludes(binIncludes, sourceEntryKeys, build); > validateBinIncludes(binIncludes); >- try { >- validateExecutionEnvironment(javacSource, javacTarget, javacWarnings, jreCompilationProfile); >- } catch (CoreException e) { >- } >+ validateExecutionEnvironment(javacSource, javacTarget, jreCompilationProfile); >+ validateJavaComplianceSettings(javacWarnings, javacErrors, getSourceLibraries(sourceEntries)); >+ validateJavaCompilerSettings(javaProjectWarnings); > //validateDefaultEncoding(sourceEntries, encodingEntries); > } > >@@ -262,6 +269,22 @@ > // } > > /** >+ * Given a list of source library entries, returns the list of library names. >+ * >+ * @param sourceEntries list of IBuildEntry source entries >+ * @return list of library names >+ */ >+ private List getSourceLibraries(List sourceEntries) { >+ List libraries = new ArrayList(); >+ for (Iterator iterator = sourceEntries.iterator(); iterator.hasNext();) { >+ IBuildEntry sourceEntry = (IBuildEntry) iterator.next(); >+ String libName = sourceEntry.getName().substring(PROPERTY_SOURCE_PREFIX.length()); >+ libraries.add(libName); >+ } >+ return libraries; >+ } >+ >+ /** > * Matches the javacSource, javacTarget, javacWarnings and jre.compilation.prile entries in build.properties with the > * project specific Java Compiler properties and reports the errors founds. > * >@@ -270,10 +293,16 @@ > * @param javacWarningsEntry > * @param jreCompilationProfileEntry > */ >- private void validateExecutionEnvironment(IBuildEntry javacSourceEntry, IBuildEntry javacTargetEntry, IBuildEntry javacWarningsEntry, IBuildEntry jreCompilationProfileEntry) throws CoreException { >+ private void validateExecutionEnvironment(IBuildEntry javacSourceEntry, IBuildEntry javacTargetEntry, IBuildEntry jreCompilationProfileEntry) { > // if there is no source to compile, don't worry about compiler settings > IJavaProject project = JavaCore.create(fProject); >- IClasspathEntry[] classpath = project.getRawClasspath(); >+ IClasspathEntry[] classpath = null; >+ try { >+ classpath = project.getRawClasspath(); >+ } catch (JavaModelException e) { >+ PDECore.log(e); >+ return; >+ } > boolean source = false; > for (int i = 0; i < classpath.length; i++) { > IClasspathEntry cpe = classpath[i]; >@@ -318,30 +347,30 @@ > if (projectJavaCompatibility != null) { > if (jreCompilationProfileEntry == null) { > message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JRE_COMPILATION_PROFILE, PDECoreMessages.BuildErrorReporter_CompilercomplianceLevel); >- prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >+ prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); > } else { > if (!projectJavaCompatibility.equalsIgnoreCase(jreCompilationProfileEntry.getTokens()[0])) { > message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JRE_COMPILATION_PROFILE, PDECoreMessages.BuildErrorReporter_CompilercomplianceLevel); >- prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >+ prepareError(PROPERTY_JRE_COMPILATION_PROFILE, projectJavaCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); > } > } > } else { > if (javacSourceEntry == null) { > message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_SOURCE, PDECoreMessages.BuildErrorReporter_SourceCompatibility); >- prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >+ prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); > } else { > if (!projectSourceCompatibility.equalsIgnoreCase(javacSourceEntry.getTokens()[0])) { > message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_SOURCE, PDECoreMessages.BuildErrorReporter_SourceCompatibility); >- prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >+ prepareError(PROPERTY_JAVAC_SOURCE, projectSourceCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); > } > } > if (javacTargetEntry == null) { > message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_TARGET, PDECoreMessages.BuildErrorReporter_GeneratedClassFilesCompatibility); >- prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >+ prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); > } else { > if (!projectClassCompatibility.equalsIgnoreCase(javacTargetEntry.getTokens()[0])) { > message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_TARGET, PDECoreMessages.BuildErrorReporter_GeneratedClassFilesCompatibility); >- prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >+ prepareError(PROPERTY_JAVAC_TARGET, projectClassCompatibility, message, PDEMarkerFactory.B_REPLACE, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); > } > } > } >@@ -351,52 +380,9 @@ > return; > } > >- //look for assertIdentifier and enumIdentifier entries in javacWarnings. If any is present let it be, if not warn. >- String assertIdentifier = node.get(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, ""); //$NON-NLS-1$ >- String enumIdentifier = node.get(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, ""); //$NON-NLS-1$ >- String assertToken = ""; //$NON-NLS-1$ >- String enumToken = ""; //$NON-NLS-1$ >- >- if (JavaCore.IGNORE.equalsIgnoreCase(assertIdentifier)) { >- assertToken = '-' + ASSERT_IDENTIFIER; >- } >- if (JavaCore.IGNORE.equalsIgnoreCase(enumIdentifier)) { >- enumToken = '-' + ENUM_IDENTIFIER; >- } >- String warningToken = join(assertToken, enumToken); >- if (javacWarningsEntry == null) { >- if (warningToken.length() > 0) { >- message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_WARNINGS_PREFIX, PDECoreMessages.BuildErrorReporter_DisallowIdentifiers); >- prepareError(JAVAC_WARNINGS_ENTRY, warningToken, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >- } >- } else { >- if (javacWarningsEntry.contains(ASSERT_IDENTIFIER) || javacWarningsEntry.contains('+' + ASSERT_IDENTIFIER) || javacWarningsEntry.contains('-' + ASSERT_IDENTIFIER)) { >- //assertIdentifier entry already present >- assertToken = ""; //$NON-NLS-1$ >- } >- if (javacWarningsEntry.contains(ENUM_IDENTIFIER) || javacWarningsEntry.contains('+' + ENUM_IDENTIFIER) || javacWarningsEntry.contains('-' + ENUM_IDENTIFIER)) { >- //enumIdentifier entry already present >- enumToken = ""; //$NON-NLS-1$ >- } >- warningToken = join(assertToken, enumToken); >- if (warningToken.length() > 0) { >- message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_WARNINGS_PREFIX, PDECoreMessages.BuildErrorReporter_DisallowIdentifiers); >- prepareError(JAVAC_WARNINGS_ENTRY, warningToken, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplSeverity, PDEMarkerFactory.CAT_EE); >- } >- } > } > } > >- private String join(String token1, String token2) { >- StringBuffer result = new StringBuffer(token1); >- if (token2.length() > 0) { >- if (result.length() > 0) >- result.append(','); >- result.append(token2); >- } >- return result.toString(); >- } >- > private String findMatchingEE(String srcCompatibility, String clsCompatibility, boolean ee) { > String executionEnv = null; > String complaince = null; >@@ -786,6 +772,174 @@ > > } > >+ /** >+ * Matches the javacWarnings and javacErrors entries in build.properties with the >+ * project specific Java compliance properties and reports the errors found. Since java >+ * compiler settings are set on a per project basis, any special javacWarnings/javacErrors >+ * must be set for each library. >+ * >+ * @param javacWarningsEntries list of build entries with the java compiler warnings prefix javacWarnings. >+ * @param javacErrorsEntries list of build entries with the java compiler errors prefix javacErrors. >+ * @param libraryNames list of String library names >+ */ >+ private void validateJavaComplianceSettings(ArrayList javacWarningsEntries, ArrayList javacErrorsEntries, List libraryNames) { >+ // Check if there are project specific compliance settings >+ ProjectScope projectContext = new ProjectScope(fProject); >+ IEclipsePreferences node = projectContext.getNode(JavaCore.PLUGIN_ID); >+ String projectComplianceLevel = node.get(JavaCore.COMPILER_COMPLIANCE, ""); //$NON-NLS-1$ >+ >+ if (projectComplianceLevel.length() > 0) { //project has specific properties enabled >+ >+ List complianceWarnSettings = new ArrayList(3); >+ List complianceErrorSettings = new ArrayList(3); >+ >+ //look for assertIdentifier and enumIdentifier entries in javacWarnings. If any is present let it be, if not warn. >+ String assertIdentifier = node.get(JavaCore.COMPILER_PB_ASSERT_IDENTIFIER, ""); //$NON-NLS-1$ >+ if (JavaCore.ERROR.equalsIgnoreCase(assertIdentifier)) { >+ complianceErrorSettings.add(ASSERT_IDENTIFIER); >+ } else if (JavaCore.WARNING.equalsIgnoreCase(assertIdentifier)) { >+ complianceWarnSettings.add(ASSERT_IDENTIFIER); >+ } >+ >+ String enumIdentifier = node.get(JavaCore.COMPILER_PB_ENUM_IDENTIFIER, ""); //$NON-NLS-1$ >+ if (JavaCore.ERROR.equalsIgnoreCase(enumIdentifier)) { >+ complianceErrorSettings.add(ENUM_IDENTIFIER); >+ } else if (JavaCore.WARNING.equalsIgnoreCase(enumIdentifier)) { >+ complianceWarnSettings.add(ENUM_IDENTIFIER); >+ } >+ >+ // If a warnings entry is required, make sure there is one for each library with the correct content >+ if (complianceWarnSettings.size() > 0) { >+ for (Iterator iterator = libraryNames.iterator(); iterator.hasNext();) { >+ String libName = (String) iterator.next(); >+ IBuildEntry matchingEntry = null; >+ for (Iterator iterator2 = javacWarningsEntries.iterator(); iterator2.hasNext();) { >+ IBuildEntry candidate = (IBuildEntry) iterator2.next(); >+ if (candidate.getName().equals(PROPERTY_JAVAC_WARNINGS_PREFIX + libName)) { >+ matchingEntry = candidate; >+ break; >+ } >+ } >+ if (matchingEntry == null) { >+ String missingTokens = ""; //$NON-NLS-1$ >+ for (Iterator iterator2 = complianceWarnSettings.iterator(); iterator2.hasNext();) { >+ String currentIdentifier = (String) iterator2.next(); >+ missingTokens = join(missingTokens, '-' + currentIdentifier); >+ } >+ String message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_WARNINGS_PREFIX + libName); >+ prepareError(PROPERTY_JAVAC_WARNINGS_PREFIX + libName, missingTokens, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); >+ } else { >+ String missingTokens = ""; //$NON-NLS-1$ >+ for (Iterator iterator2 = complianceWarnSettings.iterator(); iterator2.hasNext();) { >+ String currentIdentifier = (String) iterator2.next(); >+ if (!matchingEntry.contains(currentIdentifier) && !matchingEntry.contains('+' + currentIdentifier) && !matchingEntry.contains('-' + currentIdentifier)) { >+ join(missingTokens, '-' + currentIdentifier); >+ } >+ } >+ if (missingTokens.length() > 0) { >+ String message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_WARNINGS_PREFIX + libName); >+ prepareError(PROPERTY_JAVAC_WARNINGS_PREFIX + libName, missingTokens, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); >+ } >+ } >+ } >+ } >+ >+ // If a warnings entry is required, make sure there is one for each library with the correct content >+ if (complianceErrorSettings.size() > 0) { >+ for (Iterator iterator = libraryNames.iterator(); iterator.hasNext();) { >+ String libName = (String) iterator.next(); >+ IBuildEntry matchingEntry = null; >+ for (Iterator iterator2 = javacErrorsEntries.iterator(); iterator2.hasNext();) { >+ IBuildEntry candidate = (IBuildEntry) iterator2.next(); >+ if (candidate.getName().equals(PROPERTY_JAVAC_ERRORS_PREFIX + libName)) { >+ matchingEntry = candidate; >+ break; >+ } >+ } >+ if (matchingEntry == null) { >+ String message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceMissingEntry, PROPERTY_JAVAC_ERRORS_PREFIX + libName); >+ prepareError(PROPERTY_JAVAC_ERRORS_PREFIX + libName, null, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); >+ } else { >+ String missingTokens = ""; //$NON-NLS-1$ >+ for (Iterator iterator2 = complianceErrorSettings.iterator(); iterator2.hasNext();) { >+ String currentIdentifier = (String) iterator2.next(); >+ if (!matchingEntry.contains(currentIdentifier) && !matchingEntry.contains('+' + currentIdentifier) && !matchingEntry.contains('-' + currentIdentifier)) { >+ missingTokens = join(missingTokens, '-' + currentIdentifier); >+ } >+ } >+ if (missingTokens.length() > 0) { >+ String message = NLS.bind(PDECoreMessages.BuildErrorReporter_ProjectSpecificJavaComplianceDifferentToken, PROPERTY_JAVAC_ERRORS_PREFIX + libName); >+ prepareError(PROPERTY_JAVAC_ERRORS_PREFIX + libName, missingTokens, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaComplianceSeverity, PDEMarkerFactory.CAT_EE); >+ } >+ } >+ } >+ } >+ } >+ } >+ >+ /** >+ * >+ * >+ * @param useJavaProjectSettings a build entry for using the project's compiler warning preferences file >+ */ >+ private void validateJavaCompilerSettings(IBuildEntry useJavaProjectSettings) { >+ // Check if the project has compiler warnings set >+ IJavaProject project = JavaCore.create(fProject); >+ Map options = project.getOptions(false); >+ // If project specific options are turned on, all options will be stored. Only need to check if at least one compiler option is set. Currently using the second option on the property page. >+ if (options.containsKey(JavaCore.COMPILER_PB_INDIRECT_STATIC_ACCESS)) { >+ if (useJavaProjectSettings != null) { >+ boolean entryCorrect = false; >+ String[] tokens = useJavaProjectSettings.getTokens(); >+ if (tokens != null && tokens.length == 1) { >+ IPath prefFile = new Path(tokens[0]); >+ if (prefFile.isAbsolute()) { >+ entryCorrect = prefFile.toFile().exists(); >+ } else { >+ entryCorrect = fProject.getFile(prefFile).exists(); >+ } >+ } >+ if (!entryCorrect) { >+ // TODO Doesn't work with flexible bundle root >+ IFile prefFile = fProject.getFile(new Path(".settings").append(JavaCore.PLUGIN_ID + ".prefs")); //$NON-NLS-1$ //$NON-NLS-2$ >+ String token = prefFile.exists() ? prefFile.getProjectRelativePath().toString() : null; >+ String message = NLS.bind(PDECoreMessages.BuildErrorReporter_buildEntryMissingValidPath, PROPERTY_USE_PROJECT_WARNINGS); >+ prepareError(PROPERTY_USE_PROJECT_WARNINGS, token, message, PDEMarkerFactory.B_REPLACE, fJavaCompilerSeverity, PDEMarkerFactory.CAT_EE); >+ } >+ } else { >+ // TODO Doesn't work with flexible bundle root >+ IFile prefFile = fProject.getFile(new Path(".settings").append(JavaCore.PLUGIN_ID + ".prefs")); //$NON-NLS-1$ //$NON-NLS-2$ >+ String token = prefFile.exists() ? prefFile.getProjectRelativePath().toString() : null; >+ String message = NLS.bind(PDECoreMessages.BuildErrorReporter_buildEntryMissingProjectSpecificSettings, PROPERTY_USE_PROJECT_WARNINGS); >+ prepareError(PROPERTY_USE_PROJECT_WARNINGS, token, message, PDEMarkerFactory.B_JAVA_ADDDITION, fJavaCompilerSeverity, PDEMarkerFactory.CAT_EE); >+ } >+ } else if (useJavaProjectSettings != null) { >+ String message = NLS.bind(PDECoreMessages.BuildErrorReporter_buildEntryInvalidWhenNoProjectSettings, PROPERTY_USE_PROJECT_WARNINGS); >+ prepareError(PROPERTY_USE_PROJECT_WARNINGS, null, message, PDEMarkerFactory.B_REMOVAL, fJavaCompilerSeverity, PDEMarkerFactory.CAT_EE); >+ } >+ } >+ >+ /** >+ * Joins the given tokens into a single string with a comma separator. If either of >+ * the tokens are null or of length 0, the other string will be returned >+ * >+ * @param token1 first string >+ * @param token2 second string >+ * @return concatenated string >+ */ >+ private String join(String token1, String token2) { >+ StringBuffer result = new StringBuffer(); >+ if (token1 != null && token1.length() > 0) { >+ result.append(token1); >+ } >+ if (token2 != null && token2.length() > 0) { >+ if (result.length() > 0) >+ result.append(','); >+ result.append(token2); >+ } >+ return result.toString(); >+ } >+ > private BuildModel prepareTextBuildModel(IProgressMonitor monitor) { > try { > IDocument doc = createDocument(fFile); >Index: src/org/eclipse/pde/internal/core/builders/CompilerFlags.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/CompilerFlags.java,v >retrieving revision 1.17 >diff -u -r1.17 CompilerFlags.java >--- src/org/eclipse/pde/internal/core/builders/CompilerFlags.java 22 Jan 2010 12:01:07 -0000 1.17 >+++ src/org/eclipse/pde/internal/core/builders/CompilerFlags.java 21 Apr 2010 17:39:22 -0000 >@@ -60,6 +60,7 @@ > public static final String P_BUILD_SRC_INCLUDES = "compilers.p.build.src.includes"; //$NON-NLS-1$ > public static final String P_BUILD_BIN_INCLUDES = "compilers.p.build.bin.includes"; //$NON-NLS-1$ > public static final String P_BUILD_JAVA_COMPLIANCE = "compilers.p.build.java.compliance"; //$NON-NLS-1$ >+ public static final String P_BUILD_JAVA_COMPILER = "compilers.p.build.java.compiler"; //$NON-NLS-1$ > public static final String P_INCOMPATIBLE_ENV = "compilers.incompatible-environment"; //$NON-NLS-1$ > public static final String P_MISSING_EXPORT_PKGS = "compilers.p.missing-packages"; //$NON-NLS-1$ > public static final String P_DEPRECATED = "compilers.p.deprecated"; //$NON-NLS-1$ >#P org.eclipse.pde.ui >Index: src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java,v >retrieving revision 1.14 >diff -u -r1.14 PDECompilersConfigurationBlock.java >--- src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java 15 Mar 2010 16:01:24 -0000 1.14 >+++ src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java 21 Apr 2010 17:39:24 -0000 >@@ -199,19 +199,22 @@ > //general > private static final Key KEY_P_DISCOURAGED_CLASS = getPDEPrefKey(CompilerFlags.P_DISCOURAGED_CLASS); > private static final Key KEY_P_NO_REQUIRED_ATT = getPDEPrefKey(CompilerFlags.P_NO_REQUIRED_ATT); >- private static final Key KEY_P_BUILD = getPDEPrefKey(CompilerFlags.P_BUILD); >- private static final Key KEY_P_BUILD_MISSING_OUTPUT = getPDEPrefKey(CompilerFlags.P_BUILD_MISSING_OUTPUT); >- private static final Key KEY_P_BUILD_SOURCE_LIBRARY = getPDEPrefKey(CompilerFlags.P_BUILD_SOURCE_LIBRARY); >- private static final Key KEY_P_BUILD_OUTPUT_LIBRARY = getPDEPrefKey(CompilerFlags.P_BUILD_OUTPUT_LIBRARY); >- private static final Key KEY_P_BUILD_SRC_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_SRC_INCLUDES); >- private static final Key KEY_P_BUILD_BIN_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_BIN_INCLUDES); >- private static final Key KEY_P_BUILD_JAVA_COMPLIANCE = getPDEPrefKey(CompilerFlags.P_BUILD_JAVA_COMPLIANCE); > private static final Key KEY_P_NOT_EXTERNALIZED = getPDEPrefKey(CompilerFlags.P_NOT_EXTERNALIZED); > private static final Key KEY_P_INCOMPATIBLE_ENV = getPDEPrefKey(CompilerFlags.P_INCOMPATIBLE_ENV); > private static final Key KEY_P_MISSING_EXPORT_PKGS = getPDEPrefKey(CompilerFlags.P_MISSING_EXPORT_PKGS); > private static final Key KEY_P_DEPRECATED = getPDEPrefKey(CompilerFlags.P_DEPRECATED); > private static final Key KEY_P_INTERNAL = getPDEPrefKey(CompilerFlags.P_INTERNAL); > >+ // build >+ private static final Key KEY_P_BUILD_SOURCE_LIBRARY = getPDEPrefKey(CompilerFlags.P_BUILD_SOURCE_LIBRARY); >+ private static final Key KEY_P_BUILD_OUTPUT_LIBRARY = getPDEPrefKey(CompilerFlags.P_BUILD_OUTPUT_LIBRARY); >+ private static final Key KEY_P_BUILD_MISSING_OUTPUT = getPDEPrefKey(CompilerFlags.P_BUILD_MISSING_OUTPUT); >+ private static final Key KEY_P_BUILD_SRC_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_SRC_INCLUDES); >+ private static final Key KEY_P_BUILD_BIN_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_BIN_INCLUDES); >+ private static final Key KEY_P_BUILD_JAVA_COMPLIANCE = getPDEPrefKey(CompilerFlags.P_BUILD_JAVA_COMPLIANCE); >+ private static final Key KEY_P_BUILD_JAVA_COMPILER = getPDEPrefKey(CompilerFlags.P_BUILD_JAVA_COMPILER); >+ private static final Key KEY_P_BUILD = getPDEPrefKey(CompilerFlags.P_BUILD); >+ > // versioning > private static final Key KEY_P_VERSION_EXP_PKG = getPDEPrefKey(CompilerFlags.P_MISSING_VERSION_EXP_PKG); > private static final Key KEY_P_VERSION_IMP_PKG = getPDEPrefKey(CompilerFlags.P_MISSING_VERSION_IMP_PKG); >@@ -223,7 +226,7 @@ > > private static String[] SEVERITIES = {PDEUIMessages.PDECompilersConfigurationBlock_error, PDEUIMessages.PDECompilersConfigurationBlock_warning, PDEUIMessages.PDECompilersConfigurationBlock_ignore}; > >- private static Key[] fgAllKeys = {KEY_F_UNRESOLVED_FEATURES, KEY_F_UNRESOLVED_PLUGINS, KEY_P_BUILD, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_INTERNAL, KEY_P_DEPRECATED, KEY_P_DISCOURAGED_CLASS, KEY_P_INCOMPATIBLE_ENV, KEY_P_MISSING_EXPORT_PKGS, KEY_P_NO_REQUIRED_ATT, KEY_P_NOT_EXTERNALIZED, KEY_P_UNKNOWN_ATTRIBUTE, KEY_P_UNKNOWN_CLASS, KEY_P_UNKNOWN_ELEMENT, KEY_P_UNKNOWN_IDENTIFIER, KEY_P_UNKNOWN_RESOURCE, KEY_P_UNRESOLVED_EX_POINTS, KEY_P_UNRESOLVED_IMPORTS, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG, KEY_P_VERSION_REQ_BUNDLE, KEY_S_CREATE_DOCS, KEY_S_DOC_FOLDER, KEY_S_OPEN_TAGS}; >+ private static Key[] fgAllKeys = {KEY_F_UNRESOLVED_FEATURES, KEY_F_UNRESOLVED_PLUGINS, KEY_P_BUILD, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD_JAVA_COMPILER, KEY_P_INTERNAL, KEY_P_DEPRECATED, KEY_P_DISCOURAGED_CLASS, KEY_P_INCOMPATIBLE_ENV, KEY_P_MISSING_EXPORT_PKGS, KEY_P_NO_REQUIRED_ATT, KEY_P_NOT_EXTERNALIZED, KEY_P_UNKNOWN_ATTRIBUTE, KEY_P_UNKNOWN_CLASS, KEY_P_UNKNOWN_ELEMENT, KEY_P_UNKNOWN_IDENTIFIER, KEY_P_UNKNOWN_RESOURCE, KEY_P_UNRESOLVED_EX_POINTS, KEY_P_UNRESOLVED_IMPORTS, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG, KEY_P_VERSION_REQ_BUNDLE, KEY_S_CREATE_DOCS, KEY_S_DOC_FOLDER, KEY_S_OPEN_TAGS}; > > /** > * Constant representing the {@link IDialogSettings} section for this block >@@ -516,7 +519,7 @@ > initializeComboControls(client, new String[] {PDEUIMessages.compilers_p_no_required_att, PDEUIMessages.CompilersConfigurationTab_incompatEnv, PDEUIMessages.compilers_p_exported_pkgs}, new Key[] {KEY_P_NO_REQUIRED_ATT, KEY_P_INCOMPATIBLE_ENV, KEY_P_MISSING_EXPORT_PKGS}, CompilerFlags.PLUGIN_FLAGS); > //build.properties > client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_build); >- initializeComboControls(client, new String[] {PDEUIMessages.PDECompilersConfigurationBlock_1, PDEUIMessages.PDECompilersConfigurationBlock_2, PDEUIMessages.PDECompilersConfigurationBlock_0, PDEUIMessages.PDECompilersConfigurationBlock_3, PDEUIMessages.PDECompilersConfigurationBlock_4, PDEUIMessages.PDECompilersConfigurationBlock_5, PDEUIMessages.CompilersConfigurationTab_buildPropertiesErrors}, new Key[] {KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD}, CompilerFlags.PLUGIN_FLAGS); >+ initializeComboControls(client, new String[] {PDEUIMessages.PDECompilersConfigurationBlock_1, PDEUIMessages.PDECompilersConfigurationBlock_2, PDEUIMessages.PDECompilersConfigurationBlock_0, PDEUIMessages.PDECompilersConfigurationBlock_3, PDEUIMessages.PDECompilersConfigurationBlock_4, PDEUIMessages.PDECompilersConfigurationBlock_5, "Missing project specific Java compiler settings", PDEUIMessages.CompilersConfigurationTab_buildPropertiesErrors}, new Key[] {KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD_JAVA_COMPILER, KEY_P_BUILD}, CompilerFlags.PLUGIN_FLAGS); > // Versioning > client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_versioning); > initializeComboControls(client, new String[] {PDEUIMessages.compilers_p_missing_require_bundle, PDEUIMessages.compilers_p_missing_exp_pkg, PDEUIMessages.compilers_p_missing_imp_pkg}, new Key[] {KEY_P_VERSION_REQ_BUNDLE, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG}, CompilerFlags.PLUGIN_FLAGS); >#P org.eclipse.pde.ui.tests >Index: src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/pde/ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java,v >retrieving revision 1.2 >diff -u -r1.2 AbstractBuildValidationTest.java >--- src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java 30 Mar 2010 18:54:20 -0000 1.2 >+++ src/org/eclipse/pde/ui/tests/build/properties/AbstractBuildValidationTest.java 21 Apr 2010 17:39:25 -0000 >@@ -293,6 +293,7 @@ > projectPrefs.putInt(CompilerFlags.P_BUILD_SRC_INCLUDES, severity); > projectPrefs.putInt(CompilerFlags.P_BUILD_BIN_INCLUDES, severity); > projectPrefs.putInt(CompilerFlags.P_BUILD_JAVA_COMPLIANCE, severity); >+ projectPrefs.putInt(CompilerFlags.P_BUILD_JAVA_COMPILER, severity); > projectPrefs.flush(); > projectPrefs.sync(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 291528
:
165473
|
165495
|
165570
| 165606 |
165630