Bug 25370 Linked Mode: Want to define where to focus
20021022 I added a new feature that starts the linked mode on all usages of a variable. e.g. int i; i= 1; i++; would link all 3 occurrences of i, so when edited, all 3 references are changed simultanously. Problem is that the liked mode does not allow me to set the focus (where to edit) to e.g. the 'i' in 'i++'. The linked mode only allows to edit the top most linked position ('int i'). The feature can be invoked on any reference. Jumping to the top not so ideal.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/link/LinkedPositionManager.java
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.IPositionUpdater;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.TypedPosition;
import org.eclipse.jface.util.Assert;
import org.eclipse.jdt.internal.ui.JavaPlugin;
/**
 * This class manages linked positions in a document. Positions are linked
 * by type names. If positions have the same type name, they are considered
 * as <em>linked</em>.
 * 
 * The manager remains active on a document until any of the following actions
 * occurs:
 * 
 * <ul>
 *   <li>A document change is performed which would invalidate any of the
 *       above constraints.</li>
 * 
 *   <li>The method <code>uninstall()</code> is called.</li>
 * 
 *   <li>Another instance of <code>LinkedPositionManager</code> tries to
 *       gain control of the same document.
 * </ul>
 */
public class LinkedPositionManager implements IDocumentListener, IPositionUpdater {