String (TestType testType, Object[] documents) { Object document = documents[testType.getValue()]; if (document instanceof PlainDocument) { try { return ((PlainDocument)document).getText(0, ((PlainDocument)document).getLength()); } catch (BadLocationException e) { throw new RuntimeException(e); } } return ((com.intellij.openapi.editor.Document)document).getText(); }