Java Code Examples for org.eclipse.jface.text.IDocumentExtension4#getModificationStamp()
The following examples show how to use
org.eclipse.jface.text.IDocumentExtension4#getModificationStamp() .
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: DocCopy.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public DocCopy(IDocument document) { this.contents = document.get(); this.document = document; categoryToPos = new HashMap<>(); String[] positionCategories = document.getPositionCategories(); for (String string : positionCategories) { try { categoryToPos.put(string, document.getPositions(string)); } catch (BadPositionCategoryException e) { Log.log(e); } } IDocumentExtension4 doc4 = (IDocumentExtension4) document; modificationStamp = doc4.getModificationStamp(); }
Example 2
Source File: AbstractThemeableEditor.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public ParseResult getParseResult() { try { IDocument document = getDocument(); if (document == null) { return null; } long modificationStamp = IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP; if (document instanceof IDocumentExtension4) { synchronized (modificationStampLock) { IDocumentExtension4 iDocumentExtension = (IDocumentExtension4) document; modificationStamp = iDocumentExtension.getModificationStamp(); if (modificationStamp != IDocumentExtension4.UNKNOWN_MODIFICATION_STAMP && modificationStamp == lastModificationStamp) { return lastAstForModificationStamp; } } } // Don't synchronize the actual parse! ParseResult ast = doGetAST(document); synchronized (modificationStampLock) { lastAstForModificationStamp = ast; lastModificationStamp = modificationStamp; return lastAstForModificationStamp; } } catch (Throwable e) { IdeLog.logTrace(CommonEditorPlugin.getDefault(), e.getMessage(), e, IDebugScopes.AST); } return null; }
Example 3
Source File: ScopeSelectionAction.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private static String getCurrentSelectionCacheKey(BaseEditor pyEdit) { IDocument doc = pyEdit.getDocument(); int length = doc.getLength(); String key = Integer.toString(length); if (doc instanceof IDocumentExtension4) { IDocumentExtension4 document = (IDocumentExtension4) doc; long modificationStamp = document.getModificationStamp(); key += " - " + modificationStamp; } return key; }
Example 4
Source File: OrganizeImportsFixesUnused.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public boolean beforePerformArrangeImports(PySelection ps, PyEdit edit, IFile f) { int oldSelection = ps.getRegion().getOffset(); IDocumentExtension4 doc = (IDocumentExtension4) ps.getDoc(); if (edit != null) { if (!ensureParsed(edit)) { return true; } //Check that the editor time is actually the same as the document time. long docTime = doc.getModificationStamp(); if (docTime != edit.getAstModificationTimeStamp()) { return true; } ErrorDescription errorDescription = edit.getErrorDescription(); if (errorDescription != null) { return true; //Don't remove unused imports if we have syntax errors. } } try { findAndDeleteUnusedImports(ps, edit, doc, f); } catch (Exception e) { Log.log(e); } ps.setSelection(oldSelection, oldSelection); return true; }