public class Util
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
fieldsCol |
static int |
IMPORT_MARK_LEVEL |
static int |
MARK_COLOR_LEVELS |
static java.util.regex.Pattern |
markNumberPattern |
static int |
MAX_MARKING_LEVEL |
static java.util.regex.Pattern |
remoteLinkPattern |
static int |
thisYear |
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
__wrap2(java.lang.String in,
int wrapAmount) |
static java.lang.String |
_wrap2(java.lang.String in,
int wrapAmount) |
static java.lang.Thread |
autoSetLinks(BibtexEntry entry,
FileListTableModel singleTableModel,
MetaData metaData,
java.awt.event.ActionListener callback,
javax.swing.JDialog diag)
Automatically add links for this entry to the table model given as an argument, based on
the globally stored list of external file types.
|
static java.lang.Thread |
autoSetLinks(java.util.Collection<BibtexEntry> entries,
NamedCompound ce,
java.util.Set<BibtexEntry> changedEntries,
FileListTableModel singleTableModel,
MetaData metaData,
java.awt.event.ActionListener callback,
javax.swing.JDialog diag)
Automatically add links for this set of entries, based on the globally stored list of
external file types.
|
static void |
bindCloseDialogKeyToCancelAction(javax.swing.JRootPane rootPane,
javax.swing.Action cancelAction)
Binds ESC-Key to cancel button
|
static boolean |
checkForDOIwithHTTPprefix(java.lang.String check)
Check if the String matches a DOI (with http://...)
|
static boolean |
checkForPlainDOI(java.lang.String check) |
static java.lang.String |
checkLegalKey(java.lang.String key)
This method returns a String similar to the one passed in, except that it
is molded into a form that is acceptable for bibtex.
|
static java.lang.String |
checkName(java.lang.String s) |
static <T> T[] |
concat(T[] first,
T[] second) |
static boolean |
copyFile(java.io.File source,
java.io.File dest,
boolean deleteIfExists)
Copies a file.
|
static java.lang.String |
createNeutralId() |
static java.lang.String[][] |
decodeStringDoubleArray(java.lang.String value)
Decodes an encoded double String array back into array form.
|
static boolean |
deleteLockFile(java.io.File file)
Check if a lock file exists, and delete it if it does.
|
static java.lang.String[] |
delimToStringArray(java.lang.String names,
java.lang.String delimiter)
Takes a delimited string, splits it and returns
|
static NamedCompound |
doUpdateTimeStamp(BibtexEntry entry,
javax.swing.undo.AbstractUndoableEdit undoableEdit)
Updates the timestamp of the given entry,
nests the given undaoableEdit in a named compound,
and returns that named compound
|
static java.lang.String |
easyDateFormat()
Creates a String containing the current date (and possibly time),
formatted according to the format set in preferences under the key
"timeStampFormat".
|
static java.lang.String |
easyDateFormat(java.util.Date date)
Creates a readable Date string from the parameter date.
|
static java.lang.String |
encodeStringArray(java.lang.String[] entry)
Encodes a String array into a single string, using ':' as separator.
|
static java.lang.String |
encodeStringArray(java.lang.String[][] values)
Encodes a two-dimensional String array into a single string, using ':' and
';' as separators.
|
static boolean |
equals(java.lang.Object one,
java.lang.Object two)
Static equals that can also return the right result when one of the
objects is null.
|
static java.lang.String |
expandBrackets(java.lang.String bracketString,
BibtexEntry entry,
BibtexDatabase database)
Takes a string that contains bracketed expression and expands each of
these using getFieldAndFormat.
|
static java.io.File |
expandFilename(MetaData metaData,
java.lang.String name)
Converts a relative filename to an absolute one, if necessary.
|
static java.io.File |
expandFilename(java.lang.String name,
java.lang.String dir)
Converts a relative filename to an absolute one, if necessary.
|
static java.io.File |
expandFilename(java.lang.String name,
java.lang.String[] dir)
Converts a relative filename to an absolute one, if necessary.
|
static java.util.TreeSet<java.lang.String> |
findAllWordsInField(BibtexDatabase db,
java.lang.String field,
java.lang.String remove)
Returns a HashMap containing all words used in the database in the given
field type.
|
static java.util.Map<BibtexEntry,java.util.List<java.io.File>> |
findAssociatedFiles(java.util.Collection<BibtexEntry> entries,
java.util.Collection<java.lang.String> extensions,
java.util.Collection<java.io.File> directories) |
static java.util.Set<java.lang.String> |
findAuthorLastNames(BibtexDatabase db,
java.util.List<java.lang.String> fields)
Finds all authors' last names in all the given fields for the given database.
|
static java.util.TreeSet<java.lang.String> |
findDeliminatedWordsInField(BibtexDatabase db,
java.lang.String field,
java.lang.String deliminator) |
static java.util.List<java.lang.String> |
findEncodingsForString(java.lang.String characters)
Make a list of supported character encodings that can encode all
characters in the given String.
|
protected static java.lang.String |
findFile(BibtexEntry entry,
BibtexDatabase database,
java.io.File directory,
java.lang.String file)
The actual work-horse.
|
static java.lang.String |
findFile(BibtexEntry entry,
BibtexDatabase database,
java.lang.String file)
Convenience function for absolute search.
|
static java.lang.String |
findFile(BibtexEntry entry,
BibtexDatabase database,
java.lang.String[] directory,
java.lang.String file,
boolean relative)
Searches the given directory and file name pattern for a file for the
bibtexentry.
|
static java.lang.String |
findFile(BibtexEntry entry,
BibtexDatabase database,
java.lang.String directory,
java.lang.String file,
boolean relative)
Internal Version of findFile, which also accepts a current directory to
base the search on.
|
static java.lang.String |
findFile(BibtexEntry entry,
ExternalFileType fileType,
java.util.List<java.lang.String> extraDirs)
Convenience menthod for findPDF.
|
static java.util.Set<java.io.File> |
findFiles(java.util.Collection<java.lang.String> extensions,
java.util.Collection<java.io.File> directories) |
static java.lang.String |
findPdf(BibtexEntry entry,
java.lang.String extension,
java.lang.String directory)
New version of findPdf that uses findFiles.
|
static java.lang.String |
findPdf(BibtexEntry entry,
java.lang.String extension,
java.lang.String[] directories)
Convenience method for findPDF.
|
static java.lang.String |
findPdf(java.lang.String key,
java.lang.String extension,
java.lang.String directory,
OpenFileFilter off)
Searches the given directory and subdirectories for a pdf file with name
as given + ".pdf"
|
static java.lang.String |
getCorrectFileName(java.lang.String orgName,
java.lang.String defaultExtension)
extends the filename with a default Extension, if no Extension '.x' could
be found
|
static java.lang.String |
getDOI(java.lang.String doi)
Remove the http://...
|
static java.lang.String |
getFieldAndFormat(java.lang.String fieldAndFormat,
BibtexEntry entry,
BibtexDatabase database)
Accepts a string like [author:lower] or [title:abbr] or [auth],
whereas the first part signifies the bibtex-field to get, or the key generator
field marker to use, while the others are the modifiers that will be applied.
|
static java.lang.String |
getFileExtension(java.io.File file)
Returns the extension of a file or null if the file does not have one (no .
|
static OpenFileFilter |
getFileFilterForField(java.lang.String fieldName)
This method looks up what kind of external binding is used for the given
field, and constructs on OpenFileFilter suitable for browsing for an
external file.
|
static java.lang.String |
getLinkedFileName(BibtexDatabase database,
BibtexEntry entry)
Determines filename provided by an entry in a database
|
static long |
getLockFileTimeStamp(java.io.File file)
Find the lock file's last modified time, if it has a lock file.
|
static int |
getMinimumIntegerDigits() |
static int |
getMonthNumber(java.lang.String month)
Will return an integer indicating the month of the entry from 0 to 11.
|
static java.lang.String |
getPublicationDate(BibtexEntry entry)
Will return the publication date of the given bibtex entry in conformance
to ISO 8601, i.e.
|
static java.lang.String[] |
getRemainder(java.lang.String[] all,
java.lang.String[] subset)
Build a String array containing all those elements of all that are not
in subset.
|
static java.lang.String |
getResults(java.net.URLConnection source)
Download the URL and return contents as a String.
|
static java.lang.String |
getResultsWithEncoding(java.net.URLConnection source,
java.lang.String encoding)
Download the URL using specified encoding and return contents as a String.
|
static java.util.ArrayList<java.lang.String> |
getSeparatedKeywords(BibtexEntry be) |
static java.util.ArrayList<java.lang.String> |
getSeparatedKeywords(java.lang.String keywords) |
static boolean |
hasLockFile(java.io.File file)
Check whether a lock file exists for this file.
|
static int |
isMarked(BibtexEntry be) |
static java.lang.String |
join(java.lang.String[] strings,
java.lang.String separator,
int from,
int to)
Concatenate all strings in the array from index 'from' to 'to' (excluding
to) with the given separator.
|
static void |
markEntry(BibtexEntry be,
int markIncrement,
boolean increment,
NamedCompound ce) |
static javax.swing.undo.UndoableEdit |
massRenameField(java.util.Collection<BibtexEntry> entries,
java.lang.String field,
java.lang.String newField,
boolean overwriteValues)
Move contents from one field to another for a Collection of entries.
|
static javax.swing.undo.UndoableEdit |
massSetField(java.util.Collection<BibtexEntry> entries,
java.lang.String field,
java.lang.String text,
boolean overwriteValues)
Set a given field to a given value for all entries in a Collection.
|
static java.lang.String |
nCase(java.lang.String s) |
static boolean |
openExternalFileAnyFormat(MetaData metaData,
java.lang.String link,
ExternalFileType fileType)
Open an external file, attempting to use the correct viewer for it.
|
static boolean |
openExternalFileUnknown(JabRefFrame frame,
BibtexEntry entry,
MetaData metaData,
java.lang.String link,
UnknownExternalFileType fileType) |
static void |
openExternalViewer(MetaData metaData,
java.lang.String link,
java.lang.String fieldName)
Open a http/pdf/ps viewer for the given link string.
|
static void |
openFileOnWindows(java.lang.String link,
boolean localFile)
Opens a file on a Windows system, using its default viewer.
|
static void |
openFileWithApplicationOnWindows(java.lang.String link,
java.lang.String application)
Opens a file on a Windows system, using the given application.
|
static void |
openFolderAndSelectFile(java.lang.String fileLink)
Opens a file browser of the folder of the given file.
|
static void |
openRemoteExternalFile(MetaData metaData,
java.lang.String link,
ExternalFileType fileType) |
static java.lang.String |
parseField(java.lang.String content)
This method translates a field or string from Bibtex notation, with
possibly text contained in " " or { }, and string references,
concatenated by '#' characters, into Bibkeeper notation, where string
references are enclosed in a pair of '#' characters.
|
static java.util.ArrayList<java.lang.String[]> |
parseMethodsCalls(java.lang.String calls) |
static void |
performCompatibilityUpdate()
This method is called at startup, and makes necessary adaptations to
preferences for users from an earlier version of Jabref.
|
static void |
placeDialog(java.awt.Dialog diag,
java.awt.Container win)
This method sets the location of a Dialog such that it is centered with
regard to another window, but not outside the screen on the left and the
top.
|
static void |
pr(java.lang.String s) |
static java.lang.String |
putBracesAroundCapitals(java.lang.String s)
Wrap all uppercase letters, or sequences of uppercase letters, in curly
braces.
|
static void |
putKeywords(BibtexEntry entry,
java.util.ArrayList<java.lang.String> keywords,
NamedCompound ce) |
static java.lang.String |
quote(java.lang.String s,
java.lang.String specials,
char quoteChar) |
static java.lang.String |
quote(java.lang.String s,
java.lang.String specials,
char quoteChar,
int linewrap)
Quote special characters.
|
static java.lang.String |
quoteForHTML(java.lang.String s)
Quotes each and every character, e.g.
|
static java.lang.String |
quoteMeta(java.lang.String s)
Quote all regular expression meta characters in s, in order to search for
s literally.
|
static java.lang.String |
removeBracesAroundCapitals(java.lang.String s)
This method looks for occurences of capital letters enclosed in an
arbitrary number of pairs of braces, e.g.
|
static void |
removeDOIfromBibtexEntryField(BibtexEntry bes,
java.lang.String fieldName,
NamedCompound ce) |
static java.lang.String |
removeSingleBracesAroundCapitals(java.lang.String s)
This method looks for occurences of capital letters enclosed in one pair
of braces, e.g.
|
static boolean |
renameFile(java.lang.String fileName,
java.lang.String destFilename) |
static java.lang.String |
replaceSpecialCharacters(java.lang.String s)
Replace non-english characters like umlauts etc.
|
static java.lang.String |
rtrim(java.lang.String s) |
static void |
runAbstractWorker(AbstractWorker worker)
Run an AbstractWorker's methods using Spin features to put each method
on the correct thread.
|
static java.lang.String |
sanitizeUrl(java.lang.String link)
Make sure an URL is "portable", in that it doesn't contain bad characters
that break the open command in some OSes.
|
static void |
setAutomaticFields(BibtexEntry entry,
boolean overwriteOwner,
boolean overwriteTimestamp)
Sets empty or non-existing owner fields of a bibtex entry to a specified
default value.
|
static void |
setAutomaticFields(java.util.Collection<BibtexEntry> bibs,
boolean overwriteOwner,
boolean overwriteTimestamp,
boolean markEntries)
Sets empty or non-existing owner fields of bibtex entries inside a List
to a specified default value.
|
static java.lang.String |
shaveString(java.lang.String s) |
static java.io.File |
shortenFileName(java.io.File fileName,
java.lang.String dir) |
static java.io.File |
shortenFileName(java.io.File fileName,
java.lang.String[] dirs)
Converts an absolute filename to a relative one, if necessary.
|
static void |
showQuickErrorDialog(javax.swing.JFrame parent,
java.lang.String title,
java.lang.Exception e)
This method can be used to display a "rich" error dialog which offers the
entire stack trace for an exception.
|
static java.lang.String |
sortWordsAndRemoveDuplicates(java.lang.String text)
This method "tidies" up e.g.
|
static java.lang.String |
stringArrayToDelimited(java.lang.String[] strs,
java.lang.String delimiter)
Takes a String array and returns a string with the array's elements
delimited by a certain String.
|
static java.lang.String |
stripBrackets(java.lang.String s)
Removes optional square brackets from the string s
|
static java.lang.String |
toFourDigitYear(java.lang.String year)
Will convert a two digit year using the following scheme (describe at
http://www.filemaker.com/help/02-Adding%20and%20view18.html):
If a two digit year is encountered they are matched against the last 69
years and future 30 years.
|
static java.lang.String |
toFourDigitYear(java.lang.String year,
int thisYear)
Will convert a two digit year using the following scheme (describe at
http://www.filemaker.com/help/02-Adding%20and%20view18.html):
If a two digit year is encountered they are matched against the last 69
years and future 30 years.
|
static java.lang.String |
toUpperFirstLetter(java.lang.String string)
Returns the given string but with the first character turned into an
upper case character.
|
static void |
unmarkEntry(BibtexEntry be,
boolean onlyMaxLevel,
BibtexDatabase database,
NamedCompound ce) |
static java.lang.String |
unquote(java.lang.String s,
char quoteChar)
Unquote special characters.
|
static void |
updateCompletersForEntry(java.util.HashMap<java.lang.String,AbstractAutoCompleter> autoCompleters,
BibtexEntry bibtexEntry)
This methods assures all words in the given entry are recorded in their
respective Completers, if any.
|
static void |
updateField(BibtexEntry be,
java.lang.String field,
java.lang.String newValue,
NamedCompound ce) |
static void |
updateField(BibtexEntry be,
java.lang.String field,
java.lang.String newValue,
NamedCompound ce,
java.lang.Boolean nullFieldIfValueIsTheSame) |
static boolean |
updateTimeStampIsSet() |
static NamedCompound |
upgradePdfPsToFile(BibtexDatabase database,
java.lang.String[] fields)
Collect file links from the given set of fields, and add them to the list contained
in the field GUIGlobals.FILE_FIELD.
|
static NamedCompound |
upgradePdfPsToFile(java.util.Collection<BibtexEntry> entries,
java.lang.String[] fields)
Collect file links from the given set of fields, and add them to the list contained
in the field GUIGlobals.FILE_FIELD.
|
static boolean |
waitForFileLock(java.io.File file,
int maxWaitCount)
This method checks whether there is a lock file for the given file.
|
static boolean |
warnAssignmentSideEffects(AbstractGroup[] groups,
BibtexEntry[] entries,
BibtexDatabase db,
java.awt.Component parent)
Warns the user of undesired side effects of an explicit
assignment/removal of entries to/from this group.
|
static java.lang.String |
wrap2(java.lang.String in,
int wrapAmount) |
static java.lang.String |
wrapHTML(java.lang.String s,
int lineWidth) |
public static java.awt.Color fieldsCol
public static java.util.regex.Pattern remoteLinkPattern
public static int MARK_COLOR_LEVELS
public static int MAX_MARKING_LEVEL
public static int IMPORT_MARK_LEVEL
public static java.util.regex.Pattern markNumberPattern
public static int thisYear
public static int getMinimumIntegerDigits()
public static void pr(java.lang.String s)
public static java.lang.String nCase(java.lang.String s)
public static java.lang.String checkName(java.lang.String s)
public static java.lang.String createNeutralId()
public static void placeDialog(java.awt.Dialog diag, java.awt.Container win)
public static java.lang.String parseField(java.lang.String content)
public static java.lang.String getPublicationDate(BibtexEntry entry)
entry
- public static java.lang.String shaveString(java.lang.String s)
public static java.lang.String rtrim(java.lang.String s)
public static java.lang.String checkLegalKey(java.lang.String key)
key
- mayBeNullpublic static java.lang.String replaceSpecialCharacters(java.lang.String s)
public static java.lang.String _wrap2(java.lang.String in, int wrapAmount)
public static java.lang.String wrap2(java.lang.String in, int wrapAmount)
public static java.lang.String __wrap2(java.lang.String in, int wrapAmount)
public static java.util.TreeSet<java.lang.String> findDeliminatedWordsInField(BibtexDatabase db, java.lang.String field, java.lang.String deliminator)
public static java.util.TreeSet<java.lang.String> findAllWordsInField(BibtexDatabase db, java.lang.String field, java.lang.String remove)
remove
- are not included.db
- a BibtexDatabase
valuefield
- a String
valueremove
- a String
valueHashSet
valuepublic static java.util.Set<java.lang.String> findAuthorLastNames(BibtexDatabase db, java.util.List<java.lang.String> fields)
db
- The database.fields
- The fields to look in.public static java.lang.String stringArrayToDelimited(java.lang.String[] strs, java.lang.String delimiter)
strs
- String array to convert.delimiter
- String to use as delimiter.public static java.lang.String[] delimToStringArray(java.lang.String names, java.lang.String delimiter)
names
- a String
valueString[]
valuepublic static void openExternalViewer(MetaData metaData, java.lang.String link, java.lang.String fieldName) throws java.io.IOException
java.io.IOException
public static void openFileOnWindows(java.lang.String link, boolean localFile) throws java.io.IOException
link
- The file name.localFile
- true if it is a local file, not an URL.java.io.IOException
public static void openFileWithApplicationOnWindows(java.lang.String link, java.lang.String application) throws java.io.IOException
link
- The file name.application
- Link to the app that opens the file.java.io.IOException
public static boolean openExternalFileAnyFormat(MetaData metaData, java.lang.String link, ExternalFileType fileType) throws java.io.IOException
metaData
- The MetaData for the database this file belongs to.link
- The file name.java.io.IOException
public static void openRemoteExternalFile(MetaData metaData, java.lang.String link, ExternalFileType fileType)
public static boolean openExternalFileUnknown(JabRefFrame frame, BibtexEntry entry, MetaData metaData, java.lang.String link, UnknownExternalFileType fileType) throws java.io.IOException
java.io.IOException
public static java.lang.String sanitizeUrl(java.lang.String link)
link
- :the URL to sanitize.public static java.lang.String findPdf(java.lang.String key, java.lang.String extension, java.lang.String directory, OpenFileFilter off)
public static java.util.Map<BibtexEntry,java.util.List<java.io.File>> findAssociatedFiles(java.util.Collection<BibtexEntry> entries, java.util.Collection<java.lang.String> extensions, java.util.Collection<java.io.File> directories)
public static java.util.Set<java.io.File> findFiles(java.util.Collection<java.lang.String> extensions, java.util.Collection<java.io.File> directories)
public static java.lang.String getFileExtension(java.io.File file)
file
- public static java.lang.String findPdf(BibtexEntry entry, java.lang.String extension, java.lang.String directory)
public static java.lang.String findPdf(BibtexEntry entry, java.lang.String extension, java.lang.String[] directories)
public static java.lang.String findFile(BibtexEntry entry, ExternalFileType fileType, java.util.List<java.lang.String> extraDirs)
entry
- The BibtexEntry to search for a link for.fileType
- The file type to search for.public static java.lang.String findFile(BibtexEntry entry, BibtexDatabase database, java.lang.String[] directory, java.lang.String file, boolean relative)
entry
- non-nulldatabase
- non-nulldirectory
- A set of root directories to start the search from. Paths are
returned relative to these directories if relative is set to
true. These directories will not be expanded or anything. Use
the file attribute for this.file
- non-nullrelative
- whether to return relative file paths or absolute onespublic static java.lang.String stripBrackets(java.lang.String s)
s
- public static java.util.ArrayList<java.lang.String[]> parseMethodsCalls(java.lang.String calls) throws java.lang.RuntimeException
java.lang.RuntimeException
public static java.lang.String getFieldAndFormat(java.lang.String fieldAndFormat, BibtexEntry entry, BibtexDatabase database)
fieldAndFormat
- entry
- database
- public static java.lang.String findFile(BibtexEntry entry, BibtexDatabase database, java.lang.String file)
public static java.lang.String findFile(BibtexEntry entry, BibtexDatabase database, java.lang.String directory, java.lang.String file, boolean relative)
protected static java.lang.String findFile(BibtexEntry entry, BibtexDatabase database, java.io.File directory, java.lang.String file)
public static java.lang.String expandBrackets(java.lang.String bracketString, BibtexEntry entry, BibtexDatabase database)
bracketString
- entry
- database
- public static java.lang.String join(java.lang.String[] strings, java.lang.String separator, int from, int to)
strings
- separator
- from
- to
- Excluding strings[to]public static java.io.File expandFilename(MetaData metaData, java.lang.String name)
metaData
- The MetaData for the database this file belongs to.name
- The file name, may also be a relative path to the filepublic static java.io.File expandFilename(java.lang.String name, java.lang.String[] dir)
public static java.io.File expandFilename(java.lang.String name, java.lang.String dir)
public static java.io.File shortenFileName(java.io.File fileName, java.lang.String[] dirs)
dirs:
- directories to check.public static java.io.File shortenFileName(java.io.File fileName, java.lang.String dir)
public static void updateCompletersForEntry(java.util.HashMap<java.lang.String,AbstractAutoCompleter> autoCompleters, BibtexEntry bibtexEntry)
public static void setAutomaticFields(java.util.Collection<BibtexEntry> bibs, boolean overwriteOwner, boolean overwriteTimestamp, boolean markEntries)
bibs
- List of bibtex entriespublic static void setAutomaticFields(BibtexEntry entry, boolean overwriteOwner, boolean overwriteTimestamp)
entry
- The entry to set fields for.overwriteOwner
- Indicates whether owner should be set if it is already set.overwriteTimestamp
- Indicates whether timestamp should be set if it is already set.public static boolean copyFile(java.io.File source, java.io.File dest, boolean deleteIfExists) throws java.io.IOException
source
- File Source filedest
- File Destination filedeleteIfExists
- boolean Determines whether the copy goes on even if the file
exists.java.io.IOException
public static void performCompatibilityUpdate()
public static NamedCompound upgradePdfPsToFile(BibtexDatabase database, java.lang.String[] fields)
database
- The database to modify.fields
- The fields to find links in.public static NamedCompound upgradePdfPsToFile(java.util.Collection<BibtexEntry> entries, java.lang.String[] fields)
entries
- The entries to modify.fields
- The fields to find links in.public static java.lang.String getCorrectFileName(java.lang.String orgName, java.lang.String defaultExtension)
public static java.lang.String quoteForHTML(java.lang.String s)
public static java.lang.String quote(java.lang.String s, java.lang.String specials, char quoteChar)
public static java.lang.String quote(java.lang.String s, java.lang.String specials, char quoteChar, int linewrap)
s
- The String which may contain special characters.specials
- A String containing all special characters except the quoting
character itself, which is automatically quoted.quoteChar
- The quoting character.linewrap
- The number of characters after which a linebreak is inserted
(this linebreak is undone by unquote()). Set to 0 to disable.public static java.lang.String unquote(java.lang.String s, char quoteChar)
s
- The String which may contain quoted special characters.quoteChar
- The quoting character.public static java.lang.String quoteMeta(java.lang.String s)
public static java.lang.String sortWordsAndRemoveDuplicates(java.lang.String text)
public static boolean warnAssignmentSideEffects(AbstractGroup[] groups, BibtexEntry[] entries, BibtexDatabase db, java.awt.Component parent)
parent
- The Component used as a parent when displaying a confirmation
dialog.public static java.lang.String putBracesAroundCapitals(java.lang.String s)
s
- The string to modify.public static java.lang.String removeBracesAroundCapitals(java.lang.String s)
s
- The String to analyze.public static java.lang.String removeSingleBracesAroundCapitals(java.lang.String s)
s
- The String to analyze.public static OpenFileFilter getFileFilterForField(java.lang.String fieldName)
fieldName
- The BibTeX field in question.public static void showQuickErrorDialog(javax.swing.JFrame parent, java.lang.String title, java.lang.Exception e)
parent
- e
- public static java.lang.String wrapHTML(java.lang.String s, int lineWidth)
public static java.lang.String easyDateFormat()
public static java.lang.String easyDateFormat(java.util.Date date)
public static void markEntry(BibtexEntry be, int markIncrement, boolean increment, NamedCompound ce)
public static void unmarkEntry(BibtexEntry be, boolean onlyMaxLevel, BibtexDatabase database, NamedCompound ce)
public static int isMarked(BibtexEntry be)
public static javax.swing.undo.UndoableEdit massSetField(java.util.Collection<BibtexEntry> entries, java.lang.String field, java.lang.String text, boolean overwriteValues)
entries
- The entries to set the field for.field
- The name of the field to set.text
- The value to set. This value can be null, indicating that the
field should be cleared.overwriteValues
- Indicate whether the value should be set even if an entry
already has the field set.public static javax.swing.undo.UndoableEdit massRenameField(java.util.Collection<BibtexEntry> entries, java.lang.String field, java.lang.String newField, boolean overwriteValues)
entries
- The entries to do this operation for.field
- The field to move contents from.newField
- The field to move contents into.overwriteValues
- If true, overwrites any existing values in the new field.
If false, makes no change for entries with existing value in the new field.public static java.util.List<java.lang.String> findEncodingsForString(java.lang.String characters)
characters
- A String of characters that should be supported by the
encodings.public static java.lang.String toFourDigitYear(java.lang.String year)
year
- The year to convert to 4 digits.public static java.lang.String toFourDigitYear(java.lang.String year, int thisYear)
year
- The year to convert to 4 digits.public static int getMonthNumber(java.lang.String month)
month
- public static java.lang.String encodeStringArray(java.lang.String[][] values)
values
- The String array.public static java.lang.String encodeStringArray(java.lang.String[] entry)
entry
- The String array.public static java.lang.String[][] decodeStringDoubleArray(java.lang.String value)
value
- The encoded String to be decoded.public static boolean equals(java.lang.Object one, java.lang.Object two)
one
- The object whose equals method is called if the first is not
null.two
- The object passed to the first one if the first is not null.one == null ? two == null : one.equals(two);
public static java.lang.String toUpperFirstLetter(java.lang.String string)
string
- The string to change the first character to upper case to.public static void runAbstractWorker(AbstractWorker worker) throws java.lang.Throwable
worker
- The worker to run.java.lang.Throwable
public static boolean waitForFileLock(java.io.File file, int maxWaitCount)
file
- The file to check the lock for.maxWaitCount
- The maximum number of times to wait.public static boolean hasLockFile(java.io.File file)
file
- The file to check.public static long getLockFileTimeStamp(java.io.File file)
file
- The file to check.public static boolean deleteLockFile(java.io.File file)
java.io.IOException
- if something goes wrong.public static java.lang.String[] getRemainder(java.lang.String[] all, java.lang.String[] subset)
all
- The array of all values.subset
- The subset of values.public static <T> T[] concat(T[] first, T[] second)
public static java.lang.String getLinkedFileName(BibtexDatabase database, BibtexEntry entry)
database
- the database, where the entry is locatedentry
- the entry to which the file should be linked topublic static boolean checkForDOIwithHTTPprefix(java.lang.String check)
public static boolean checkForPlainDOI(java.lang.String check)
check
- - string to checkpublic static java.lang.String getDOI(java.lang.String doi)
doi
- - may not be nullpublic static void removeDOIfromBibtexEntryField(BibtexEntry bes, java.lang.String fieldName, NamedCompound ce)
public static boolean renameFile(java.lang.String fileName, java.lang.String destFilename)
fileName
- fileType
- destFilename
- edits
- public static java.util.ArrayList<java.lang.String> getSeparatedKeywords(java.lang.String keywords)
public static java.util.ArrayList<java.lang.String> getSeparatedKeywords(BibtexEntry be)
public static void putKeywords(BibtexEntry entry, java.util.ArrayList<java.lang.String> keywords, NamedCompound ce)
public static void updateField(BibtexEntry be, java.lang.String field, java.lang.String newValue, NamedCompound ce)
ce
- indicates the undo named compound. May be nullpublic static void updateField(BibtexEntry be, java.lang.String field, java.lang.String newValue, NamedCompound ce, java.lang.Boolean nullFieldIfValueIsTheSame)
ce
- indicates the undo named compound. May be nullpublic static void bindCloseDialogKeyToCancelAction(javax.swing.JRootPane rootPane, javax.swing.Action cancelAction)
rootPane
- the pane to bind the action to. Typically, this variable is retrieved by this.getRootPane();cancelAction
- the action to bindpublic static java.lang.String getResults(java.net.URLConnection source) throws java.io.IOException
source
- java.io.IOException
public static java.lang.String getResultsWithEncoding(java.net.URLConnection source, java.lang.String encoding) throws java.io.IOException
source
- encodingjava.io.IOException
public static boolean updateTimeStampIsSet()
public static NamedCompound doUpdateTimeStamp(BibtexEntry entry, javax.swing.undo.AbstractUndoableEdit undoableEdit)
public static java.lang.Thread autoSetLinks(java.util.Collection<BibtexEntry> entries, NamedCompound ce, java.util.Set<BibtexEntry> changedEntries, FileListTableModel singleTableModel, MetaData metaData, java.awt.event.ActionListener callback, javax.swing.JDialog diag)
entries
- A collection of BibtexEntry objects to find links for.ce
- A NamedCompound to add UndoEdit elements to.changedEntries
- MODIFIED, optional. A Set of BibtexEntry objects to which all modified entries is added. This is used for status output and debuggingsingleTableModel
- UGLY HACK. The table model to insert links into. Already existing links are not duplicated or removed. This parameter has to be null if entries.count() != 1.
The hack has been introduced as a bibtexentry does not (yet) support the function getListTableModel() and the FileListEntryEditor editor holds an instance of that table model and does not reconstruct it after the search has succeeded.metaData
- The MetaData providing the relevant file directory, if any.callback
- An ActionListener that is notified (on the event dispatch thread) when the search is
finished. The ActionEvent has id=0 if no new links were added, and id=1 if one or more links were added.
This parameter can be null, which means that no callback will be notified.diag
- An instantiated modal JDialog which will be used to display the progress of the autosetting.
This parameter can be null, which means that no progress update will be shown.public static java.lang.Thread autoSetLinks(BibtexEntry entry, FileListTableModel singleTableModel, MetaData metaData, java.awt.event.ActionListener callback, javax.swing.JDialog diag)
entry
- The BibtexEntry to find links for.singleTableModel
- The table model to insert links into. Already existing links are not duplicated or removed.metaData
- The MetaData providing the relevant file directory, if any.callback
- An ActionListener that is notified (on the event dispatch thread) when the search is
finished. The ActionEvent has id=0 if no new links were added, and id=1 if one or more links were added.
This parameter can be null, which means that no callback will be notified. The passed ActionEvent is constructed with
(this, id, ""), where id is 1 if something has been done and 0 if nothing has been done.diag
- An instantiated modal JDialog which will be used to display the progress of the autosetting.
This parameter can be null, which means that no progress update will be shown.public static void openFolderAndSelectFile(java.lang.String fileLink) throws java.io.IOException
fileLink
- the location of the filejava.io.IOException