Verified Owner
Top Description Fields Constructors Methods
org.jabref.gui.importer.actions

public Class OpenDatabaseAction

extends SimpleCommand
Class Inheritance
Imports
java.io.IOException, java.nio.file.Files, .Path, java.sql.SQLException, java.util.ArrayList, .Iterator, .List, .Optional, java.util.stream.Collectors, org.jabref.gui.DialogService, .LibraryTab, .LibraryTabContainer, .StateManager, org.jabref.gui.actions.SimpleCommand, org.jabref.gui.autosaveandbackup.BackupManager, org.jabref.gui.clipboard.ClipBoardManager, org.jabref.gui.dialogs.BackupUIManager, org.jabref.gui.preferences.GuiPreferences, org.jabref.gui.shared.SharedDatabaseUIManager, org.jabref.gui.util.FileDialogConfiguration, .UiTaskExecutor, org.jabref.logic.ai.AiService, org.jabref.logic.git.util.GitHandlerRegistry, org.jabref.logic.importer.OpenDatabase, .ParserResult, org.jabref.logic.l10n.Localization, org.jabref.logic.preferences.CliPreferences, org.jabref.logic.shared.DatabaseNotSupportedException, org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException, .NotASharedDatabaseException, org.jabref.logic.util.BackgroundTask, .Directories, .JabRefBaseDirectoryLocator, .StandardFileType, .TaskExecutor, org.jabref.logic.util.io.FileHistory, .FileUtil, org.jabref.model.entry.BibEntryTypesManager, org.jabref.model.util.FileUpdateMonitor, com.google.common.annotations.VisibleForTesting, org.jspecify.annotations.NonNull, org.slf4j.Logger, .LoggerFactory

The action concerned with opening an existing database.

Field Summary

Modifier and TypeField and Description
private final AiService
private final ClipBoardManager
private final DialogService
private final BibEntryTypesManager
private final FileUpdateMonitor
private final GitHandlerRegistry
private static final Logger
private static final List<GUIPostOpenAction>
private final GuiPreferences
private final StateManager
private final LibraryTabContainer
private final TaskExecutor
Inherited from org.jabref.gui.actions.SimpleCommand:
statusMessage

Constructor Summary

AccessConstructor and Description
public
OpenDatabaseAction(LibraryTabContainer tabContainer, GuiPreferences preferences, AiService aiService, DialogService dialogService, StateManager stateManager, FileUpdateMonitor fileUpdateMonitor, BibEntryTypesManager entryTypesManager, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry)

Method Summary

Modifier and TypeMethod and Description
public void
public FileDialogConfiguration

Returns:

new FileDialogConfig with given initial directory
getFileDialogConfiguration
(Path
Path to use as the initial directory
initialDirectory
)

Builds a new FileDialogConfiguration using the given path as the initial directory for use in dialogService.showFileOpenDialogAndGetMultipleFiles().

pack-priv List<Path>
pack-priv Path
getInitialDirectory()

Returns: Path of current panel database directory or the working directory

pack-priv ParserResult
public void
openFile(Path
the file, may be null or not existing
file
)

Opens the given file.

public void
openFiles(List<Path>
the filesToOpen, may be null or not existing
filesToOpen
)

Opens the given files.

public static void
openSharedDatabase(ParserResult parserResult, LibraryTabContainer tabContainer, DialogService dialogService, GuiPreferences preferences, AiService aiService, StateManager stateManager, BibEntryTypesManager entryTypesManager, FileUpdateMonitor fileUpdateMonitor, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry)

private void
openTheFile(@NonNull Path
the file, may be NOT null, but may not be existing
file
)

This is the real file opening.

public static void
Inherited from org.jabref.gui.actions.SimpleCommand:
getProgressprogressPropertysetExecutablestatusMessageProperty

Field Detail

aiServiceback to summary
private final AiService aiService
clipboardManagerback to summary
private final ClipBoardManager clipboardManager
dialogServiceback to summary
private final DialogService dialogService
entryTypesManagerback to summary
private final BibEntryTypesManager entryTypesManager
fileUpdateMonitorback to summary
private final FileUpdateMonitor fileUpdateMonitor
gitHandlerRegistryback to summary
private final GitHandlerRegistry gitHandlerRegistry
LOGGERback to summary
private static final Logger LOGGER
POST_OPEN_ACTIONSback to summary
private static final List<GUIPostOpenAction> POST_OPEN_ACTIONS
preferencesback to summary
private final GuiPreferences preferences
stateManagerback to summary
private final StateManager stateManager
tabContainerback to summary
private final LibraryTabContainer tabContainer
taskExecutorback to summary
private final TaskExecutor taskExecutor

Constructor Detail

OpenDatabaseActionback to summary
public OpenDatabaseAction(LibraryTabContainer tabContainer, GuiPreferences preferences, AiService aiService, DialogService dialogService, StateManager stateManager, FileUpdateMonitor fileUpdateMonitor, BibEntryTypesManager entryTypesManager, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry)

Method Detail

executeback to summary
public void execute()
Annotations
@Override
getFileDialogConfigurationback to summary
public FileDialogConfiguration getFileDialogConfiguration(Path initialDirectory)

Builds a new FileDialogConfiguration using the given path as the initial directory for use in dialogService.showFileOpenDialogAndGetMultipleFiles().

Parameters
initialDirectory:Path

Path to use as the initial directory

Returns:FileDialogConfiguration

new FileDialogConfig with given initial directory

getFilesToOpenback to summary
pack-priv List<Path> getFilesToOpen()
Annotations
@VisibleForTesting
getInitialDirectoryback to summary
pack-priv Path getInitialDirectory()
Returns:Path

Path of current panel database directory or the working directory

Annotations
@VisibleForTesting
loadDatabaseback to summary
pack-priv ParserResult loadDatabase(Path file) throws org.jabref.logic.shared.exception.NotASharedDatabaseException, SQLException, org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException, org.jabref.logic.shared.DatabaseNotSupportedException
Annotations
@VisibleForTesting
openFileback to summary
public void openFile(Path file)

Opens the given file. If null or 404, nothing happens. In case the file is already opened, that panel is raised.

Parameters
file:Path

the file, may be null or not existing

openFilesback to summary
public void openFiles(List<Path> filesToOpen)

Opens the given files. If one of it is null or 404, nothing happens. In case the file is already opened, that panel is raised.

Parameters
filesToOpen:List<Path>

the filesToOpen, may be null or not existing

openSharedDatabaseback to summary
public static void openSharedDatabase(ParserResult parserResult, LibraryTabContainer tabContainer, DialogService dialogService, GuiPreferences preferences, AiService aiService, StateManager stateManager, BibEntryTypesManager entryTypesManager, FileUpdateMonitor fileUpdateMonitor, ClipBoardManager clipBoardManager, TaskExecutor taskExecutor, GitHandlerRegistry gitHandlerRegistry) throws SQLException, org.jabref.logic.shared.DatabaseNotSupportedException, org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException, org.jabref.logic.shared.exception.NotASharedDatabaseException
openTheFileback to summary
private void openTheFile(@NonNull Path file)

This is the real file opening. Should be called via openFile(Path)

Similar method: org.jabref.gui.frame.JabRefFrame#addTab(org.jabref.model.database.BibDatabaseContext, boolean).

Parameters
file:@NonNull Path

the file, may be NOT null, but may not be existing

performPostOpenActionsback to summary
public static void performPostOpenActions(ParserResult result, DialogService dialogService, CliPreferences preferences)