View | Details | Raw Unified | Return to bug 155015 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/core/PreferenceInitializer.java (+1 lines)
Lines 68-73 Link Here
68
		prefs.putInt(CompilerFlags.P_BUILD_OUTPUT_LIBRARY, CompilerFlags.WARNING);
68
		prefs.putInt(CompilerFlags.P_BUILD_OUTPUT_LIBRARY, CompilerFlags.WARNING);
69
		prefs.putInt(CompilerFlags.P_BUILD_SRC_INCLUDES, CompilerFlags.WARNING);
69
		prefs.putInt(CompilerFlags.P_BUILD_SRC_INCLUDES, CompilerFlags.WARNING);
70
		prefs.putInt(CompilerFlags.P_BUILD_BIN_INCLUDES, CompilerFlags.WARNING);
70
		prefs.putInt(CompilerFlags.P_BUILD_BIN_INCLUDES, CompilerFlags.WARNING);
71
		prefs.putInt(CompilerFlags.P_BUILD_ENCODINGS, CompilerFlags.WARNING);
71
		prefs.putInt(CompilerFlags.P_BUILD_JAVA_COMPLIANCE, CompilerFlags.WARNING);
72
		prefs.putInt(CompilerFlags.P_BUILD_JAVA_COMPLIANCE, CompilerFlags.WARNING);
72
73
73
		prefs.putInt(CompilerFlags.P_INCOMPATIBLE_ENV, CompilerFlags.WARNING);
74
		prefs.putInt(CompilerFlags.P_INCOMPATIBLE_ENV, CompilerFlags.WARNING);
(-)src/org/eclipse/pde/internal/core/builders/BuildErrorReporter.java (-20 / +3 lines)
Lines 112-117 Link Here
112
	protected int fMissingOutputLibSeverity;
112
	protected int fMissingOutputLibSeverity;
113
	protected int fSrcLibSeverity;
113
	protected int fSrcLibSeverity;
114
	protected int fOututLibSeverity;
114
	protected int fOututLibSeverity;
115
	protected int fEncodingSeverity;
115
116
116
	public BuildErrorReporter(IFile buildFile) {
117
	public BuildErrorReporter(IFile buildFile) {
117
		super(buildFile);
118
		super(buildFile);
Lines 123-128 Link Here
123
		fJavaComplSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_JAVA_COMPLIANCE);
124
		fJavaComplSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_JAVA_COMPLIANCE);
124
		fSrcInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_SRC_INCLUDES);
125
		fSrcInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_SRC_INCLUDES);
125
		fBinInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_BIN_INCLUDES);
126
		fBinInclSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_BIN_INCLUDES);
127
		fEncodingSeverity = CompilerFlags.getFlag(fFile.getProject(), CompilerFlags.P_BUILD_ENCODINGS);
126
	}
128
	}
127
129
128
	public void validate(IProgressMonitor monitor) {
130
	public void validate(IProgressMonitor monitor) {
Lines 219-225 Link Here
219
				IClasspathEntry[] cpes = jp.getRawClasspath();
221
				IClasspathEntry[] cpes = jp.getRawClasspath();
220
				validateMissingLibraries(sourceEntryKeys, cpes);
222
				validateMissingLibraries(sourceEntryKeys, cpes);
221
				validateSourceEntries(sourceEntries, cpes);
223
				validateSourceEntries(sourceEntries, cpes);
222
				SourceEntryErrorReporter srcEntryErrReporter = new SourceEntryErrorReporter(fFile);
224
				SourceEntryErrorReporter srcEntryErrReporter = new SourceEntryErrorReporter(fFile, build);
223
				srcEntryErrReporter.initialize(sourceEntries, outputEntries, cpes, fProject);
225
				srcEntryErrReporter.initialize(sourceEntries, outputEntries, cpes, fProject);
224
				srcEntryErrReporter.validate();
226
				srcEntryErrReporter.validate();
225
				ArrayList problems = srcEntryErrReporter.getProblemList();
227
				ArrayList problems = srcEntryErrReporter.getProblemList();
Lines 240-266 Link Here
240
			validateExecutionEnvironment(javacSource, javacTarget, javacWarnings, jreCompilationProfile);
242
			validateExecutionEnvironment(javacSource, javacTarget, javacWarnings, jreCompilationProfile);
241
		} catch (CoreException e) {
243
		} catch (CoreException e) {
242
		}
244
		}
243
		//validateDefaultEncoding(sourceEntries, encodingEntries);
244
	}
245
	}
245
246
246
//	private void validateDefaultEncoding(ArrayList sourceEntries, Map encodingEntries) {
247
//		String defaultEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
248
//		for (int i = 0; i < sourceEntries.size(); i++) {
249
//			try {
250
//				String name = ((IBuildEntry) sourceEntries.get(i)).getName();
251
//				String library = name.substring(name.indexOf('.') + 1, name.length());
252
//				String encoding = fProject.getDefaultCharset(false);
253
//				String encodingId = PROPERTY_JAVAC_DEFAULT_ENCODING_PREFIX + library;
254
//				String libraryEncoding = (String) encodingEntries.get(encodingId);
255
//				if (encoding != null && !defaultEncoding.equalsIgnoreCase(encoding) && libraryEncoding == null) {
256
//					prepareError(encodingId, encoding, NLS.bind(PDECoreMessages.BuildErrorReporter_defaultEncodingMissing, new Object[] {defaultEncoding, encoding}), PDEMarkerFactory.B_ADDDITION, PDEMarkerFactory.CAT_OTHER);
257
//				}
258
//			} catch (CoreException e) {
259
//				PDECore.logException(e);
260
//			}
261
//		}
262
//	}
263
264
	/**
247
	/**
265
	 * Matches the javacSource, javacTarget, javacWarnings and jre.compilation.prile entries in build.properties with the 
248
	 * Matches the javacSource, javacTarget, javacWarnings and jre.compilation.prile entries in build.properties with the 
266
	 * project specific Java Compiler properties and reports the errors founds.
249
	 * project specific Java Compiler properties and reports the errors founds.
(-)src/org/eclipse/pde/internal/core/builders/CompilerFlags.java (+1 lines)
Lines 60-65 Link Here
60
	public static final String P_BUILD_SRC_INCLUDES = "compilers.p.build.src.includes"; //$NON-NLS-1$
60
	public static final String P_BUILD_SRC_INCLUDES = "compilers.p.build.src.includes"; //$NON-NLS-1$
61
	public static final String P_BUILD_BIN_INCLUDES = "compilers.p.build.bin.includes"; //$NON-NLS-1$
61
	public static final String P_BUILD_BIN_INCLUDES = "compilers.p.build.bin.includes"; //$NON-NLS-1$
62
	public static final String P_BUILD_JAVA_COMPLIANCE = "compilers.p.build.java.compliance"; //$NON-NLS-1$
62
	public static final String P_BUILD_JAVA_COMPLIANCE = "compilers.p.build.java.compliance"; //$NON-NLS-1$
63
	public static final String P_BUILD_ENCODINGS = "compilers.p.build.encodings"; //$NON-NLS-1$
63
	public static final String P_INCOMPATIBLE_ENV = "compilers.incompatible-environment"; //$NON-NLS-1$
64
	public static final String P_INCOMPATIBLE_ENV = "compilers.incompatible-environment"; //$NON-NLS-1$
64
	public static final String P_MISSING_EXPORT_PKGS = "compilers.p.missing-packages"; //$NON-NLS-1$
65
	public static final String P_MISSING_EXPORT_PKGS = "compilers.p.missing-packages"; //$NON-NLS-1$
65
	public static final String P_DEPRECATED = "compilers.p.deprecated"; //$NON-NLS-1$
66
	public static final String P_DEPRECATED = "compilers.p.deprecated"; //$NON-NLS-1$
(-)src/org/eclipse/pde/internal/core/builders/SourceEntryErrorReporter.java (-3 / +325 lines)
Lines 11-28 Link Here
11
package org.eclipse.pde.internal.core.builders;
11
package org.eclipse.pde.internal.core.builders;
12
12
13
import java.util.*;
13
import java.util.*;
14
import java.util.Map.Entry;
14
import org.eclipse.core.resources.*;
15
import org.eclipse.core.resources.*;
15
import org.eclipse.core.runtime.IPath;
16
import org.eclipse.core.runtime.*;
16
import org.eclipse.core.runtime.Path;
17
import org.eclipse.jdt.core.*;
17
import org.eclipse.jdt.core.*;
18
import org.eclipse.osgi.util.NLS;
18
import org.eclipse.osgi.util.NLS;
19
import org.eclipse.pde.core.build.IBuild;
19
import org.eclipse.pde.core.build.IBuildEntry;
20
import org.eclipse.pde.core.build.IBuildEntry;
20
import org.eclipse.pde.internal.core.PDECoreMessages;
21
import org.eclipse.pde.internal.core.PDECoreMessages;
22
import org.eclipse.pde.internal.core.project.PDEProject;
21
23
22
public class SourceEntryErrorReporter extends BuildErrorReporter {
24
public class SourceEntryErrorReporter extends BuildErrorReporter {
23
25
24
	public SourceEntryErrorReporter(IFile file) {
26
	public SourceEntryErrorReporter(IFile file, IBuild model) {
25
		super(file);
27
		super(file);
28
		fBuild = model;
26
	}
29
	}
27
30
28
	class ProjectFolder {
31
	class ProjectFolder {
Lines 131-138 Link Here
131
134
132
	}
135
	}
133
136
137
	/**
138
	 * Represents a default or custom encoding property for a resource
139
	 * within a library.
140
	 */
141
	class EncodingEntry {
142
143
		private String fEncoding;
144
		private IResource fResource;
145
146
		/**
147
		 * Constructs an encoding entry for the given resource.
148
		 * 
149
		 * @param resource resource
150
		 * @param encoding the encoding identifier
151
		 */
152
		EncodingEntry(IResource resource, String encoding) {
153
			fEncoding = encoding;
154
			fResource = resource;
155
		}
156
157
		/**
158
		 * Returns the explicit encoding for this entry.
159
		 * 
160
		 * @return explicit encoding
161
		 */
162
		public String getEncoding() {
163
			return fEncoding;
164
		}
165
166
		/**
167
		 * Returns the resource this encoding is associated with.
168
		 * 
169
		 * @return associated resource 
170
		 */
171
		public IResource getResource() {
172
			return fResource;
173
		}
174
175
		/* (non-Javadoc)
176
		 * @see java.lang.Object#toString()
177
		 */
178
		public String toString() {
179
			return getValue();
180
		}
181
182
		/* (non-Javadoc)
183
		 * @see java.lang.Object#equals(java.lang.Object)
184
		 */
185
		public boolean equals(Object obj) {
186
			if (obj instanceof EncodingEntry) {
187
				EncodingEntry other = (EncodingEntry) obj;
188
				return other.fEncoding.equals(fEncoding) && other.fResource.equals(fResource);
189
			}
190
			return false;
191
		}
192
193
		/* (non-Javadoc)
194
		 * @see java.lang.Object#hashCode()
195
		 */
196
		public int hashCode() {
197
			return fEncoding.hashCode() + fResource.hashCode();
198
		}
199
200
		/**
201
		 * Returns the generated value of this entry for the build.properties file.
202
		 * 
203
		 * @return value to enter into build.properties
204
		 */
205
		String getValue() {
206
			StringBuffer buf = new StringBuffer();
207
			IContainer root = PDEProject.getBundleRoot(fResource.getProject());
208
			buf.append(fResource.getFullPath().makeRelativeTo(root.getFullPath()).makeAbsolute());
209
			buf.append('[');
210
			buf.append(fEncoding);
211
			buf.append(']');
212
			return buf.toString();
213
		}
214
215
	}
216
217
	/**
218
	 * Visits a source folder gathering encodings.
219
	 */
220
	class Visitor implements IResourceVisitor {
221
222
		String[] fLibs = null;
223
224
		Visitor(SourceFolder folder) {
225
			ArrayList list = folder.getLibs();
226
			fLibs = (String[]) list.toArray(new String[list.size()]);
227
		}
228
229
		/* (non-Javadoc)
230
		 * @see org.eclipse.core.resources.IResourceVisitor#visit(org.eclipse.core.resources.IResource)
231
		 */
232
		public boolean visit(IResource resource) throws CoreException {
233
			String encoding = null;
234
			switch (resource.getType()) {
235
				case IResource.FOLDER :
236
					encoding = ((IFolder) resource).getDefaultCharset(false);
237
					break;
238
				case IResource.FILE :
239
					IFile file = (IFile) resource;
240
					// only worry about .java files
241
					if (file.getFileExtension().equals("java")) { //$NON-NLS-1$
242
						encoding = file.getCharset(false);
243
					}
244
					break;
245
			}
246
			if (encoding != null) {
247
				EncodingEntry entry = new EncodingEntry(resource, encoding);
248
				for (int i = 0; i < fLibs.length; i++) {
249
					String lib = fLibs[i];
250
					List encodings = (List) fCustomEncodings.get(lib);
251
					if (encodings == null) {
252
						encodings = new ArrayList();
253
						fCustomEncodings.put(lib, encodings);
254
					}
255
					encodings.add(entry);
256
				}
257
			}
258
			return true;
259
		}
260
261
	}
262
134
	private HashMap fSourceFolderMap = new HashMap(4);
263
	private HashMap fSourceFolderMap = new HashMap(4);
135
	private HashMap fOutputFolderMap = new HashMap(4);
264
	private HashMap fOutputFolderMap = new HashMap(4);
265
	private IBuild fBuild = null;
266
267
	/**
268
	 * Maps library name to default encoding for that library (or not present if there is no
269
	 * explicit default encoding specified). 
270
	 */
271
	Map fDefaultLibraryEncodings = new HashMap();
272
273
	/**
274
	 * Maps library name to custom {@link EncodingEntry}'s for this library.
275
	 */
276
	Map fCustomEncodings = new HashMap();
136
277
137
	public void initialize(ArrayList sourceEntries, ArrayList outputEntries, IClasspathEntry[] cpes, IProject project) {
278
	public void initialize(ArrayList sourceEntries, ArrayList outputEntries, IClasspathEntry[] cpes, IProject project) {
138
279
Lines 297-302 Link Here
297
			}
438
			}
298
		}
439
		}
299
440
441
		List toValidate = new ArrayList(); // list of source folders to perform encoding validation on
300
		for (Iterator iterator = fSourceFolderMap.keySet().iterator(); iterator.hasNext();) {
442
		for (Iterator iterator = fSourceFolderMap.keySet().iterator(); iterator.hasNext();) {
301
			IPath sourcePath = (IPath) iterator.next();
443
			IPath sourcePath = (IPath) iterator.next();
302
			SourceFolder sourceFolder = (SourceFolder) fSourceFolderMap.get(sourcePath);
444
			SourceFolder sourceFolder = (SourceFolder) fSourceFolderMap.get(sourcePath);
Lines 339-344 Link Here
339
					String message = NLS.bind(PDECoreMessages.SourceEntryErrorReporter_DupeSourceFolder, sourcePath.toString(), PROPERTY_SOURCE_PREFIX + sourceFolder.getDupeLibName());
481
					String message = NLS.bind(PDECoreMessages.SourceEntryErrorReporter_DupeSourceFolder, sourcePath.toString(), PROPERTY_SOURCE_PREFIX + sourceFolder.getDupeLibName());
340
					prepareError(PROPERTY_SOURCE_PREFIX + sourceFolder.getDupeLibName(), sourceFolder.getToken(), message, PDEMarkerFactory.NO_RESOLUTION, fSrcLibSeverity, PDEMarkerFactory.CAT_OTHER);
482
					prepareError(PROPERTY_SOURCE_PREFIX + sourceFolder.getDupeLibName(), sourceFolder.getToken(), message, PDEMarkerFactory.NO_RESOLUTION, fSrcLibSeverity, PDEMarkerFactory.CAT_OTHER);
341
				}
483
				}
484
485
				toValidate.add(sourceFolder);
342
			}
486
			}
343
		}
487
		}
344
488
Lines 348-353 Link Here
348
			String message = NLS.bind(PDECoreMessages.SourceEntryErrorReporter_MissingOutputEntry, errorEntry.get(errorEntry.fSsrcFolders), PROPERTY_OUTPUT_PREFIX + libName);
492
			String message = NLS.bind(PDECoreMessages.SourceEntryErrorReporter_MissingOutputEntry, errorEntry.get(errorEntry.fSsrcFolders), PROPERTY_OUTPUT_PREFIX + libName);
349
			prepareError(PROPERTY_OUTPUT_PREFIX + libName, errorEntry.get(errorEntry.fOutputFolders), message, PDEMarkerFactory.B_ADDITION, fMissingOutputLibSeverity, PDEMarkerFactory.CAT_OTHER);
493
			prepareError(PROPERTY_OUTPUT_PREFIX + libName, errorEntry.get(errorEntry.fOutputFolders), message, PDEMarkerFactory.B_ADDITION, fMissingOutputLibSeverity, PDEMarkerFactory.CAT_OTHER);
350
		}
494
		}
495
496
		// validate workspace encodings with those specified in build.properties
497
498
		// build map of expected encodings
499
		Iterator iterator = toValidate.iterator();
500
		while (iterator.hasNext()) {
501
			SourceFolder sourceFolder = (SourceFolder) iterator.next();
502
			IPath sourcePath = sourceFolder.getPath();
503
			IFolder folder = fProject.getFolder(sourcePath);
504
			try {
505
				ArrayList list = sourceFolder.getLibs();
506
				String[] libs = (String[]) list.toArray(new String[list.size()]);
507
				String encoding = getExplicitEncoding(folder);
508
				if (encoding != null) {
509
					for (int i = 0; i < libs.length; i++) {
510
						fDefaultLibraryEncodings.put(libs[i], encoding);
511
					}
512
				}
513
				folder.accept(new Visitor(sourceFolder));
514
			} catch (CoreException e) {
515
				// TODO:
516
			}
517
518
		}
519
520
		// Compare to encodings specified in build.properties (if any)
521
		IBuildEntry[] entries = fBuild.getBuildEntries();
522
		for (int i = 0; i < entries.length; i++) {
523
			IBuildEntry entry = entries[i];
524
			String name = entry.getName();
525
			if (name.startsWith(PROPERTY_JAVAC_DEFAULT_ENCODING_PREFIX)) {
526
				String lib = name.substring(PROPERTY_JAVAC_DEFAULT_ENCODING_PREFIX.length());
527
				String[] tokens = entry.getTokens();
528
				if (tokens.length > 0) {
529
					if (tokens.length == 1) {
530
						// compare
531
						String specified = tokens[0];
532
						String expected = (String) fDefaultLibraryEncodings.remove(lib);
533
						if (expected != null) {
534
							if (!specified.equals(expected)) {
535
								prepareError(name, specified, NLS.bind("Workspace encoding {0} does not match specified encoding {1}", new String[] {expected, specified}), PDEMarkerFactory.NO_RESOLUTION, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
536
							}
537
						} else {
538
							// encoding is specified, but workspace does not specify one
539
							prepareError(name, null, NLS.bind("Workspace encoding unspecified for library \"{0}\"", lib), PDEMarkerFactory.B_REMOVAL, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
540
						}
541
					} else {
542
						// syntax error
543
						prepareError(name, null, "Syntax error: only one default encoding can be specified", PDEMarkerFactory.NO_RESOLUTION, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
544
					}
545
				}
546
			} else if (name.startsWith(PROPERTY_JAVAC_CUSTOM_ENCODINGS_PREFIX)) {
547
				boolean error = false;
548
				String message = null;
549
				String errorToken = null;
550
				IContainer bundleRoot = PDEProject.getBundleRoot(fProject);
551
				String lib = name.substring(PROPERTY_JAVAC_CUSTOM_ENCODINGS_PREFIX.length());
552
				String[] tokens = entry.getTokens();
553
				if (tokens.length > 0) {
554
					List encodings = new ArrayList();
555
					for (int j = 0; j < tokens.length; j++) {
556
						String special = tokens[j];
557
						int index = special.indexOf('[');
558
						if (index >= 0 && special.endsWith("]")) { //$NON-NLS-1$
559
							String path = special.substring(0, index);
560
							String encoding = special.substring(index + 1, special.length() - 1);
561
							IResource member = bundleRoot.findMember(path);
562
							if (member == null) {
563
								// error - missing resource
564
								error = true;
565
								errorToken = special;
566
								message = NLS.bind("Resource does not exist: {0}", path);
567
								break;
568
							}
569
							encodings.add(new EncodingEntry(member, encoding));
570
						} else {
571
							// syntax error - invalid
572
							message = "Syntax error: expecting '<path>[encoding]'";
573
							errorToken = special;
574
							error = true;
575
							break;
576
						}
577
					}
578
					if (error) {
579
						prepareError(name, errorToken, message, PDEMarkerFactory.NO_RESOLUTION, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
580
					} else {
581
						// compare with workspace encodings
582
						List workspace = (List) fCustomEncodings.remove(lib);
583
						if (workspace == null) {
584
							prepareError(name, null, NLS.bind("Custom workspace encodings unspecified for library \"{0}\"", lib), PDEMarkerFactory.B_REMOVAL, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
585
						} else {
586
							Map map = new HashMap();
587
							Iterator iter = workspace.iterator();
588
							while (iter.hasNext()) {
589
								EncodingEntry ee = (EncodingEntry) iter.next();
590
								map.put(ee.getResource(), ee.getEncoding());
591
							}
592
							iter = encodings.iterator();
593
							while (iter.hasNext()) {
594
								EncodingEntry ee = (EncodingEntry) iter.next();
595
								String specified = ee.getEncoding();
596
								String expected = (String) map.remove(ee.getResource());
597
								if (expected == null) {
598
									prepareError(name, ee.getValue(), NLS.bind("Workspace encoding unspecified for \"{0}\"", ee.getResource().getProjectRelativePath().toString()), PDEMarkerFactory.B_REMOVAL, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
599
								} else {
600
									if (!specified.equals(expected)) {
601
										prepareError(name, ee.getValue(), NLS.bind("Workspace encoding {0} for \"{1}\" does not match specified encoding {2}", new String[] {expected, ee.getResource().getProjectRelativePath().toString(), specified}), PDEMarkerFactory.NO_RESOLUTION, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
602
									}
603
								}
604
							}
605
							// anything left in the workspace map?
606
							if (!map.isEmpty()) {
607
								iter = map.entrySet().iterator();
608
								while (iter.hasNext()) {
609
									Entry en = (Entry) iter.next();
610
									IResource res = (IResource) en.getKey();
611
									String expected = (String) en.getValue();
612
									EncodingEntry missing = new EncodingEntry(res, expected);
613
									String m = NLS.bind("Missing encoding {0} for {1}", new String[] {expected, res.getProjectRelativePath().toString()});
614
									prepareError(name, missing.getValue(), m, PDEMarkerFactory.B_ADDITION, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
615
								}
616
							}
617
						}
618
					}
619
				}
620
621
			}
622
		}
623
624
		// check for unspecified default encodings
625
		Iterator iter = fDefaultLibraryEncodings.entrySet().iterator();
626
		while (iter.hasNext()) {
627
			Entry entry = (Entry) iter.next();
628
			String lib = (String) entry.getKey();
629
			String expected = (String) entry.getValue();
630
			prepareError(PROPERTY_JAVAC_DEFAULT_ENCODING_PREFIX + lib, expected, NLS.bind("Missing defalt encoding {0} for library \"{1}\"", new String[] {expected, lib}), PDEMarkerFactory.B_ADDITION, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
631
		}
632
633
		// check for unspecified custom encodings
634
		iter = fCustomEncodings.entrySet().iterator();
635
		while (iter.hasNext()) {
636
			Entry entry = (Entry) iter.next();
637
			String lib = (String) entry.getKey();
638
			List encodings = (List) entry.getValue();
639
			Iterator iterator2 = encodings.iterator();
640
			while (iterator2.hasNext()) {
641
				EncodingEntry encoding = (EncodingEntry) iterator2.next();
642
				String m = NLS.bind("Missing encoding {0} for {1}", new String[] {encoding.getEncoding(), encoding.getResource().getProjectRelativePath().toString()});
643
				prepareError(PROPERTY_JAVAC_CUSTOM_ENCODINGS_PREFIX + lib, encoding.getValue(), m, PDEMarkerFactory.B_ADDITION, fEncodingSeverity, PDEMarkerFactory.CAT_OTHER);
644
			}
645
		}
646
	}
647
648
	/**
649
	 * Returns any explicit encoding set on the given container or one of its parents
650
	 * up to and including its project.
651
	 * 
652
	 * @param container container
653
	 * @return any explicit encoding or <code>null</code> if none
654
	 * @throws CoreException
655
	 */
656
	private String getExplicitEncoding(IContainer container) throws CoreException {
657
		String encoding = container.getDefaultCharset(false);
658
		if (encoding == null) {
659
			IContainer parent = container.getParent();
660
			if (parent != null) {
661
				switch (parent.getType()) {
662
					case IResource.FOLDER :
663
						return getExplicitEncoding(parent);
664
					case IResource.PROJECT :
665
						return getExplicitEncoding(parent);
666
					default :
667
						// don't consider workspace encoding
668
						return null;
669
				}
670
			}
671
		}
672
		return encoding;
351
	}
673
	}
352
674
353
	private String join(ProjectFolder[] folders) {
675
	private String join(ProjectFolder[] folders) {
(-)src/org/eclipse/pde/internal/ui/preferences/PDECompilersConfigurationBlock.java (-2 / +3 lines)
Lines 205-210 Link Here
205
	private static final Key KEY_P_BUILD_OUTPUT_LIBRARY = getPDEPrefKey(CompilerFlags.P_BUILD_OUTPUT_LIBRARY);
205
	private static final Key KEY_P_BUILD_OUTPUT_LIBRARY = getPDEPrefKey(CompilerFlags.P_BUILD_OUTPUT_LIBRARY);
206
	private static final Key KEY_P_BUILD_SRC_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_SRC_INCLUDES);
206
	private static final Key KEY_P_BUILD_SRC_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_SRC_INCLUDES);
207
	private static final Key KEY_P_BUILD_BIN_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_BIN_INCLUDES);
207
	private static final Key KEY_P_BUILD_BIN_INCLUDES = getPDEPrefKey(CompilerFlags.P_BUILD_BIN_INCLUDES);
208
	private static final Key KEY_P_BUILD_ENCODINGS = getPDEPrefKey(CompilerFlags.P_BUILD_ENCODINGS);
208
	private static final Key KEY_P_BUILD_JAVA_COMPLIANCE = getPDEPrefKey(CompilerFlags.P_BUILD_JAVA_COMPLIANCE);
209
	private static final Key KEY_P_BUILD_JAVA_COMPLIANCE = getPDEPrefKey(CompilerFlags.P_BUILD_JAVA_COMPLIANCE);
209
	private static final Key KEY_P_NOT_EXTERNALIZED = getPDEPrefKey(CompilerFlags.P_NOT_EXTERNALIZED);
210
	private static final Key KEY_P_NOT_EXTERNALIZED = getPDEPrefKey(CompilerFlags.P_NOT_EXTERNALIZED);
210
	private static final Key KEY_P_INCOMPATIBLE_ENV = getPDEPrefKey(CompilerFlags.P_INCOMPATIBLE_ENV);
211
	private static final Key KEY_P_INCOMPATIBLE_ENV = getPDEPrefKey(CompilerFlags.P_INCOMPATIBLE_ENV);
Lines 223-229 Link Here
223
224
224
	private static String[] SEVERITIES = {PDEUIMessages.PDECompilersConfigurationBlock_error, PDEUIMessages.PDECompilersConfigurationBlock_warning, PDEUIMessages.PDECompilersConfigurationBlock_ignore};
225
	private static String[] SEVERITIES = {PDEUIMessages.PDECompilersConfigurationBlock_error, PDEUIMessages.PDECompilersConfigurationBlock_warning, PDEUIMessages.PDECompilersConfigurationBlock_ignore};
225
226
226
	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};
227
	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_ENCODINGS, 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};
227
228
228
	/**
229
	/**
229
	 * Constant representing the {@link IDialogSettings} section for this block
230
	 * Constant representing the {@link IDialogSettings} section for this block
Lines 516-522 Link Here
516
				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);
517
				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);
517
				//build.properties
518
				//build.properties
518
				client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_build);
519
				client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_build);
519
				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);
520
				initializeComboControls(client, new String[] {PDEUIMessages.PDECompilersConfigurationBlock_1, PDEUIMessages.PDECompilersConfigurationBlock_2, PDEUIMessages.PDECompilersConfigurationBlock_0, PDEUIMessages.PDECompilersConfigurationBlock_3, PDEUIMessages.PDECompilersConfigurationBlock_4, PDEUIMessages.PDECompilersConfigurationBlock_5, "Missing or incorrect file encoding properties", 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_ENCODINGS, KEY_P_BUILD}, CompilerFlags.PLUGIN_FLAGS);
520
				// Versioning
521
				// Versioning
521
				client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_versioning);
522
				client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_versioning);
522
				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);
523
				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);

Return to bug 155015