1 package no.uio.ifi.refaktor.extractors.collectors;
3 import no.uio.ifi.refaktor.prefix.Prefix;
4 import no.uio.ifi.refaktor.prefix.PrefixSet;
5 import no.uio.ifi.refaktor.utils.RefaktorDebug;
6 import no.uio.ifi.refaktor.utils.SmartTextSelection;
8 import org.eclipse.jdt.core.dom.Assignment;
9 import org.eclipse.jdt.core.dom.Expression;
10 import org.eclipse.jdt.core.dom.Name;
11 import org.eclipse.jdt.core.dom.SimpleName;
13 public class UnfixesCollector extends PropertyCollector {
14 private PrefixSet unfixes;
16 public UnfixesCollector(SmartTextSelection selection) {
18 this.unfixes = new PrefixSet();
21 public PrefixSet getUnfixes() {
25 // TODO: handle VariableDeclaration statements
29 public boolean visit(Assignment node) {
30 if (!nodeInSelection(node))
33 addLeftHandSideToUnfixesIfSimpleName(node);
37 private void addLeftHandSideToUnfixesIfSimpleName(Assignment node) {
38 Expression lhs = node.getLeftHandSide();
39 assert lhs instanceof Name;
40 Name name = (Name) lhs;
41 if (name.isSimpleName()) {
42 SimpleName simpleName = (SimpleName) name;
43 Prefix p = new Prefix(simpleName, getDocument());
44 RefaktorDebug.println("Unfix string: " + p.toString());