Merge branch 'bug480646'
diff --git a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java
index d089278..d6e70f3 100644
--- a/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java
+++ b/plugins/org.eclipse.xpand/src/org/eclipse/internal/xpand2/debug/XpandModelPresentation.java
@@ -36,6 +36,8 @@
  * the debugger views.
  * 
  * @author Clemens Kadura (zAJKa)
+ * @author Karsten Thoms - maintenance
+ * @author Aykut Kilic (itemis) - Bug#480646
  */
 public class XpandModelPresentation extends ExpressionModelPresentation {
 
@@ -109,15 +111,17 @@
 	@Override
 	protected String getContainerName(ISyntaxElement se) {
 		XpandDefinition def;
+		
 		if (se instanceof XpandDefinition) {
 			def = (XpandDefinition) se;
-		}
-		else {
+		} else if( se instanceof Statement) {
 			def = ((Statement) se).getContainingDefinition();
+		} else {
+			def = null;
 		}
 
-		if (def != null)
-		return getTemplateName(se) + "::" + getDefinitionName(def);
+		if (def != null) 
+			return getTemplateName(se) + "::" + getDefinitionName(def);
 
 		return "";
 	}
diff --git a/plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/ExpressionPluginAdapter.java b/plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/ExpressionPluginAdapter.java
index 253285f..7d06f59 100644
--- a/plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/ExpressionPluginAdapter.java
+++ b/plugins/org.eclipse.xtend.ui/src/org/eclipse/xtend/ui/debug/ExpressionPluginAdapter.java
@@ -28,6 +28,8 @@
 import org.eclipse.emf.mwe.ui.debug.model.MWEBreakpoint;
 import org.eclipse.emf.mwe.ui.debug.processing.PluginAdapter;
 import org.eclipse.emf.mwe.ui.workflow.util.PluginConfigurationElementUtil;
+import org.eclipse.internal.xpand2.ast.Statement;
+import org.eclipse.internal.xpand2.ast.TextStatement;
 import org.eclipse.internal.xtend.expression.ast.BooleanOperation;
 import org.eclipse.internal.xtend.expression.ast.Case;
 import org.eclipse.internal.xtend.expression.ast.Cast;
@@ -62,7 +64,8 @@
  * The IPluginAdapter implementation for Expressions.
  *
  * @author Clemens Kadura (zAJKa)
- * @author Aykut Kilic (itemis) - Bug#465802
+ * @author Karsten Thoms - maintenance
+ * @author Aykut Kilic (itemis) - Bug#465802,480646
  */
 public class ExpressionPluginAdapter implements PluginAdapter {
 
@@ -105,7 +108,9 @@
 
 	public MWEBreakpoint createBreakpoint(IResource resource, int start, int end, int line) throws CoreException {
 		ISyntaxElement element = findElementForPosition(resource, start, line);
-		if (element == null || !(element instanceof OperationCall))
+		if (element == null || (!(element instanceof FeatureCall)
+		        && !(element instanceof Statement)) || element instanceof TextStatement
+		        ||  element.getEnd() == 0 )
 			// TODO: CK: Message that no BP could be created
 			return null;
 
diff --git a/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/FeatureCall.java b/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/FeatureCall.java
index 5a1c183..78dd071 100644
--- a/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/FeatureCall.java
+++ b/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/ast/FeatureCall.java
@@ -33,6 +33,7 @@
  * @author Bernd Kolb
  * @author Karsten Thoms - maintenance
  * @author Ed Merks - Bug#418156
+ * @author Aykut Kilic (itemis) - Bug#480646
  */
 @SuppressWarnings("rawtypes")
 public class FeatureCall extends Expression {
@@ -84,60 +85,65 @@
 	 */
 	@Override
 	public Object evaluateInternal(final ExecutionContext ctx) {
-		Object targetObj = null;
-		final String nameValue = getName().toString();
-		if (target == null) {
-			final StaticProperty staticProp = getEnumLiteral(ctx);
-			if (staticProp != null) {
-				return staticProp.get();
-			}
-			Variable var = ctx.getVariable(nameValue);
-			if (var != null) {
-				return var.getValue();
-			}
-
-			var = ctx.getVariable(ExecutionContext.IMPLICIT_VARIABLE);
-			if (var != null) {
-				targetObj = var.getValue();
-				if (targetObj == null) {
-					return ctx.handleNullEvaluation(this);
-				}
-			}
-		} else {
-			targetObj = getTarget().evaluate(ctx);
-			if (targetObj == null) {
-				return ctx.handleNullEvaluation(this);
-			}
-		}
-		final String additionalMsg = "";
-		if (targetObj != null) {
-			// Does the target object define a property with the feature name?
-			final Property p = ctx.findProperty(nameValue, targetObj);
-			if ((p == null) && ((targetObj instanceof Collection) && !((Collection) targetObj).isEmpty())) {
-				return invokeOnInnerElements(ctx, targetObj, additionalMsg);
-			}
-			if (p != null) {
-				return p.get(targetObj);
-			}
-		}
-		if (target == null) {
-			// type literal ?
-			final Type type = ctx.getTypeForName(nameValue);
-			if (type != null) {
-				return type;
-			}
-		}
-		if ((targetObj instanceof Collection) && ((Collection) targetObj).isEmpty()) {
-			return targetObj;
-		}
-		if (nameValue.indexOf(SyntaxConstants.NS_DELIM) != -1) {
-			throw new EvaluationException("Couldn't find enum literal or type '" + nameValue + "'", this, ctx);
-		}
-		if (target == null) {
-			throw new EvaluationException("Couldn't find type or property '" + nameValue + "'", this, ctx);
-		}
-		throw new EvaluationException("Couldn't find property '" + nameValue + "' for type " + findType(targetObj, ctx).getName() + additionalMsg,
-				this, ctx);
+	    ctx.preTask(this);
+	    try {
+    		Object targetObj = null;
+    		final String nameValue = getName().toString();
+    		if (target == null) {
+    			final StaticProperty staticProp = getEnumLiteral(ctx);
+    			if (staticProp != null) {
+    				return staticProp.get();
+    			}
+    			Variable var = ctx.getVariable(nameValue);
+    			if (var != null) {
+    				return var.getValue();
+    			}
+    
+    			var = ctx.getVariable(ExecutionContext.IMPLICIT_VARIABLE);
+    			if (var != null) {
+    				targetObj = var.getValue();
+    				if (targetObj == null) {
+    					return ctx.handleNullEvaluation(this);
+    				}
+    			}
+    		} else {
+    			targetObj = getTarget().evaluate(ctx);
+    			if (targetObj == null) {
+    				return ctx.handleNullEvaluation(this);
+    			}
+    		}
+    		final String additionalMsg = "";
+    		if (targetObj != null) {
+    			// Does the target object define a property with the feature name?
+    			final Property p = ctx.findProperty(nameValue, targetObj);
+    			if ((p == null) && ((targetObj instanceof Collection) && !((Collection) targetObj).isEmpty())) {
+    				return invokeOnInnerElements(ctx, targetObj, additionalMsg);
+    			}
+    			if (p != null) {
+    				return p.get(targetObj);
+    			}
+    		}
+    		if (target == null) {
+    			// type literal ?
+    			final Type type = ctx.getTypeForName(nameValue);
+    			if (type != null) {
+    				return type;
+    			}
+    		}
+    		if ((targetObj instanceof Collection) && ((Collection) targetObj).isEmpty()) {
+    			return targetObj;
+    		}
+    		if (nameValue.indexOf(SyntaxConstants.NS_DELIM) != -1) {
+    			throw new EvaluationException("Couldn't find enum literal or type '" + nameValue + "'", this, ctx);
+    		}
+    		if (target == null) {
+    			throw new EvaluationException("Couldn't find type or property '" + nameValue + "'", this, ctx);
+    		}
+    		throw new EvaluationException("Couldn't find property '" + nameValue + "' for type " + findType(targetObj, ctx).getName() + additionalMsg,
+    				this, ctx);
+	    } finally {
+	      ctx.postTask(this);
+	    }
 	}
 
 	private Object invokeOnInnerElements(final ExecutionContext ctx, final Object targetObj, final String additionalMsg) {
diff --git a/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/ExpressionElementAdapter.java b/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/ExpressionElementAdapter.java
index 39a6c56..e1e6b4a 100644
--- a/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/ExpressionElementAdapter.java
+++ b/plugins/org.eclipse.xtend/src/org/eclipse/internal/xtend/expression/debug/ExpressionElementAdapter.java
@@ -43,7 +43,8 @@
  * 
  * @author Bernd Kolb
  * @author Clemens Kadura (zAJKa)
- * @author Aykut Kilic (itemis) - Bug#465802
+ * @author Karsten Thoms - maintenance
+ * @author Aykut Kilic (itemis) - Bug#465802,480646
  */
 public class ExpressionElementAdapter implements ElementAdapter {
 
@@ -99,8 +100,8 @@
 		for (final BaseSpecialTreatment special : specials) {
 			result &= !special.shallNotSuspend(element, flag, context);
 		}
-		if (element instanceof OperationCall) {
-			String fileName = ((OperationCall) element).getFileName();
+		if (element instanceof FeatureCall) {
+			String fileName = ((FeatureCall) element).getFileName();
 			result &= (fileName != null) && !fileName.equals("nofile");
 		}
 
@@ -191,10 +192,10 @@
 	public Object findElement(final SyntaxElement se, final Object actual, final int flag) {
 		if (actual == null)
 			return null;
-		if (actual instanceof OperationCall) {
-			final OperationCall op = (OperationCall) actual;
-			final int start = op.getStart();
-			if (se.resource.endsWith(pres.getStringRep(op.getFileName())) && se.start == start)
+		if (actual instanceof FeatureCall) {
+			final FeatureCall fc = (FeatureCall) actual;
+			final int start = fc.getStart();
+			if (se.resource.endsWith(this.pres.getStringRep(fc.getFileName())) && (se.start == start))
 				return actual;
 		}
 		return null;