Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 320507
Collapse All | Expand All

(-)a/plugins/org.eclipse.xtend.shared.ui/src/org/eclipse/xtend/shared/ui/ResourceContributorBase.java (-5 / +22 lines)
Lines 10-15 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.xtend.shared.ui;
11
package org.eclipse.xtend.shared.ui;
12
12
13
import java.io.IOException;
13
import java.io.InputStream;
14
import java.io.InputStream;
14
import java.io.InputStreamReader;
15
import java.io.InputStreamReader;
15
import java.io.Reader;
16
import java.io.Reader;
Lines 43-53 Link Here
43
				// BNI bug#312571
44
				// BNI bug#312571
44
				// 1. start position can be 0 (missing semicolon at the end of a file)
45
				// 1. start position can be 0 (missing semicolon at the end of a file)
45
				// 2. why should only one error be handled (!hasErrors)
46
				// 2. why should only one error be handled (!hasErrors)
46
				if (e.getStart() >= 0) {
47
				int start = e.getStart();
47
					if (source instanceof IFile) {
48
				int end = e.getEnd();
48
						IFile f = (IFile) source;
49
				if (source instanceof IFile) {
49
						XtendXpandMarkerManager.addErrorMarker(f, e.getMessage(), IMarker.SEVERITY_ERROR, e.getStart(),
50
					IFile f = (IFile) source;
50
								e.getEnd());
51
					if (start == 0 && end == 1 && e.getMessage().contains("<EOF>")) {
52
						// BNI find the offset of the last charcter!
53
						try {
54
							Reader reader = createReader(source);
55
							while (reader.read() != -1) {
56
								start++;
57
								end++;
58
							}
59
							start--;
60
							end--;
61
						}
62
						catch (IOException e2) {
63
							logError(e2.getMessage(), e2);
64
						}
65
					}
66
					if (start > 0) {
67
						XtendXpandMarkerManager.addErrorMarker(f, e.getMessage(), IMarker.SEVERITY_ERROR, start, end);
51
					}
68
					}
52
				}
69
				}
53
			}
70
			}

Return to bug 320507