Top Description Fields Constructors Methods
org.jabref.gui.desktop

public Class JabRefDesktop

extends Object
Class Inheritance
Imports
java.awt.Desktop, java.io.File, .IOException, java.net.URI, java.nio.file.Files, .Path, java.util.List, .Locale, .Objects, .Optional, java.util.regex.Pattern, org.jabref.gui.ClipBoardManager, .DialogService, org.jabref.gui.desktop.os.NativeDesktop, org.jabref.gui.externalfiletype.ExternalFileType, .ExternalFileTypes, org.jabref.logic.importer.util.IdentifierParser, org.jabref.logic.l10n.Localization, org.jabref.logic.util.OS, org.jabref.logic.util.io.FileUtil, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, org.jabref.model.entry.field.Field, .StandardField, org.jabref.model.entry.identifier.DOI, .Identifier, org.jabref.preferences.ExternalApplicationsPreferences, .FilePreferences, .PreferencesService, com.airhacks.afterburner.injection.Injector, org.slf4j.Logger, .LoggerFactory

See http://stackoverflow.com/questions/18004150/desktop-api-is-not-supported-on-the-current-platform for more implementation hints. http://docs.oracle.com/javase/7/docs/api/java/awt/Desktop.html cannot be used as we don't want to rely on AWT

Field Summary

Modifier and TypeField and Description
private static final Logger
private static final NativeDesktop

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
executeCommand(String command, String absolutePath, DialogService dialogService)

public static Path
public static Path
public static void
moveToTrash(Path path)

Moves the given file to the trash.

public static boolean
public static void
openBrowser(String
the URL to open
url
,
FilePreferences filePreferences)

Opens the given URL using the system browser

public static void
openBrowser(URI url, FilePreferences filePreferences)

public static void
openBrowserShowPopup(String
the URL to open
url
,
DialogService dialogService, FilePreferences filePreferences)

Opens the url with the users standard Browser.

public static void
openConsole(Path
Location the console should be opened at.
file
,
PreferencesService preferencesService, DialogService dialogService)

Opens a new console starting on the given file location

public static void
openCustomDoi(String link, PreferencesService preferences, DialogService dialogService)

private static void
openDoi(String doi, PreferencesService preferencesService)

public static boolean

Returns:

false if the link couldn't be resolved, true otherwise.
openExternalFileAnyFormat
(final BibDatabaseContext
The database this file belongs to.
databaseContext
,
FilePreferences filePreferences, String
The filename.
link
,
final Optional<ExternalFileType> type)

Open an external file, attempting to use the correct viewer for it.

private static void
public static void
openExternalViewer(BibDatabaseContext databaseContext, PreferencesService preferencesService, String initialLink, Field initialField, DialogService dialogService, BibEntry entry)

Open a http/pdf/ps viewer for the given link string.

public static void
openFolderAndSelectFile(Path
the location of the file
fileLink
,
ExternalApplicationsPreferences externalApplicationsPreferences, DialogService dialogService)

Opens a file browser of the folder of the given file.

private static void
openIsbn(String isbn, PreferencesService preferencesService)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER
NATIVE_DESKTOPback to summary
private static final NativeDesktop NATIVE_DESKTOP

Constructor Detail

JabRefDesktopback to summary
private JabRefDesktop()

Method Detail

executeCommandback to summary
private static void executeCommand(String command, String absolutePath, DialogService dialogService)
getApplicationDirectoryback to summary
public static Path getApplicationDirectory()
getFulltextIndexBaseDirectoryback to summary
public static Path getFulltextIndexBaseDirectory()
moveToTrashback to summary
public static void moveToTrash(Path path)

Moves the given file to the trash.

Exceptions
UnsupportedOperationException:
if the current platform does not support the Desktop.Action#MOVE_TO_TRASH action
See Also
Desktop#moveToTrash(File)
moveToTrashSupportedback to summary
public static boolean moveToTrashSupported()
openBrowserback to summary
public static void openBrowser(String url, FilePreferences filePreferences) throws IOException

Opens the given URL using the system browser

Parameters
url:String

the URL to open

openBrowserback to summary
public static void openBrowser(URI url, FilePreferences filePreferences) throws IOException
openBrowserShowPopupback to summary
public static void openBrowserShowPopup(String url, DialogService dialogService, FilePreferences filePreferences)

Opens the url with the users standard Browser. If that fails a popup will be shown to instruct the user to open the link manually and the link gets copied to the clipboard

Parameters
url:String

the URL to open

openConsoleback to summary
public static void openConsole(Path file, PreferencesService preferencesService, DialogService dialogService) throws IOException

Opens a new console starting on the given file location

Parameters
file:Path

Location the console should be opened at.

openCustomDoiback to summary
public static void openCustomDoi(String link, PreferencesService preferences, DialogService dialogService)
openDoiback to summary
private static void openDoi(String doi, PreferencesService preferencesService) throws IOException
openExternalFileAnyFormatback to summary
public static boolean openExternalFileAnyFormat(final BibDatabaseContext databaseContext, FilePreferences filePreferences, String link, final Optional<ExternalFileType> type) throws IOException

Open an external file, attempting to use the correct viewer for it. If the "file" is an online link, instead open it with the browser

Parameters
databaseContext:BibDatabaseContext

The database this file belongs to.

link:String

The filename.

Returns:boolean

false if the link couldn't be resolved, true otherwise.

openExternalFilePlatformIndependentback to summary
private static void openExternalFilePlatformIndependent(Optional<ExternalFileType> fileType, String filePath, FilePreferences filePreferences) throws IOException
openExternalViewerback to summary
public static void openExternalViewer(BibDatabaseContext databaseContext, PreferencesService preferencesService, String initialLink, Field initialField, DialogService dialogService, BibEntry entry) throws IOException

Open a http/pdf/ps viewer for the given link string.

Opening a PDF file at the file field is done at org.jabref.gui.fieldeditors.LinkedFileViewModel#open

openFolderAndSelectFileback to summary
public static void openFolderAndSelectFile(Path fileLink, ExternalApplicationsPreferences externalApplicationsPreferences, DialogService dialogService) throws IOException

Opens a file browser of the folder of the given file. If possible, the file is selected

Parameters
fileLink:Path

the location of the file

Exceptions
IOException:
if the default file browser cannot be opened
openIsbnback to summary
private static void openIsbn(String isbn, PreferencesService preferencesService) throws IOException