Search in sources :

Example 1 with PropertyExistException

use of com.sun.star.beans.PropertyExistException in project jabref by JabRef.

the class OpenOfficePanel method pushEntries.

private void pushEntries(boolean inParenthesisIn, boolean withText, boolean addPageInfo) {
    if (!ooBase.isConnectedToDocument()) {
        JOptionPane.showMessageDialog(frame, Localization.lang("Not connected to any Writer document. Please" + " make sure a document is open, and use the 'Select Writer document' button to connect to it."), Localization.lang("Error"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    Boolean inParenthesis = inParenthesisIn;
    String pageInfo = null;
    if (addPageInfo) {
        AdvancedCiteDialog citeDialog = new AdvancedCiteDialog(frame);
        citeDialog.showDialog();
        if (citeDialog.canceled()) {
            return;
        }
        if (!citeDialog.getPageInfo().isEmpty()) {
            pageInfo = citeDialog.getPageInfo();
        }
        inParenthesis = citeDialog.isInParenthesisCite();
    }
    BasePanel panel = frame.getCurrentBasePanel();
    if (panel != null) {
        final BibDatabase database = panel.getDatabase();
        List<BibEntry> entries = panel.getSelectedEntries();
        if (!entries.isEmpty() && checkThatEntriesHaveKeys(entries)) {
            try {
                if (style == null) {
                    style = loader.getUsedStyle();
                }
                ooBase.insertEntry(entries, database, getBaseList(), style, inParenthesis, withText, pageInfo, preferences.syncWhenCiting());
            } catch (FileNotFoundException ex) {
                JOptionPane.showMessageDialog(frame, Localization.lang("You must select either a valid style file, or use one of the default styles."), Localization.lang("No valid style file defined"), JOptionPane.ERROR_MESSAGE);
                LOGGER.warn("Problem with style file", ex);
            } catch (ConnectionLostException ex) {
                showConnectionLostErrorMessage();
            } catch (UndefinedCharacterFormatException ex) {
                reportUndefinedCharacterFormat(ex);
            } catch (UndefinedParagraphFormatException ex) {
                reportUndefinedParagraphFormat(ex);
            } catch (com.sun.star.lang.IllegalArgumentException | UnknownPropertyException | PropertyVetoException | CreationException | NoSuchElementException | WrappedTargetException | IOException | BibEntryNotFoundException | IllegalTypeException | PropertyExistException | NotRemoveableException ex) {
                LOGGER.warn("Could not insert entry", ex);
            }
        }
    }
}
Also used : BasePanel(org.jabref.gui.BasePanel) WrappedTargetException(com.sun.star.lang.WrappedTargetException) IllegalTypeException(com.sun.star.beans.IllegalTypeException) NotRemoveableException(com.sun.star.beans.NotRemoveableException) FileNotFoundException(java.io.FileNotFoundException) PropertyExistException(com.sun.star.beans.PropertyExistException) BibEntry(org.jabref.model.entry.BibEntry) IOException(java.io.IOException) UnknownPropertyException(com.sun.star.beans.UnknownPropertyException) PropertyVetoException(com.sun.star.beans.PropertyVetoException) BibDatabase(org.jabref.model.database.BibDatabase) UndefinedParagraphFormatException(org.jabref.logic.openoffice.UndefinedParagraphFormatException) NoSuchElementException(com.sun.star.container.NoSuchElementException)

Aggregations

IllegalTypeException (com.sun.star.beans.IllegalTypeException)1 NotRemoveableException (com.sun.star.beans.NotRemoveableException)1 PropertyExistException (com.sun.star.beans.PropertyExistException)1 PropertyVetoException (com.sun.star.beans.PropertyVetoException)1 UnknownPropertyException (com.sun.star.beans.UnknownPropertyException)1 NoSuchElementException (com.sun.star.container.NoSuchElementException)1 WrappedTargetException (com.sun.star.lang.WrappedTargetException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 BasePanel (org.jabref.gui.BasePanel)1 UndefinedParagraphFormatException (org.jabref.logic.openoffice.UndefinedParagraphFormatException)1 BibDatabase (org.jabref.model.database.BibDatabase)1 BibEntry (org.jabref.model.entry.BibEntry)1