regression fixes:

+ improve resetting of callin/-out flags in the Scanner
+ restore OT variant of Keywords.WHEN for "when ()" proposals
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
index 48d4356..fed9b0e 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
@@ -2413,7 +2413,7 @@
 					// guard predicate?
 					if (type.isRole() || type.isTeam()) {
 						keywords[count++] = Keywords.BASE_WHEN;
-						keywords[count++] = Keywords.WHEN;
+						keywords[count++] = Keywords.WHEN_PARENS;
 					}
 //	gbr,SH}
 
@@ -2500,7 +2500,7 @@
 	CompletionOnKeyword1 completionOnKeyword = new CompletionOnKeyword1(
 		this.identifierStack[ptr],
 		this.identifierPositionStack[ptr],
-		new char[][]{ Keywords.BASE_WHEN, Keywords.WHEN});
+		new char[][]{ Keywords.BASE_WHEN, Keywords.WHEN_PARENS});
 
 	// store this type ref into a faked guard predicate:
 	GuardPredicateDeclaration result = new GuardPredicateDeclaration(cResult,
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
index a42f61e..c655d29 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
@@ -89,6 +89,7 @@
 	char[] RESULT = "result".toCharArray(); //$NON-NLS-1$
 	// these are special: include subsequent '()':
 	char[] BASE_WHEN = "base when ()".toCharArray(); //$NON-NLS-1$
+	char[] WHEN_PARENS = "when ()".toCharArray(); //$NON-NLS-1$
 //gbr}
 	char[] VAR = "var".toCharArray(); //$NON-NLS-1$ // Admittedly not a full blown keyword, just "reserved"
 	char[] WHEN = "when".toCharArray(); //$NON-NLS-1$ // Admittedly not a full blown keyword, just "reserved"
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 5716bbc..c77e9b2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -1626,6 +1626,13 @@
 		this.scanContext = isInModuleDeclaration() ? ScanContext.EXPECTING_KEYWORD : ScanContext.INACTIVE;
 	}
 	token = getNextToken0();
+//{ObjectTeams: expire callin/callout flags:
+	if (token == TokenNamewith || token == TokenNameSEMICOLON) {
+		// let method mapping flags last until param mapping (possibly empty = ';')
+		this._callinSeen = false;
+		this._calloutSeen = false;
+	}
+// SH}
 	updateCase(token);
 	if (areRestrictedModuleKeywordsActive()) {
 		if (isRestrictedKeyword(token))
@@ -1647,11 +1654,6 @@
 		token = disambiguateCasePattern(token, this);
 	}
 	addTokenToLookBack(token);
-	if (token == TokenNamewith || token == TokenNameSEMICOLON) {
-		// let method mapping flags last until param mapping (possibly empty = ';')
-		this._callinSeen = false;
-		this._calloutSeen = false;
-	}
 	this.multiCaseLabelComma = false;
 	return token;
 }
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor.java
index 3b966b0..c28bee0 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor.java
@@ -178,7 +178,7 @@
 				return createRoleProposal(proposal);
 			case CompletionProposal.KEYWORD:
 				IJavaCompletionProposal result = base.createJavaCompletionProposal(proposal);
-				if (CharOperation.endsWith(proposal.getCompletion(), Keywords.WHEN)) {
+				if (CharOperation.endsWith(proposal.getCompletion(), Keywords.WHEN_PARENS)) {
 					// move cursor back by one (into '()') by reverse-engineering its current position:
 					JavaCompletionProposal jProposal = (JavaCompletionProposal)result;
 					Point cursor = jProposal.getSelection(null);