return;
}
Utils.runSafeSWTSync(log, new Runnable() {
public void run() {
ITextViewerExtension textViewer = (ITextViewerExtension) EditorAPI
.getViewer(editorPart);
if (textViewer == null)
return;
boolean isEditable = !lockedEditors.contains(editorPart);
// Already as we want it?
if (newIsEditable == isEditable)
return;
log.trace(editorPart.getEditorInput().getName()
+ " set to editable: " + newIsEditable);
updateStatusLine(editorPart, newIsEditable);
if (newIsEditable) {
lockedEditors.remove(editorPart);
textViewer
.removeVerifyKeyListener(EditorAPI.this.keyVerifier);
// enable editing and undo-manager
SourceViewer sourceViewer = (SourceViewer) textViewer;
sourceViewer.setEditable(true);
// TODO use undoLevel from Preferences (TextEditorPlugin)
sourceViewer.getUndoManager().setMaximalUndoLevel(200);
} else {
lockedEditors.add(editorPart);
textViewer
.prependVerifyKeyListener(EditorAPI.this.keyVerifier);
// disable editing and undo-manager
SourceViewer sourceViewer = (SourceViewer) textViewer;
sourceViewer.setEditable(false);