Bug 52361 [templates] linked mode not exited / annotations not redrawn when inserting anonymous completion
M7 0. Auto-closed parenthesis on 1. Insert this code: import java.lang.Runnable; void m() { method(<caret> } -> closing parenthesis gets inserted -> linked mode entered 2. type "new Runnable(" -> nested linked mode is entered for second parenthesis, also autoclosed 3. use code completion to complete the anonymous type -> you end up with this code: void m() { method(new Runnable() { public void run() { } }) } -> Linked mode is still drawn 4. Press <Tab> or <Enter> -> linked mode is not exited -> annotations keep being drawn The only way to get away with the annotations is to open a new parenthesis somewhere outside the initial code.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedUIControl.java
/**
		 * Returns the viewer represented by this target, never <code>null</code>.
		 * 
		 * @return the viewer associated with this target.
		 */
		abstract ITextViewer getViewer();
		/**
		 * Called by the linked UI when this target is being shown. An
		 * implementation could for example ensure that the corresponding
		 * editor is showing.
		 */
		abstract void enter();
		
		/**
		 * The viewer's text widget is initialized when the UI first connects
		 * to the viewer and never changed thereafter. This is to keep the
		 * reference of the widget that we have registered our listeners with,
		 * as the viewer, when it gets disposed, does not remember it, resulting
		 * in a situation where we cannot uninstall the listeners and a memory leak.
		 */
		StyledText fWidget;
		
		
		Shell fShell;
		
		
		LinkedUIKeyListener fKeyListener;