/** Does the CppFile record need updating? */ public boolean needsUpdate(final Document doc) { final long documentTimestamp = org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentTimestamp(doc); return documentTimestamp != version; }
@Override public void run() { try { version = org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentTimestamp(doc); final int length = doc.getLength(); char[] buf = new char[length]; DocumentUtilities.copyText(doc, 0, length, buf, 0); res[0] = buf; } catch( BadLocationException e ) { res[1] = e; } } });
private boolean resetLastModified() { final long documentTimestamp = org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentTimestamp(doc); if (documentTimestamp != lastModified) { lastModified = documentTimestamp; clearLineCache(); return true; } return false; }
@Override public void run() { try { final int length = doc.getLength(); char[] buf = new char[length]; org.netbeans.editor.DocumentUtilities.copyText(doc, 0, length, buf, 0); long timeStamp = org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentTimestamp(doc); out.set(new FileBufferSnapshot(fileSystem, absPath, bufType, buf, null, timeStamp)); } catch (BadLocationException e) { exc.set(e); } } });
@Override public long lastModified() { Document doc = getDocument(); if (doc != null) { final long documentTimestamp = org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentTimestamp(doc); return documentTimestamp; } else { return getFileObject().lastModified().getTime(); } }
@Override protected final Long isDirty() { final FileObject file = getHandle().resolveFileObject(false); if (file == null) { return null; } final Source source = Source.create(file); if (source != null) { Document doc = source.getDocument(false); if (doc != null) { return DocumentUtilities.getDocumentTimestamp(doc); } } return null; }