/** * 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); }
/** * 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); }
/** * Sets up a simple linked mode at {@link #getCursorPosition()} and an exit policy that will * exit the mode when <code>closingCharacter</code> is typed and an exit position at * <code>getCursorPosition() + 1</code>. * * @param document the document */ protected void setUpLinkedMode(IDocument document) { try { LinkedPositionGroup group= new LinkedPositionGroup(); group.addPosition(new LinkedPosition(document, getSelectionStart(), getSelectionLength(), LinkedPositionGroup.NO_STOP)); LinkedModeModel model= new LinkedModeModel(); model.addGroup(group); model.forceInstall(); LinkedModeUI ui= new LinkedModeUI(model, viewer); // ui.setSimpleMode(true); ui.setExitPolicy(new ExitPolicy(exitChars)); ui.setExitPosition(viewer, getCursorPosition() + getReplacementOffset(), 0, Integer.MAX_VALUE); ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER); ui.enter(); } catch (BadLocationException e) { log.info(e.getMessage(), e); } }
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setDoContextInfo(true);
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setDoContextInfo(true);
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setDoContextInfo(true);
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setDoContextInfo(true);
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setDoContextInfo(true);
ui.setSimpleMode(true); ui.setExitPolicy(new ExitPolicy(closingCharacter, document)); ui.setExitPosition(getTextViewer(), exit, 0, Integer.MAX_VALUE); ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER); ui.enter();
/** * Sets up a simple linked mode at {@link #getCursorPosition()} and an exit policy that will * exit the mode when <code>closingCharacter</code> is typed and an exit position at * <code>getCursorPosition() + 1</code>. * * @param document the document * @param closingCharacter the exit character */ protected void setUpLinkedMode(IDocument document, char closingCharacter) { if (getTextViewer() != null && autocloseBrackets()) { int offset= getReplacementOffset() + getCursorPosition(); int exit= getReplacementOffset() + getReplacementString().length(); try { LinkedPositionGroup group= new LinkedPositionGroup(); group.addPosition(new LinkedPosition(document, offset, 0, LinkedPositionGroup.NO_STOP)); LinkedModeModel model= new LinkedModeModel(); model.addGroup(group); model.forceInstall(); LinkedModeUI ui= new EditorLinkedModeUI(model, getTextViewer()); ui.setSimpleMode(true); ui.setExitPolicy(new ExitPolicy(closingCharacter, document)); ui.setExitPosition(getTextViewer(), exit, 0, Integer.MAX_VALUE); ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER); ui.enter(); } catch (BadLocationException x) { JavaPlugin.log(x); } } }
/** * Sets up a simple linked mode at {@link #getCursorPosition()} and an exit policy that will * exit the mode when <code>closingCharacter</code> is typed and an exit position at * <code>getCursorPosition() + 1</code>. * * @param document the document * @param closingCharacter the exit character */ protected void setUpLinkedMode(IDocument document, char closingCharacter) { if (getTextViewer() != null && autocloseBrackets()) { int offset= getReplacementOffset() + getCursorPosition(); int exit= getReplacementOffset() + getReplacementString().length(); try { LinkedPositionGroup group= new LinkedPositionGroup(); group.addPosition(new LinkedPosition(document, offset, 0, LinkedPositionGroup.NO_STOP)); LinkedModeModel model= new LinkedModeModel(); model.addGroup(group); model.forceInstall(); LinkedModeUI ui= new EditorLinkedModeUI(model, getTextViewer()); ui.setSimpleMode(true); ui.setExitPolicy(new ExitPolicy(closingCharacter, document)); ui.setExitPosition(getTextViewer(), exit, 0, Integer.MAX_VALUE); ui.setCyclingMode(LinkedModeUI.CYCLE_NEVER); ui.enter(); } catch (BadLocationException x) { JavaPlugin.log(x); } } }
ui.setExitPolicy(new ExitPolicy(document)); if (currentPosition.includes(originalSelection.x)) ui.setExitPosition(viewer, originalSelection.x, 0, Integer.MAX_VALUE); ui.enter(); if (currentPosition.includes(originalSelection.x)
ui.setExitPosition(getTextViewer(), replacementOffset + replacementString.length(), 0, Integer.MAX_VALUE); ui.setDoContextInfo(true); ui.enter();
ui.setExitPosition(getTextViewer(), replacementOffset + replacementString.length(), 0, Integer.MAX_VALUE); ui.setDoContextInfo(true); ui.enter();
ui.setExitPosition(getTextViewer(), replacementOffset + replacementString.length(), 0, Integer.MAX_VALUE); ui.setDoContextInfo(true); ui.enter();
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setCyclingMode(LinkedModeUI.CYCLE_WHEN_NO_PARENT);
model.addLinkingListener(new EditorSynchronizer(fEditor)); LinkedModeUI ui = new EditorLinkedModeUI(model, viewer); ui.setExitPosition(viewer, offset, 0, Integer.MAX_VALUE); ui.enter(); viewer.setSelectedRange(offset, 0);
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setCyclingMode(LinkedModeUI.CYCLE_WHEN_NO_PARENT);
ui.setExitPosition(getTextViewer(), baseOffset + replacement.length(), 0, Integer.MAX_VALUE); ui.setExitPolicy(new ExitPolicy(')', document)); ui.setCyclingMode(LinkedModeUI.CYCLE_WHEN_NO_PARENT);
ui.setExitPosition(viewer, offset, 0, LinkedPositionGroup.NO_STOP); ui.enter();