ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager()
.getTextFileBuffer(file.getFullPath(), LocationKind.NORMALIZE);
if (buffer != null && buffer.isDirty() && buffer.isStateValidated()
&& buffer.isSynchronized()) {
pm.beginTask("", 2); //$NON-NLS-1$
buffer.commit(new SubProgressMonitor(pm, 1), false);
file.refreshLocal(IResource.DEPTH_ONE,
new SubProgressMonitor(pm, 1));
pm.done();
} else {
pm.beginTask("", 1); //$NON-NLS-1$