void next() { if (fIterator.hasNext(fFramePosition)) { switchPosition(fIterator.next(fFramePosition), true, true); return; } leave(ILinkedModeListener.UPDATE_CARET); }
void previous() { if (fIterator.hasPrevious(fFramePosition)) { switchPosition(fIterator.previous(fFramePosition), true, true); } else // dont't update caret, but rather select the current frame leave(ILinkedModeListener.SELECT); }
/** * Convenience constructor for just one viewer. * * @param model the linked mode model * @param viewer the viewer upon which the linked mode UI should act */ public LinkedModeUI(LinkedModeModel model, ITextViewer viewer) { constructor(model, new LinkedModeUITarget[]{new EmptyTarget(viewer)}); }
private boolean controlUndoBehavior(int offset, int length) { LinkedPosition position= fModel.findPosition(new LinkedPosition(fCurrentTarget.getViewer().getDocument(), offset, length, LinkedPositionGroup.NO_STOP)); if (position != null) { // if the last position is not the same and there is an open change: close it. if (!position.equals(fPreviousPosition)) endCompoundChangeIfNeeded(); beginCompoundChangeIfNeeded(); } fPreviousPosition= position; return fPreviousPosition != null; }
/** * Sets the exit position to move the caret to when linked mode is exited. * * @param viewer the viewer 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(ITextViewer viewer, int offset, int length, int sequence) throws BadLocationException { setExitPosition(new EmptyTarget(viewer), offset, length, sequence); }
@Override public ExitFlags doExit(LinkedModeModel model, VerifyEvent event, int offset, int length) { if (event.character == '=') { return new ExitFlags(ILinkedModeListener.EXIT_ALL, true); } return null; } }
/** * Creates a new UI on the given model and the set of viewers. The model * must provide a tab stop sequence with a non-empty list of tab stops. * * @param model the linked mode model * @param targets the non-empty list of targets upon which the linked mode * UI should act */ public LinkedModeUI(LinkedModeModel model, LinkedModeUITarget[] targets) { constructor(model, targets); }
@Override public void left(LinkedModeModel model, int flags) { leave(ILinkedModeListener.EXIT_ALL | flags); }
/** * Creates a new instance, with no sequence number. * * @param document the document * @param offset the offset of the position * @param length the length of the position * @param proposals the proposals to be shown when entering this position */ public ProposalPosition(IDocument document, int offset, int length, ICompletionProposal[] proposals) { super(document, offset, length, LinkedPositionGroup.NO_STOP); fProposals= copy(proposals); }
/** * Cancels any linked mode model on the specified document. If there is no * model, nothing happens. * * @param document the document whose <code>LinkedModeModel</code> should * be canceled */ public static void closeAllModels(IDocument document) { LinkedModeManager.cancelManager(document); }
private void redraw() { if (fCurrentTarget.fAnnotationModel != null) fCurrentTarget.fAnnotationModel.switchToPosition(fModel, fFramePosition); }
/** * Returns whether there exists a <code>LinkedModeManager</code> on any of the <code>documents</code>. * * @param documents the documents of interest * @return <code>true</code> if there exists a <code>LinkedModeManager</code> on any of the <code>documents</code>, <code>false</code> otherwise */ public static boolean hasManager(IDocument[] documents) { for (int i= 0; i < documents.length; i++) { if (hasManager(documents[i])) return true; } return false; }
@Override public void proposalChosen(ICompletionProposal proposal) { next(); } }
private boolean controlUndoBehavior(int offset, int length) { LinkedPosition position= fModel.findPosition(new LinkedPosition(fCurrentTarget.getViewer().getDocument(), offset, length, LinkedPositionGroup.NO_STOP)); if (position != null) { // if the last position is not the same and there is an open change: close it. if (!position.equals(fPreviousPosition)) endCompoundChangeIfNeeded(); beginCompoundChangeIfNeeded(); } fPreviousPosition= position; return fPreviousPosition != null; }
void next() { if (fIterator.hasNext(fFramePosition)) { switchPosition(fIterator.next(fFramePosition), true, true); return; } leave(ILinkedModeListener.UPDATE_CARET); }
void previous() { if (fIterator.hasPrevious(fFramePosition)) { switchPosition(fIterator.previous(fFramePosition), true, true); } else // dont't update caret, but rather select the current frame leave(ILinkedModeListener.SELECT); }
/** * Convenience constructor for just one viewer. * * @param model the linked mode model * @param viewer the viewer upon which the linked mode UI should act */ public LinkedModeUI(LinkedModeModel model, ITextViewer viewer) { constructor(model, new LinkedModeUITarget[]{new EmptyTarget(viewer)}); }
/** * Convenience constructor for one target. * * @param model the linked mode model * @param target the target upon which the linked mode UI should act */ public LinkedModeUI(LinkedModeModel model, LinkedModeUITarget target) { constructor(model, new LinkedModeUITarget[]{target}); }
@Override public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { leave(ILinkedModeListener.EXIT_ALL); }
/** * Convenience constructor for one target. * * @param model the linked mode model * @param target the target upon which the linked mode UI should act */ public LinkedModeUI(LinkedModeModel model, LinkedModeUITarget target) { constructor(model, new LinkedModeUITarget[]{target}); }