void () { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { Document doc = editor.getDocument(); doc.startGuardedBlockChecking(); try { doc.deleteString(editor.myDraggedRange.getStartOffset(), editor.myDraggedRange.getEndOffset()); } catch (ReadOnlyFragmentModificationException e) { EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e); } finally { doc.stopGuardedBlockChecking(); } } }); }