Java Code Examples for org.eclipse.jface.text.link.LinkedModeModel#closeAllModels()
The following examples show how to use
org.eclipse.jface.text.link.LinkedModeModel#closeAllModels() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMLAttributeProposal.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Special code added to allow tabstop positions so we can easily tab past the quotes for Events/Attributes. */ @Override public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) { super.apply(viewer, trigger, stateMask, offset); // See if there are any positions that should be linked. Last is always exit, first is cursor position if (_positions != null && _positions.length > 0) { IDocument document = viewer.getDocument(); boolean validPrefix = isValidPrefix(getPrefix(document, offset), getDisplayString()); int shift = (validPrefix) ? offset - this._replacementOffset : 0; try { LinkedModeModel.closeAllModels(document); // Exit out of any existing linked mode LinkedModeModel model = new LinkedModeModel(); int i = 0; for (int pos : _positions) { LinkedPositionGroup group = new LinkedPositionGroup(); group.addPosition(new LinkedPosition(document, (offset - shift) + pos, 0, i++)); model.addGroup(group); } model.forceInstall(); LinkedModeUI ui = new LinkedModeUI(model, viewer); ui.setCyclingMode(LinkedModeUI.CYCLE_ALWAYS); ui.setExitPosition(viewer, (offset - shift) + _positions[_positions.length - 1], 0, Integer.MAX_VALUE); ui.enter(); } catch (BadLocationException e) { IdeLog.logError(XMLPlugin.getDefault(), e); } } }
Example 2
Source File: AttributeOrEventProposal.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Special code added to allow tabstop positions so we can easily tab past the quotes for Events/Attributes. */ @Override public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) { super.apply(viewer, trigger, stateMask, offset); // See if there are any positions that should be linked. Last is always exit, first is cursor position if (_positions != null && _positions.length > 0) { IDocument document = viewer.getDocument(); boolean validPrefix = isValidPrefix(getPrefix(document, offset), getDisplayString()); int shift = (validPrefix) ? offset - this._replacementOffset : 0; try { LinkedModeModel.closeAllModels(document); // Exit out of any existing linked mode LinkedModeModel model = new LinkedModeModel(); int i = 0; for (int pos : _positions) { LinkedPositionGroup group = new LinkedPositionGroup(); group.addPosition(new LinkedPosition(document, (offset - shift) + pos, 0, i++)); model.addGroup(group); } model.forceInstall(); LinkedModeUI ui = new LinkedModeUI(model, viewer); ui.setCyclingMode(LinkedModeUI.CYCLE_ALWAYS); ui.setExitPosition(viewer, (offset - shift) + _positions[_positions.length - 1], 0, Integer.MAX_VALUE); ui.enter(); } catch (BadLocationException e) { IdeLog.logError(HTMLPlugin.getDefault(), e); } } }
Example 3
Source File: AnonymousTypeCompletionProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public void apply(IDocument document, char trigger, int offset) { super.apply(document, trigger, offset); LinkedModeModel.closeAllModels(document); }