aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCheng Chen2012-04-30 23:34:57 (EDT)
committerCheng Chen2012-04-30 23:34:57 (EDT)
commit88b8d2236ae5a07bc8e62b52b41797f70fd3a40d (patch)
tree12b07ef9b76eb50f49ca1a34783ee7f831b24915
parentfd1b0f45e04320f4fe34bca6f119e7c820d46aa1 (diff)
downloadorg.eclipse.recommenders-88b8d2236ae5a07bc8e62b52b41797f70fd3a40d.zip
org.eclipse.recommenders-88b8d2236ae5a07bc8e62b52b41797f70fd3a40d.tar.gz
org.eclipse.recommenders-88b8d2236ae5a07bc8e62b52b41797f70fd3a40d.tar.bz2
[snipmatch] fix small bugsrefs/changes/70/5770/2
use dummy values for parameters in search result Signed-off-by: Cheng Chen <chengchendoc@gmail.com> Change-Id: Ic2fb86de6787998da5b59f2aecb0c3497b58ffea
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/Effect.java2
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchEnvironment.java9
2 files changed, 8 insertions, 3 deletions
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/Effect.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/Effect.java
index 2963a18..0838165 100755..100644
--- a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/Effect.java
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/Effect.java
@@ -177,7 +177,7 @@ public class Effect {
public int getParameterIndex(String name) {
for (int i = 0; i < params.size(); i++) {
- if (params.get(i).getName() == name) {
+ if (params.get(i).getName().equals(name)) {
return i;
}
}
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchEnvironment.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchEnvironment.java
index 89a5599..7b5d76c 100755..100644
--- a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchEnvironment.java
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchEnvironment.java
@@ -171,7 +171,7 @@ public abstract class MatchEnvironment {
* @param node The match node to evaluate.
* @return The result of the evaluation.
*/
- private Object evaluateMatchNode(MatchNode node) {
+ protected Object evaluateMatchNode(MatchNode node) {
/* For argument nodes, simply return the argument.
* For effect nodes, use evaluateEffect and pass in the arguments.
@@ -184,7 +184,12 @@ public abstract class MatchEnvironment {
Object[] args = new Object[effectNode.getEffect().numParameters()];
for (int i = 0; i < args.length; i++) {
- args[i] = evaluateMatchNode(effectNode.getChild(i));
+ String value = (String) evaluateMatchNode(effectNode.getChild(i));;
+ //If param value is empty, just use param name as dummy param value
+ if(value.isEmpty()){
+ value = ((ArgumentMatchNode) effectNode.getChild(i)).getParameter().getName();
+ }
+ args[i] = value;
}
return evaluateEffect(effectNode, args);