*fixes
diff --git a/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/task/TodoTaskSimpleParser.java b/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/task/TodoTaskSimpleParser.java
index 4c1a414..745d465 100644
--- a/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/task/TodoTaskSimpleParser.java
+++ b/core/plugins/org.eclipse.dltk.core/compiler/org/eclipse/dltk/compiler/task/TodoTaskSimpleParser.java
@@ -8,6 +8,7 @@
*
* Contributors:
* xored software, Inc. - initial API and Implementation (Alex Panchenko)
+ * xored software, Inc. - Fixed bug for end of file less whan 4 symbol comments (Andrei Sobolev)
*******************************************************************************/
package org.eclipse.dltk.compiler.task;
@@ -100,16 +101,19 @@
private void processLine(char[] content, int begin, final int end) {
for (int i = 0; i < tags.length; ++i) {
final char[] tag = tags[i];
- char ch = content[begin + tag.length];
- if (begin + tag.length < end && isEnd(ch)
- || begin + tag.length == end) {
- if (compareTag(content, begin, tag)) {
- final String msg = new String(content, begin, end - begin);
- try {
- taskReporter.reportTask(msg, lineNumber, priorities[i],
- begin, contentPos);
- } catch (CoreException e) {
- DLTKCore.error("Error in reportTask()", e);
+ if (begin + tag.length < content.length) {
+ char ch = content[begin + tag.length];
+ if (begin + tag.length < end && isEnd(ch)
+ || begin + tag.length == end) {
+ if (compareTag(content, begin, tag)) {
+ final String msg = new String(content, begin, end
+ - begin);
+ try {
+ taskReporter.reportTask(msg, lineNumber,
+ priorities[i], begin, contentPos);
+ } catch (CoreException e) {
+ DLTKCore.error("Error in reportTask()", e);
+ }
}
}
}
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/DLTKContentTypeManager.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/DLTKContentTypeManager.java
index 211a201..384816a 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/DLTKContentTypeManager.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/DLTKContentTypeManager.java
@@ -106,6 +106,9 @@
// I've disable file content checking for non local environments.
IEnvironment environment = EnvironmentManager.getEnvironment(resource
.getProject());
+ if (environment == null) {
+ return false;
+ }
if (!EnvironmentManager.isLocal(environment)) {
return false;
}
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/SourceParserUtil.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/SourceParserUtil.java
index 0eee63c..038e647 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/SourceParserUtil.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/core/SourceParserUtil.java
@@ -12,13 +12,20 @@
private static final Object AST = "ast"; //$NON-NLS-1$
private static final Object FLAGS = "flags"; //$NON-NLS-1$
- /**
- * Used to retrive module declaration from source module.
- */
+ public static interface IContentAction {
+ void run(ISourceModule module, char[] content);
+ }
+
public static ModuleDeclaration getModuleDeclaration(ISourceModule module,
IProblemReporter reporter) {
return getModuleDeclaration(module, reporter,
- ISourceParserConstants.DEFAULT);
+ ISourceParserConstants.DEFAULT, null);
+ }
+
+ public static ModuleDeclaration getModuleDeclaration(ISourceModule module,
+ IProblemReporter reporter, IContentAction action) {
+ return getModuleDeclaration(module, reporter,
+ ISourceParserConstants.DEFAULT, action);
}
public static ModuleDeclaration getModuleDeclaration(ISourceModule module,
@@ -26,21 +33,35 @@
ISourceModuleInfoCache sourceModuleInfoCache = ModelManager
.getModelManager().getSourceModuleInfoCache();
ISourceModuleInfo sourceModuleInfo = sourceModuleInfoCache.get(module);
- return getModuleDeclaration(module, reporter, sourceModuleInfo, flags);
+ return getModuleDeclaration(module, reporter, sourceModuleInfo, flags,
+ null);
}
- /**
- * Used to retrive module declaration from source module.
- */
+ public static ModuleDeclaration getModuleDeclaration(ISourceModule module,
+ IProblemReporter reporter, int flags, IContentAction action) {
+ ISourceModuleInfoCache sourceModuleInfoCache = ModelManager
+ .getModelManager().getSourceModuleInfoCache();
+ ISourceModuleInfo sourceModuleInfo = sourceModuleInfoCache.get(module);
+ return getModuleDeclaration(module, reporter, sourceModuleInfo, flags,
+ action);
+ }
public static ModuleDeclaration getModuleDeclaration(ISourceModule module,
IProblemReporter reporter, ISourceModuleInfo mifo) {
return getModuleDeclaration(module, reporter, mifo,
- ISourceParserConstants.DEFAULT);
+ ISourceParserConstants.DEFAULT, null);
}
public static ModuleDeclaration getModuleDeclaration(ISourceModule module,
- IProblemReporter reporter, ISourceModuleInfo mifo, int flags) {
+ IProblemReporter reporter, ISourceModuleInfo mifo,
+ IContentAction action) {
+ return getModuleDeclaration(module, reporter, mifo,
+ ISourceParserConstants.DEFAULT, action);
+ }
+
+ public static ModuleDeclaration getModuleDeclaration(ISourceModule module,
+ IProblemReporter reporter, ISourceModuleInfo mifo, int flags,
+ IContentAction action) {
IDLTKLanguageToolkit toolkit;
toolkit = DLTKLanguageManager.getLanguageToolkit(module);
@@ -65,9 +86,13 @@
((ISourceParserExtension) sourceParser).setFlags(flags);
}
try {
+ char[] sourceAsCharArray = module.getSourceAsCharArray();
moduleDeclaration = sourceParser.parse(module.getPath()
- .toString().toCharArray(), module
- .getSourceAsCharArray(), reporter);
+ .toString().toCharArray(), sourceAsCharArray,
+ reporter);
+ if (action != null) {
+ action.run(module, sourceAsCharArray);
+ }
} catch (ModelException e) {
if (DLTKCore.DEBUG) {
e.printStackTrace();
diff --git a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/util/Util.java b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/util/Util.java
index 95b9e7b..86b5674 100644
--- a/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/util/Util.java
+++ b/core/plugins/org.eclipse.dltk.core/model/org/eclipse/dltk/internal/core/util/Util.java
@@ -341,7 +341,7 @@
* Finds the first line separator used by the given text.
*
* @return </code>"\n"</code> or </code>"\r"</code> or </code>"\r\n"</code>,
- * or <code>null</code> if none found
+ * or <code>null</code> if none found
*/
public static String findLineSeparator(char[] text) {
// find the first line separator
@@ -432,6 +432,7 @@
"Error receiving file content: retrying("
+ String.valueOf(tryCount) + ")", e);
DLTKCore.getDefault().getLog().log(status);
+
// Some times for RSE we can get here if connection is not
// established yet, or if connection are lost.
if (tryCount == 0) {
@@ -534,7 +535,6 @@
* Returns whether the given resource path matches one of the
* inclusion/exclusion patterns. NOTE: should not be asked directly using
* pkg root pathes
- *
*/
public final static boolean isExcluded(IPath resourcePath,
char[][] inclusionPatterns, char[][] exclusionPatterns,
@@ -880,9 +880,9 @@
* Unicode value of each character in the strings.
*
* @return the value <code>0</code> if the str1 is equal to str2; a value
- * less than <code>0</code> if str1 is lexicographically less than
- * str2; and a value greater than <code>0</code> if str1 is
- * lexicographically greater than str2.
+ * less than <code>0</code> if str1 is lexicographically less than str2;
+ * and a value greater than <code>0</code> if str1 is lexicographically
+ * greater than str2.
*/
public static int compare(char[] str1, char[] str2) {
int len1 = str1.length;
@@ -917,7 +917,7 @@
* <li>
*
* <pre>
- * divider = 'b'
+ * divider = 'b'
* string = "abbaba"
* start = 2
* end = 5
@@ -928,18 +928,17 @@
* </ol>
*
* @param divider
- * the given divider
+ * the given divider
* @param string
- * the given string
+ * the given string
* @param start
- * the given starting index
+ * the given starting index
* @param end
- * the given ending index
+ * the given ending index
* @return a new array which is the split of the given string using the
- * given divider
+ * given divider
* @throws ArrayIndexOutOfBoundsException
- * if start is lower than 0 or end is greater than the array
- * length
+ * if start is lower than 0 or end is greater than the array length
*/
public static final String[] splitOn(char divider, String string,
int start, int end) {
@@ -971,7 +970,7 @@
* <li>
*
* <pre>
- * array = {"a", "b"}
+ * array = {"a", "b"}
* separator = '.'
* => result = "a.b"
* </pre>
@@ -980,7 +979,7 @@
* <li>
*
* <pre>
- * array = {}
+ * array = {}
* separator = '.'
* => result = ""
* </pre>
@@ -989,11 +988,11 @@
* </ol>
*
* @param array
- * the given array
+ * the given array
* @param separator
- * the given separator
+ * the given separator
* @return the concatenation of the given array parts using the given
- * separator between each part
+ * separator between each part
*/
public static final String concatWith(String[] array, char separator) {
StringBuffer buffer = new StringBuffer();
@@ -1014,7 +1013,7 @@
* <li>
*
* <pre>
- * name = "c"
+ * name = "c"
* array = { "a", "b" }
* separator = '.'
* => result = "a.b.c"
@@ -1024,7 +1023,7 @@
* <li>
*
* <pre>
- * name = null
+ * name = null
* array = { "a", "b" }
* separator = '.'
* => result = "a.b"
@@ -1034,7 +1033,7 @@
* <li>
*
* <pre>
- * name = " c"
+ * name = " c"
* array = null
* separator = '.'
* => result = "c"
@@ -1044,14 +1043,13 @@
* </ol>
*
* @param array
- * the given array
+ * the given array
* @param name
- * the given name
+ * the given name
* @param separator
- * the given separator
+ * the given separator
* @return the concatenation of the given array parts using the given
- * separator between each part and appending the given name at the
- * end
+ * separator between each part and appending the given name at the end
*/
public static final String concatWith(String[] array, String name,
char separator) {
@@ -1079,7 +1077,7 @@
* <li>
*
* <pre>
- * first = null
+ * first = null
* second = "a"
* => result = {"a"}
* </pre>
@@ -1087,7 +1085,7 @@
* <li>
*
* <pre>
- * first = {"a"}
+ * first = {"a"}
* second = null
* => result = {"a"}
* </pre>
@@ -1096,7 +1094,7 @@
* <li>
*
* <pre>
- * first = {"a"}
+ * first = {"a"}
* second = {"b"}
* => result = {"a", "b"}
* </pre>
@@ -1105,11 +1103,11 @@
* </ol>
*
* @param first
- * the first array to concatenate
+ * the first array to concatenate
* @param second
- * the array to add at the end of the first array
+ * the array to add at the end of the first array
* @return a new array adding the second array at the end of first array, or
- * null if the two arrays are null.
+ * null if the two arrays are null.
*/
public static final String[] arrayConcat(String[] first, String second) {
if (second == null)
@@ -1197,15 +1195,15 @@
* detected, or an exception is thrown.
*
* @param in
- * a data input stream.
+ * a data input stream.
* @return a Unicode string.
* @exception EOFException
- * if the input stream reaches the end before all the bytes.
+ * if the input stream reaches the end before all the bytes.
* @exception IOException
- * if an I/O error occurs.
+ * if an I/O error occurs.
* @exception UTFDataFormatException
- * if the bytes do not represent a valid UTF-8 encoding of a
- * Unicode string.
+ * if the bytes do not represent a valid UTF-8 encoding of a Unicode
+ * string.
* @see java.io.DataInputStream#readUnsignedShort()
*/
public final static char[] readUTF(DataInput in) throws IOException {
@@ -1225,7 +1223,7 @@
case 5:
case 6:
case 7:
- // 0xxxxxxx
+ // xxxxxxx
count++;
str[strlen++] = (char) c;
break;
@@ -1268,16 +1266,16 @@
* machine-independent manner.
* <p>
* First, two bytes are written to the output stream as if by the
- * <code>writeShort</code> method giving the number of bytes to follow.
- * This value is the number of bytes actually written out, not the length of
- * the string. Following the length, each character of the string is output,
- * in sequence, using the UTF-8 encoding for the character.
+ * <code>writeShort</code> method giving the number of bytes to follow. This
+ * value is the number of bytes actually written out, not the length of the
+ * string. Following the length, each character of the string is output, in
+ * sequence, using the UTF-8 encoding for the character.
*
* @param str
- * a string to be written.
+ * a string to be written.
* @return the number of bytes written to the stream.
* @exception IOException
- * if an I/O error occurs.
+ * if an I/O error occurs.
*
*/
public static int writeUTF(OutputStream out, char[] str) throws IOException {
@@ -1324,12 +1322,12 @@
* "<", ">", "/", ".".
*
* @param string
- * the signature string
+ * the signature string
* @param start
- * the 0-based character index of the first character
+ * the 0-based character index of the first character
* @return the 0-based character index of the last character
* @exception IllegalArgumentException
- * if this is not an identifier
+ * if this is not an identifier
*/
public static int scanIdentifier(char[] string, int start) {
// need a minimum 1 char