* python sample compatibility update
diff --git a/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/completion/ExamplePythonCompletionProposalCollector.java b/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/completion/ExamplePythonCompletionProposalCollector.java
index 47d2208..bdfa168 100644
--- a/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/completion/ExamplePythonCompletionProposalCollector.java
+++ b/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/completion/ExamplePythonCompletionProposalCollector.java
@@ -2,6 +2,7 @@
import org.eclipse.dltk.core.IScriptProject;
import org.eclipse.dltk.core.ISourceModule;
+import org.eclipse.dltk.examples.internal.python.core.ExamplePythonNature;
import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposal;
import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalCollector;
import org.eclipse.dltk.ui.text.completion.ScriptOverrideCompletionProposal;
@@ -44,4 +45,9 @@
name, paramTypes, start, length, displayName,
completionProposal);
}
+
+ @Override
+ protected String getNatureId() {
+ return ExamplePythonNature.PYTHON_NATURE;
+ }
}
diff --git a/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/search/ExamplePythonMatchLocationParser.java b/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/search/ExamplePythonMatchLocationParser.java
index fe99e57..ac33476 100644
--- a/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/search/ExamplePythonMatchLocationParser.java
+++ b/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/search/ExamplePythonMatchLocationParser.java
@@ -1,18 +1,23 @@
package org.eclipse.dltk.examples.python.internal.search;
import org.eclipse.dltk.ast.ASTNode;
+import org.eclipse.dltk.ast.declarations.FieldDeclaration;
import org.eclipse.dltk.ast.expressions.CallExpression;
import org.eclipse.dltk.ast.expressions.Expression;
+import org.eclipse.dltk.ast.references.SimpleReference;
import org.eclipse.dltk.ast.references.VariableReference;
+import org.eclipse.dltk.ast.statements.Statement;
import org.eclipse.dltk.core.search.matching.MatchLocator;
import org.eclipse.dltk.core.search.matching.MatchLocatorParser;
import org.eclipse.dltk.core.search.matching.PatternLocator;
+import org.eclipse.dltk.python.parser.ast.expressions.Assignment;
import org.eclipse.dltk.python.parser.ast.expressions.ExtendedVariableReference;
public class ExamplePythonMatchLocationParser extends MatchLocatorParser {
protected ExamplePythonMatchLocationParser(MatchLocator locator) {
super(locator);
}
+
protected void processStatement(ASTNode node, PatternLocator locator) {
super.processStatement(node, locator);
if (node instanceof ExtendedVariableReference) {
@@ -32,7 +37,31 @@
}
}
if (node instanceof VariableReference) {
- locator.match((VariableReference)node, getNodeSet());
+ locator.match((VariableReference) node, getNodeSet());
+ }
+ if (node instanceof Assignment) {
+ Assignment as = (Assignment) node;
+ Statement varref = as.getLeft();
+ if (varref instanceof VariableReference) {
+ VariableReference vref = (VariableReference) varref;
+ locator.match(
+ new FieldDeclaration(vref.getName(),
+ vref.sourceStart(), vref.sourceEnd(), vref
+ .sourceStart(), vref.sourceEnd()),
+ getNodeSet());
+ }
+ if (varref instanceof ExtendedVariableReference) {
+ ExtendedVariableReference extvar = (ExtendedVariableReference) varref;
+ if (extvar.getExpressionCount() == 2) {
+ VariableReference vref = (VariableReference) extvar
+ .getExpression(1);
+ locator.match(
+ new FieldDeclaration(vref.getName(), vref
+ .sourceStart(), vref.sourceEnd(), vref
+ .sourceStart(), vref.sourceEnd()),
+ getNodeSet());
+ }
+ }
}
}
}
diff --git a/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/selection/ExamplePythonSelectionEngine.java b/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/selection/ExamplePythonSelectionEngine.java
index a3af1c4..2310e94 100644
--- a/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/selection/ExamplePythonSelectionEngine.java
+++ b/eclipsecon08/org.eclipse.dltk.examples.python.part4/src/org/eclipse/dltk/examples/python/internal/selection/ExamplePythonSelectionEngine.java
@@ -11,6 +11,7 @@
import org.eclipse.dltk.ast.expressions.Expression;
import org.eclipse.dltk.ast.references.VariableReference;
import org.eclipse.dltk.codeassist.ISelectionEngine;
+import org.eclipse.dltk.codeassist.ISelectionRequestor;
import org.eclipse.dltk.compiler.env.IModuleSource;
import org.eclipse.dltk.core.DLTKCore;
import org.eclipse.dltk.core.IModelElement;
@@ -96,4 +97,8 @@
public void setOptions(Map options) {
}
+
+ @Override
+ public void setRequestor(ISelectionRequestor requestor) {
+ }
}