*tutorial code fix
diff --git a/eclipsecon08/org.eclipse.dltk.examples.python/src/org/eclipse/dltk/examples/internal/python/core/ExamplePythonContentDescriber.java b/eclipsecon08/org.eclipse.dltk.examples.python/src/org/eclipse/dltk/examples/internal/python/core/ExamplePythonContentDescriber.java
index 98ac333..fe22d01 100644
--- a/eclipsecon08/org.eclipse.dltk.examples.python/src/org/eclipse/dltk/examples/internal/python/core/ExamplePythonContentDescriber.java
+++ b/eclipsecon08/org.eclipse.dltk.examples.python/src/org/eclipse/dltk/examples/internal/python/core/ExamplePythonContentDescriber.java
@@ -1,8 +1,7 @@
package org.eclipse.dltk.examples.internal.python.core;
-import java.io.IOException;
-import java.io.Reader;
-import org.eclipse.core.runtime.content.IContentDescription;
+import java.util.regex.Pattern;
+
import org.eclipse.dltk.core.ScriptContentDescriber;
public class ExamplePythonContentDescriber extends ScriptContentDescriber {
@@ -10,12 +9,10 @@
public ExamplePythonContentDescriber() {
}
- /**
- * This method could be extended to use pattern matching for files without
- * extension.
- */
- public int describe(Reader contents, IContentDescription description)
- throws IOException {
- return ScriptContentDescriber.INDETERMINATE;
+ protected static Pattern[] header_patterns = { Pattern.compile(
+ "^#!.*python.*", Pattern.MULTILINE) }; //$NON-NLS-1$
+
+ protected Pattern[] getHeaderPatterns() {
+ return header_patterns;
}
}