Fixed bug 371969: [assist] combination of edits in linked mode may
spoil callin completion 
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor/CreateMethodMappingCompletionProposal.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor/CreateMethodMappingCompletionProposal.java
index f153499..92318aa 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor/CreateMethodMappingCompletionProposal.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/CompletionAdaptor/CreateMethodMappingCompletionProposal.java
@@ -77,9 +77,6 @@
 		public MyJavaLinkedModeProposal(ICompilationUnit unit, ITypeBinding typeProposal, int relevance) {
 			base(unit, typeProposal, relevance);
 		}
-
-		TextEdit computeEdits(int offset, LinkedPosition position, char trigger, int stateMask, LinkedModeModel model) 
-		-> TextEdit computeEdits(int offset, LinkedPosition position, char trigger, int stateMask, LinkedModeModel model);
 	}
 
 
@@ -171,12 +168,20 @@
 			// return type:
 			ITrackedNodePosition returnTypePosition = null;
 			ITypeBinding returnType = method.getReturnType();
+			final boolean[] hasAppliedVoidReturn = new boolean[1];
 			if (!(returnType.isPrimitive() && "void".equals(returnType.getName()))) { //$NON-NLS-1$
 				returnTypePosition = rewrite.track(roleMethodSpec.getReturnType2());
 				addLinkedPosition(returnTypePosition, true, ROLEMETHODRETURN_KEY);
 				LinkedProposalPositionGroup group1 = getLinkedProposalModel().getPositionGroup(ROLEMETHODRETURN_KEY, true);
 				group1.addProposal(new MyJavaLinkedModeProposal(iCU, method.getReturnType(), 13));
-				group1.addProposal("void", null, 13);  //$NON-NLS-1$
+				group1.addProposal(new Proposal("void", null, 13) { //$NON-NLS-1$
+					@Override
+					public TextEdit computeEdits(int offset, LinkedPosition position, char trigger, int stateMask, LinkedModeModel model)
+							throws CoreException {
+						hasAppliedVoidReturn[0] = true;
+						return super.computeEdits(offset, position, trigger, stateMask, model);
+					}
+				});
 			}
 			
 			// role method name:
@@ -197,21 +202,21 @@
 				}
 				group2.addProposal(calloutToken, Images.getImage(CALLOUTBINDING_IMG), 13);
 			}
-			group2.addProposal(makeBeforeAfterBindingProposal("<- before", Images.getImage(CALLINBINDING_BEFORE_IMG), returnTypePosition));  //$NON-NLS-1$
+			group2.addProposal(makeBeforeAfterBindingProposal("<- before", Images.getImage(CALLINBINDING_BEFORE_IMG), returnTypePosition, hasAppliedVoidReturn));  //$NON-NLS-1$
 			group2.addProposal("<- replace", Images.getImage(CALLINBINDING_REPLACE_IMG), 13); //$NON-NLS-1$
-			group2.addProposal(makeBeforeAfterBindingProposal("<- after",  Images.getImage(CALLINBINDING_AFTER_IMG), returnTypePosition));   //$NON-NLS-1$
+			group2.addProposal(makeBeforeAfterBindingProposal("<- after",  Images.getImage(CALLINBINDING_AFTER_IMG), returnTypePosition, hasAppliedVoidReturn));   //$NON-NLS-1$
 		}
 		return true;	
 	}
 	/** Create a method-binding proposal that, when applied, will change the role-returntype to "void": */
-	Proposal makeBeforeAfterBindingProposal(String displayString, Image image, final ITrackedNodePosition returnTypePosition) {
+	Proposal makeBeforeAfterBindingProposal(String displayString, Image image, final ITrackedNodePosition returnTypePosition, final boolean[] hasAppliedVoidReturn) {
 		return new Proposal(displayString, image, 13) {
 			@Override
 			public TextEdit computeEdits(int offset, LinkedPosition position, char trigger, int stateMask, LinkedModeModel model)
 					throws CoreException 
 			{
 				MultiTextEdit edits = new MultiTextEdit();
-				if (returnTypePosition != null)
+				if (returnTypePosition != null && !hasAppliedVoidReturn[0])
 					edits.addChild(new ReplaceEdit(returnTypePosition.getStartPosition(), returnTypePosition.getLength(), "void")); //$NON-NLS-1$
 				edits.addChild(super.computeEdits(offset, position, trigger, stateMask, model));
 				return edits;
diff --git a/releng/map/otdt.map b/releng/map/otdt.map
index 2be6890..1ce7f20 100644
--- a/releng/map/otdt.map
+++ b/releng/map/otdt.map
@@ -31,7 +31,7 @@
 

 !** OT/J Plugins **!

 plugin@org.eclipse.objectteams.otequinox.branding,2.0.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otequinox.branding,tag=builds/201105161939

-plugin@org.eclipse.objectteams.otdt.jdt.ui,2.1.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.jdt.ui,tag=builds/201201311800

+plugin@org.eclipse.objectteams.otdt.jdt.ui,2.1.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.jdt.ui

 plugin@org.eclipse.objectteams.otdt.ui.help,2.1.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.ui.help,tag=builds/201108142105

 plugin@org.eclipse.objectteams.otdt.apt,2.0.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.apt,tag=builds/201105161939

 plugin@org.eclipse.objectteams.otdt.compiler.adaptor,2.1.0=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt.compiler.adaptor

diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
index 897b400..3964ba7 100644
--- a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
@@ -621,6 +621,22 @@
 				INTERESTING_CALLIN_CALLOUT_PROPOSAL);
 	}
 
+	// create callin with non-default selections in linked mode
+	// DISABLED because I'm yet to find a way for triggering linked mode selection in a test
+	public void _testCreateCallin2() throws Exception {
+		createBaseClass("    public String foo() {}\n");
+		assertTypeBodyProposal(
+				"        fo|", 
+				"foo(", 
+				        "\n" + // TODO(SH): initial newline is not intended?
+				"        /* (non-Javadoc)\n" +
+				"         * @see test1.B#foo()\n" +
+				"         */\n" +
+				"        |String| foo() <- before void foo();\n" +
+				"        ",
+				INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+	}
+
 	/* short, with callinModifier, follows: callout binding. */
 	public void testCompleteCallin2() throws Exception {
 		createBaseClass("    public void foo() {}\n");