AttributedCharacterIterator (final int beginIndex, final int endIndex, final AttributedCharacterIterator.Attribute[] attributes) { if (ApplicationManager.getApplication().isDispatchThread()) { return myDelegate.getCommittedText(beginIndex, endIndex, attributes); } final AttributedCharacterIterator[] r = new AttributedCharacterIterator[1]; try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { r[0] = myDelegate.getCommittedText(beginIndex, endIndex, attributes); } }); } catch (InterruptedException e) { LOG.error(e); } catch (InvocationTargetException e) { LOG.error(e); } return r[0]; }