Skip to content

Commit

Permalink
Fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Dec 28, 2017
1 parent ba1f07f commit 6a61a12
Showing 1 changed file with 16 additions and 24 deletions.
40 changes: 16 additions & 24 deletions src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,7 @@ public class LinkedFileViewModel extends AbstractViewModel {
private final DoubleProperty downloadProgress = new SimpleDoubleProperty(-1);
private final BooleanProperty downloadOngoing = new SimpleBooleanProperty(false);
private final BooleanProperty isAutomaticallyFound = new SimpleBooleanProperty(false);

public boolean isCanWriteXMPMetadata() {
return canWriteXMPMetadata.get();
}

public BooleanProperty canWriteXMPMetadataProperty() {
return canWriteXMPMetadata;
}

private final BooleanProperty canWriteXMPMetadata = new SimpleBooleanProperty(false);

private final DialogService dialogService = new FXDialogService();
private final BibEntry entry;
private final TaskExecutor taskExecutor;
Expand All @@ -78,6 +68,10 @@ public LinkedFileViewModel(LinkedFile linkedFile, BibEntry entry, BibDatabaseCon
canWriteXMPMetadata.setValue(!linkedFile.isOnlineLink() && linkedFile.getFileType().equalsIgnoreCase("pdf"));
}

public BooleanProperty canWriteXMPMetadataProperty() {
return canWriteXMPMetadata;
}

public boolean isAutomaticallyFound() {
return isAutomaticallyFound.get();
}
Expand Down Expand Up @@ -311,32 +305,30 @@ public boolean delete() {
LOGGER.warn("Could not find file " + linkedFile.getLink());
}
return true;

}

public void edit() {
FileListEntryEditor editor = new FileListEntryEditor(linkedFile, false, true, databaseContext);
SwingUtilities.invokeLater(() -> editor.setVisible(true, false));

}

public void writeXMPMetadata() {
// Localization.lang("Writing XMP-metadata...")
BackgroundTask<Void> writeTask = BackgroundTask.wrap(() -> {
Optional<Path> file = linkedFile.findIn(databaseContext, Globals.prefs.getFileDirectoryPreferences());
if (!file.isPresent()) {
Optional<Path> file = linkedFile.findIn(databaseContext, Globals.prefs.getFileDirectoryPreferences());
if (!file.isPresent()) {
// TODO: Print error message
// Localization.lang("PDF does not exist");
} else {
try {
XMPUtil.writeXMP(file.get(), entry, databaseContext.getDatabase(), Globals.prefs.getXMPPreferences());
} catch (IOException | TransformerException ex) {
// TODO: Print error message
// Localization.lang("PDF does not exist");
} else {
try {
XMPUtil.writeXMP(file.get(), entry, databaseContext.getDatabase(), Globals.prefs.getXMPPreferences());
} catch (IOException | TransformerException ex) {
// TODO: Print error message
// Localization.lang("Error while writing") + " '" + file.toString() + "': " + ex;
}
// Localization.lang("Error while writing") + " '" + file.toString() + "': " + ex;
}
return null;
});
}
return null;
});

// Localization.lang("Finished writing XMP-metadata.")

Expand Down

0 comments on commit 6a61a12

Please sign in to comment.