Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
///usr/bin/env jbang "$0" "$@" ; exit $?

//JAVA 24
//RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED

Expand Down
3 changes: 0 additions & 3 deletions build-support/src/main/java/JournalListMvGenerator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
///usr/bin/env jbang "$0" "$@" ; exit $?

//JAVA 24
//RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED

Expand Down Expand Up @@ -44,7 +42,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/// Has to be started in the root of the repository due to <https://github.com/jbangdev/jbang-gradle-plugin/issues/11>
public class JournalListMvGenerator {

Expand Down
2 changes: 0 additions & 2 deletions build-support/src/main/java/LtwaListMvGenerator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
///usr/bin/env jbang "$0" "$@" ; exit $?

//JAVA 24
//RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED

Expand Down
6 changes: 4 additions & 2 deletions config/IntelliJ Code Style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<option name="SOFT_MARGINS" value="120" />
<option name="DO_NOT_FORMAT">
<list>
<fileSet type="globPattern" pattern=".jbang/*.java" />
<fileSet type="globPattern" pattern=".jbang/*.java" />
<fileSet type="globPattern" pattern="AutoCompletionTextInputBinding.java" />
<fileSet type="globPattern" pattern="SuggestionProvider.java" />
</list>
</option>
<JavaCodeStyleSettings>
Expand Down Expand Up @@ -304,4 +306,4 @@
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</code_scheme>
4 changes: 2 additions & 2 deletions jabgui/src/main/java/org/jabref/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public static void initLogging(String[] args) {
// We must configure logging as soon as possible, which is why we cannot wait for the usual
// argument parsing workflow to parse logging options e.g. --debug
Level logLevel = Arrays.stream(args).anyMatch("--debug"::equalsIgnoreCase)
? Level.DEBUG
: Level.INFO;
? Level.DEBUG
: Level.INFO;

// addLogToDisk
// We cannot use `Injector.instantiateModelOrService(BuildInfo.class).version` here, because this initializes logging
Expand Down
12 changes: 6 additions & 6 deletions jabgui/src/main/java/org/jabref/cli/CliImportHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class CliImportHelper {
* @param location URL or file path to import
*/
public static Optional<ParserResult> importFile(String location,
CliPreferences cliPreferences,
boolean porcelain) {
CliPreferences cliPreferences,
boolean porcelain) {
LOGGER.debug("Importing file from locaiton {}", location);
String[] data = location.split(",");

Expand All @@ -42,7 +42,7 @@ public static Optional<ParserResult> importFile(String location,
try {
file = new URLDownload(address).toTemporaryFile();
} catch (FetcherException |
MalformedURLException e) {
MalformedURLException e) {
System.err.println(Localization.lang("Problem downloading from %0: %1", address, e.getLocalizedMessage()));
return Optional.empty();
}
Expand All @@ -63,9 +63,9 @@ public static Optional<ParserResult> importFile(String location,
return importResult;
}

public static Optional<ParserResult> importFile(Path file,
CliPreferences cliPreferences,
boolean porcelain) {
public static Optional<ParserResult> importFile(Path file,
CliPreferences cliPreferences,
boolean porcelain) {
try {
ImportFormatReader importFormatReader = new ImportFormatReader(
cliPreferences.getImporterPreferences(),
Expand Down
34 changes: 17 additions & 17 deletions jabgui/src/main/java/org/jabref/gui/JabRefDialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -446,23 +446,23 @@ public void notify(String message) {
LOGGER.info(message);

UiTaskExecutor.runInJavaFXThread(() ->
Notifications.create()
.text(message)
.position(Pos.BOTTOM_CENTER)
.hideAfter(TOAST_MESSAGE_DISPLAY_TIME)
.owner(mainWindow)
.threshold(5,
Notifications.create()
.title(Localization.lang("Last notification"))
.text(
"(" + Localization.lang("Check the event log to see all notifications") + ")"
+ "\n\n" + message)
.onAction(e -> {
ErrorConsoleAction ec = new ErrorConsoleAction();
ec.execute();
}))
.hideCloseButton()
.show());
Notifications.create()
.text(message)
.position(Pos.BOTTOM_CENTER)
.hideAfter(TOAST_MESSAGE_DISPLAY_TIME)
.owner(mainWindow)
.threshold(5,
Notifications.create()
.title(Localization.lang("Last notification"))
.text(
"(" + Localization.lang("Check the event log to see all notifications") + ")"
+ "\n\n" + message)
.onAction(e -> {
ErrorConsoleAction ec = new ErrorConsoleAction();
ec.execute();
}))
.hideCloseButton()
.show());
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion jabgui/src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ public void onShowing(WindowEvent event) {

// Open last edited databases
if (uiCommands.stream().noneMatch(UiCommand.BlankWorkspace.class::isInstance)
&& preferences.getWorkspacePreferences().shouldOpenLastEdited()) {
&& preferences.getWorkspacePreferences().shouldOpenLastEdited()) {
mainFrame.openLastEditedDatabases();
}

Expand Down
19 changes: 9 additions & 10 deletions jabgui/src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import org.jabref.gui.maintable.MainTableDataModel;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.undo.CountingUndoManager;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.NamedCompoundEdit;
import org.jabref.gui.undo.UndoableFieldChange;
import org.jabref.gui.undo.UndoableInsertEntries;
import org.jabref.gui.undo.UndoableRemoveEntries;
Expand Down Expand Up @@ -123,7 +123,6 @@ public class LibraryTab extends Tab implements CommandSelectionTab {
private final BooleanProperty canGoForwardProperty = new SimpleBooleanProperty(false);
private boolean backOrForwardNavigationActionTriggered = false;


private BibDatabaseContext bibDatabaseContext;

// All subscribers needing "coarse" change events should use this filter
Expand Down Expand Up @@ -210,8 +209,8 @@ private LibraryTab(@NonNull BibDatabaseContext bibDatabaseContext,

stateManager.activeDatabaseProperty().addListener((_, _, _) -> {
if (preferences.getSearchPreferences().isFulltext()) {
mainTable.getTableModel().refreshSearchMatches();
}
mainTable.getTableModel().refreshSearchMatches();
}
});
}

Expand Down Expand Up @@ -466,13 +465,13 @@ public SuggestionProviders getSuggestionProviders() {
}

public void registerUndoableChanges(List<FieldChange> changes) {
NamedCompound ce = new NamedCompound(Localization.lang("Save actions"));
NamedCompoundEdit compoundEdit = new NamedCompoundEdit(Localization.lang("Save actions"));
for (FieldChange change : changes) {
ce.addEdit(new UndoableFieldChange(change));
compoundEdit.addEdit(new UndoableFieldChange(change));
}
ce.end();
if (ce.hasEdits()) {
getUndoManager().addEdit(ce);
compoundEdit.end();
if (compoundEdit.hasEdits()) {
getUndoManager().addEdit(compoundEdit);
}
}

Expand Down Expand Up @@ -1025,7 +1024,7 @@ public void updateNavigationState() {
* Creates a new library tab. Contents are loaded by the {@code dataLoadingTask}. Most of the other parameters are required by {@code resetChangeMonitor()}.
*
* @param dataLoadingTask The task to execute to load the data asynchronously.
* @param file the path to the file (loaded by the dataLoadingTask)
* @param file the path to the file (loaded by the dataLoadingTask)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit odd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be formatted to "createLibraryTab" in the next line?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IntelliJ style - description always on the same column

*/
public static LibraryTab createLibraryTab(BackgroundTask<ParserResult> dataLoadingTask,
Path file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public AiChatComponent(AiService aiService,
aiService.getIngestionService().ingest(name, ListUtil.getLinkedFiles(entries).toList(), bibDatabaseContext);

ViewLoader.view(this)
.root(this)
.load();
.root(this)
.load();
}

@FXML
Expand Down Expand Up @@ -215,10 +215,11 @@ private List<Notification> updateNotificationsForEntry(BibEntry entry) {

entry.getFiles().stream().map(file -> aiService.getIngestionService().ingest(file, bibDatabaseContext)).forEach(ingestionStatus -> {
switch (ingestionStatus.getState()) {
case PROCESSING -> notifications.add(new Notification(
Localization.lang("File %0 is currently being processed", ingestionStatus.getObject().getLink()),
Localization.lang("After the file is ingested, you will be able to chat with it.")
));
case PROCESSING ->
notifications.add(new Notification(
Localization.lang("File %0 is currently being processed", ingestionStatus.getObject().getLink()),
Localization.lang("After the file is ingested, you will be able to chat with it.")
));

case ERROR -> {
assert ingestionStatus.getException().isPresent(); // When the state is ERROR, the exception must be present.
Expand All @@ -229,7 +230,8 @@ private List<Notification> updateNotificationsForEntry(BibEntry entry) {
));
}

case SUCCESS -> { }
case SUCCESS -> {
}
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ private void initialize() {
// The easy way to get rid of this ambiguity is to disallow scrolling when there are new lines in the prompt.
// But the exception to this situation is when the caret position is at the beginning of the prompt.
history.get().stream()
.skip(newValue.intValue())
.findFirst()
.ifPresent(message -> userPromptTextArea.setText(message));
.skip(newValue.intValue())
.findFirst()
.ifPresent(message -> userPromptTextArea.setText(message));
}
} else {
// When currentUserMessageScroll is set to NEW_NON_EXISTENT_MESSAGE, then we should:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
* about possible problems with entries (because that will affect LLM output), but on the other hand the user would
* like to chat with all available entries in the group, even if some of them are not valid.
*/
public record Notification(String title, String message) { }
public record Notification(String title, String message) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public PersonNameStringConverter(AutoCompletePreferences preferences) {
public String toString(Author author) {
if (autoCompLF) {
switch (autoCompleteFirstNameMode) {
case ONLY_ABBREVIATED, BOTH:
case ONLY_ABBREVIATED,
BOTH:
return author.getFamilyGiven(true);
case ONLY_FULL:
return author.getFamilyGiven(false);
Expand All @@ -51,7 +52,8 @@ public String toString(Author author) {
}
if (autoCompFF) {
switch (autoCompleteFirstNameMode) {
case ONLY_ABBREVIATED, BOTH:
case ONLY_ABBREVIATED,
BOTH:
return author.getGivenFamily(true);
case ONLY_FULL:
return author.getGivenFamily(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ private AutosaveManager(BibDatabaseContext bibDatabaseContext, CoarseChangeFilte
this.executor.scheduleAtFixedRate(
() -> {
if (needsSave) {
eventBus.post(new AutosaveEvent());
needsSave = false;
eventBus.post(new AutosaveEvent());
needsSave = false;
}
},
DELAY_BETWEEN_AUTOSAVE_ATTEMPTS_IN_SECONDS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ public static void shutdown(BibDatabaseContext bibDatabaseContext, Path backupDi
/**
* Checks whether a backup file exists for the given database file. If it exists, it is checked whether it is
* newer and different from the original.
*
* <p>
* In case a discarded file is present, the method also returns <code>false</code>, See also {@link #discardBackup(Path)}.
*
* @param originalPath Path to the file a backup should be checked for. Example: jabref.bib.
*
* @return <code>true</code> if backup file exists AND differs from originalPath. <code>false</code> is the
* "default" return value in the good case. In case a discarded file exists, <code>false</code> is returned, too.
* In the case of an exception <code>true</code> is returned to ensure that the user checks the output.
Expand Down Expand Up @@ -303,7 +302,7 @@ private static Path determineDiscardedFile(Path file, Path backupDir) {

/**
* Marks the backups as discarded.
*
* <p>
* We do not delete any files, because the user might want to recover old backup files.
* Therefore, we mark discarded backups by a --discarded file.
*/
Expand Down Expand Up @@ -340,11 +339,11 @@ private void startBackupTask(Path backupDir) {
fillQueue(backupDir);

executor.scheduleAtFixedRate(
// We need to determine the backup path on each action, because we use the timestamp in the filename
() -> determineBackupPathForNewBackup(backupDir).ifPresent(this::performBackup),
DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS,
DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS,
TimeUnit.SECONDS);
// We need to determine the backup path on each action, because we use the timestamp in the filename
() -> determineBackupPathForNewBackup(backupDir).ifPresent(this::performBackup),
DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS,
DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS,
TimeUnit.SECONDS);
}

private void fillQueue(Path backupDir) {
Expand All @@ -370,7 +369,7 @@ private void fillQueue(Path backupDir) {
* Unregisters the BackupManager from the eventBus of {@link BibDatabaseContext}.
* This method should only be used when closing a database/JabRef in a normal way.
*
* @param backupDir The backup directory
* @param backupDir The backup directory
Comment on lines -373 to +372
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is relatively okay

* @param createBackup If the backup manager should still perform a backup
*/
private void shutdown(Path backupDir, boolean createBackup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

/**
* The action concerned with generate a new (sub-)database from latex AUX file.
*
* <p>
* A new library is created by {@link org.jabref.gui.importer.NewDatabaseAction}
*/
public class NewSubLibraryAction extends SimpleCommand {
Expand Down
Loading
Loading