Java Code Examples for org.eclipse.jface.text.IDocument#containsPositionCategory()
The following examples show how to use
org.eclipse.jface.text.IDocument#containsPositionCategory() .
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: TecoRegister.java From e4macs with Eclipse Public License 1.0 | 6 votes |
public void partClosed(IWorkbenchPartReference partRef) { if (partRef instanceof IEditorReference) { IEditorPart epart = ((IEditorReference) partRef).getEditor(false); ITextEditor editor = (location != null ? location.getEditor() : null); if (editor == EmacsPlusUtils.getTextEditor(epart, false)) { RegisterLocation loc = location; // we're out of here removeListener(this); IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput()); // remove position category, if still present if (document.containsPositionCategory(MarkRing.MARK_CATEGORY)) { try { document.removePositionUpdater(MarkRing.updater); document.removePositionCategory(MarkRing.MARK_CATEGORY); } catch (BadPositionCategoryException e) { } } // convert to path loc.setPath(convertToPath(editor)); } } }
Example 2
Source File: AbstractTemplateProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Positions created for template contexts have to be added to the document so they are updated when the document * is modified. * * @since 2.8 */ protected Position createPosition(ContentAssistContext context) { Position position = new Position(context.getReplaceRegion().getOffset(), context.getReplaceRegion().getLength()); IDocument document = context.getDocument(); if (document.containsPositionCategory(XTEXT_TEMPLATE_POS_CATEGORY)) { try { document.addPosition(XTEXT_TEMPLATE_POS_CATEGORY, position); } catch (Exception e) { log.error(e.getMessage(), e); } } return position; }
Example 3
Source File: TypeScriptCompletionProposal.java From typescript.java with MIT License | 5 votes |
private void ensurePositionCategoryRemoved(IDocument document) { if (document.containsPositionCategory(getCategory())) { try { document.removePositionCategory(getCategory()); } catch (BadPositionCategoryException e) { // ignore } document.removePositionUpdater(fUpdater); } }
Example 4
Source File: SnippetTemplateProposal.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void ensurePositionCategoryRemoved(IDocument document) { if (document.containsPositionCategory(getCategory())) { try { document.removePositionCategory(getCategory()); } catch (BadPositionCategoryException e) { // ignore } document.removePositionUpdater(fUpdater); } }
Example 5
Source File: ParameterGuessingProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void ensurePositionCategoryRemoved(IDocument document) { if (document.containsPositionCategory(getCategory())) { try { document.removePositionCategory(getCategory()); } catch (BadPositionCategoryException e) { // ignore } document.removePositionUpdater(fUpdater); } }
Example 6
Source File: TemplateProposal.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void ensurePositionCategoryRemoved(IDocument document) { if (document.containsPositionCategory(getCategory())) { try { document.removePositionCategory(getCategory()); } catch (BadPositionCategoryException e) { // ignore } document.removePositionUpdater(fUpdater); } }
Example 7
Source File: MarkRing.java From e4macs with Eclipse Public License 1.0 | 5 votes |
/** * Remove the document's mark buffer from the local Mark list * Also, remove the position updating information from the document * * @param document */ static void removeMarks(IDocument document) { MarkList local = localMarks.remove(document); if (local != null || document.containsPositionCategory(MARK_CATEGORY)) { document.removePositionUpdater(updater); try { // this also removes all the positions document.removePositionCategory(MARK_CATEGORY); } catch (BadPositionCategoryException e) { } } }
Example 8
Source File: SemanticHighlightingReconciler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
public List<HighlightedPositionCore> reconciled(IDocument document, ASTNode ast, boolean forced, IProgressMonitor progressMonitor) throws BadPositionCategoryException { // ensure at most one thread can be reconciling at any time synchronized (fReconcileLock) { if (fIsReconciling) { return emptyList(); } else { fIsReconciling= true; } } fJobPresenter= fPresenter; fJobSemanticHighlightings= fSemanticHighlightings; fJobHighlightings= fHighlightings; try { if (ast == null) { return emptyList(); } ASTNode[] subtrees= getAffectedSubtrees(ast); if (subtrees.length == 0) { return emptyList(); } startReconcilingPositions(); if (!fJobPresenter.isCanceled()) { fJobDeprecatedMemberHighlighting= null; for (int i= 0, n= fJobSemanticHighlightings.length; i < n; i++) { SemanticHighlightingCore semanticHighlighting= fJobSemanticHighlightings[i]; if (semanticHighlighting instanceof DeprecatedMemberHighlighting) { fJobDeprecatedMemberHighlighting = fJobHighlightings.get(i); break; } } reconcilePositions(subtrees); } // We need to manually install the position category if (!document.containsPositionCategory(fPresenter.getPositionCategory())) { document.addPositionCategory(fPresenter.getPositionCategory()); } updatePresentation(document, fAddedPositions, fRemovedPositions); stopReconcilingPositions(); Position[] positions = document.getPositions(fPresenter.getPositionCategory()); for (Position position : positions) { Preconditions.checkState(position instanceof HighlightedPositionCore); } return FluentIterable.from(Arrays.asList(positions)).filter(HighlightedPositionCore.class).toList(); } finally { fJobPresenter= null; fJobSemanticHighlightings= null; fJobHighlightings= null; fJobDeprecatedMemberHighlighting= null; synchronized (fReconcileLock) { fIsReconciling= false; } } }