Revert "Bug 389871 - [breakpoints] same condition accepted in one case but not another (be more tolerant)"

This reverts commit 6c2773055bf371afa17b6cbf9cbb46f0228baad7.
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
index 33872d5..d752a0f 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/ast/engine/EvaluationSourceGenerator.java
@@ -66,17 +66,24 @@
 		this(new String[0], new String[0], codeSnippet);
 	}
 
-	/**
-	 * Returns the completed codeSnippet by adding required semicolon and
-	 * return 
-	 */
 	protected String getCompleteSnippet(String codeSnippet) {
-		codeSnippet = codeSnippet.trim(); // remove whitespaces at the end
+
+		if (isExpression(codeSnippet)) {
+			codeSnippet = "return " + codeSnippet + ';'; //$NON-NLS-1$
+		}
+		return codeSnippet;
+	}
+
+	/**
+	 * Returns whether the given snippet represents an expression. This is
+	 * determined by examining the snippet for non-quoted semicolons.
+	 * 
+	 * Returns <code>true</code> if the snippet is an expression, or
+	 * <code>false</code> if the expression contains a statement.
+	 */
+	protected boolean isExpression(String codeSnippet) {
 		boolean inString = false;
 		byte[] chars = codeSnippet.getBytes();
-		
-		int semicolonIndex = -1;
-		int lastSemilcolonIndex = -1;
 		for (int i = 0, numChars = chars.length; i < numChars; i++) {
 			switch (chars[i]) {
 			case '\\':
@@ -89,44 +96,13 @@
 				inString = !inString;
 				break;
 			case ';':
-				if (!inString) { // mark the last 2 semicolon
-					semicolonIndex = lastSemilcolonIndex;
-					lastSemilcolonIndex = i;
+				if (!inString) {
+					return false;
 				}
 				break;
 			}
 		}
-		StringBuffer wordBuffer = new StringBuffer();
-		// if semicolon missing at the end 
-		if (lastSemilcolonIndex != chars.length-1)
-			semicolonIndex = lastSemilcolonIndex;
-		int i ;
-		for (i=0; i < chars.length; i++) {
-			// copy everything before the last statement or if whitespace
-			if (i<= semicolonIndex || Character.isWhitespace(chars[i]) || chars[i] == '}'){
-				wordBuffer.append(codeSnippet.charAt(i));
-			}
-			else
-				break;
-		}
-		String returnString = "return ";//$NON-NLS-1$
-		// don't add return if it there in some condition
-		int index = codeSnippet.lastIndexOf(returnString); 
-		if (index > i){
-			if (!Character.isWhitespace(chars[index-1]) || !(Character.isWhitespace(chars[index+6]) || chars[index+6] == '}'))
-				wordBuffer.append(returnString); 
-		} else if (chars[chars.length -1] !='}' && ( i+7 > chars.length || (i + 7 <= chars.length && !codeSnippet.substring(i, i+6).equals("return")))){ //$NON-NLS-1$
-			// add return if last statement does not have return
-				wordBuffer.append("return "); //$NON-NLS-1$
-		}
-		for (; i < chars.length; i++) {
-			// copy the last statement
-			wordBuffer.append(codeSnippet.charAt(i));
-		}
-		// add semicolon at the end if missing
-		if (chars[chars.length -1] !=';' && chars[chars.length -1] !='}')
-			wordBuffer.append(';');
-		return wordBuffer.toString();
+		return true;
 	}
 
 	public String getCompilationUnitName() {