Search in sources :

Example 1 with XEnumeration

use of com.sun.star.container.XEnumeration in project jabref by JabRef.

the class OOBibBase method getTextDocuments.

private List<XTextDocument> getTextDocuments() throws NoSuchElementException, WrappedTargetException {
    List<XTextDocument> result = new ArrayList<>();
    XEnumerationAccess enumAccess = xDesktop.getComponents();
    XEnumeration componentEnumeration = enumAccess.createEnumeration();
    while (componentEnumeration.hasMoreElements()) {
        Object nextElement = componentEnumeration.nextElement();
        XComponent component = UnoRuntime.queryInterface(XComponent.class, nextElement);
        XTextDocument document = UnoRuntime.queryInterface(XTextDocument.class, component);
        if (document != null) {
            result.add(document);
        }
    }
    return result;
}
Also used : XTextDocument(com.sun.star.text.XTextDocument) XComponent(com.sun.star.lang.XComponent) ArrayList(java.util.ArrayList) XEnumeration(com.sun.star.container.XEnumeration) XEnumerationAccess(com.sun.star.container.XEnumerationAccess)

Aggregations

XEnumeration (com.sun.star.container.XEnumeration)1 XEnumerationAccess (com.sun.star.container.XEnumerationAccess)1 XComponent (com.sun.star.lang.XComponent)1 XTextDocument (com.sun.star.text.XTextDocument)1 ArrayList (java.util.ArrayList)1