}
public void beforeChange(IDoc doc) {
final IFile virtualFile = doc.getVirtualFile();
final String path = virtualFile.getPath();
final Buf bufByPath = state.getBufByPath(path);
if (bufByPath == null) {
return;
}
String msg;
if (state.readOnly) {
msg = "This document is readonly because you don't have edit permission in the workspace.";
} else if (!bufByPath.isPopulated()) {
msg = "This document is temporarily readonly while we fetch a fresh copy.";
} else {
return;
}
context.statusMessage(msg);
doc.setReadOnly(true);
IFactory.readOnlyBufferIds.add(bufByPath.path);
final String text = doc.getText();
context.setTimeout(0, new Runnable() {
@Override
public void run() {
context.writeThread(new Runnable() {
@Override
public void run() {
if (!state.readOnly && bufByPath.isPopulated()) {
return;
}
synchronized (context) {
try {
context.setListener(false);