.getEditorReferences();
for (int i = 0; i < editors.length; i++) {
IEditorReference editorReference = editors[i];
IEditorPart editor = editorReference.getEditor(false);
if (editor instanceof PHPStructuredEditor) {
PHPStructuredEditor phpEditor = (PHPStructuredEditor) editor;
boolean isDirty = phpEditor.isDirty();
if (phpEditor.getTextViewer() instanceof PHPStructuredTextViewer) {
PHPStructuredTextViewer textViewer = (PHPStructuredTextViewer) phpEditor
.getTextViewer();
IDocumentAdapter documentAdapter = textViewer
.getDocumentAdapter();
IDocument document = phpEditor.getDocument();
String content = document.get();
if (documentAdapter != null) {
documentAdapter.replaceTextRange(0, content.length(),
""); //$NON-NLS-1$
documentAdapter.replaceTextRange(0, 0, content);
}
}
if (!isDirty) {
phpEditor.doSave(null);
}
}
}
}