/** * Sets the exit position to move the caret to when linked mode mode is * exited. * * @param target the target where the exit position is located * @param offset the offset of the exit position * @param length the length of the exit position (in case there should be a * selection) * @param sequence set to the tab stop position of the exit position, or * <code>LinkedPositionGroup.NO_STOP</code> if there should be no * tab stop. * @throws BadLocationException if the position is not valid in the viewer's * document */ public void setExitPosition(LinkedModeUITarget target, int offset, int length, int sequence) throws BadLocationException { // remove any existing exit position if (fExitPosition != null) { fExitPosition.getDocument().removePosition(fExitPosition); fIterator.removePosition(fExitPosition); fExitPosition= null; } IDocument doc= target.getViewer().getDocument(); if (doc == null) return; fExitPosition= new LinkedPosition(doc, offset, length, sequence); doc.addPosition(fExitPosition); // gets removed in leave() if (sequence != LinkedPositionGroup.NO_STOP) fIterator.addPosition(fExitPosition); }
/** * Sets the exit position to move the caret to when linked mode mode is * exited. * * @param target the target where the exit position is located * @param offset the offset of the exit position * @param length the length of the exit position (in case there should be a * selection) * @param sequence set to the tab stop position of the exit position, or * <code>LinkedPositionGroup.NO_STOP</code> if there should be no * tab stop. * @throws BadLocationException if the position is not valid in the viewer's * document */ public void setExitPosition(LinkedModeUITarget target, int offset, int length, int sequence) throws BadLocationException { // remove any existing exit position if (fExitPosition != null) { fExitPosition.getDocument().removePosition(fExitPosition); fIterator.removePosition(fExitPosition); fExitPosition= null; } IDocument doc= target.getViewer().getDocument(); if (doc == null) return; fExitPosition= new LinkedPosition(doc, offset, length, sequence); doc.addPosition(fExitPosition); // gets removed in leave() if (sequence != LinkedPositionGroup.NO_STOP) fIterator.addPosition(fExitPosition); }