Package org.languagetool.gui
Class Tools
- java.lang.Object
-
- org.languagetool.gui.Tools
-
public final class Tools extends java.lang.ObjectGUI-related tools.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static voidaddHyperlinkListener(javax.swing.JTextPane pane)static voidcenterDialog(javax.swing.JDialog dialog)Set dialog location to the center of the screenstatic voidconfigureFromRules(org.languagetool.JLanguageTool langTool, Configuration config)private static java.lang.StringencodeUrl(org.languagetool.rules.Rule rule)private static java.lang.StringformatURL(java.net.URL url)private static java.lang.StringgetExampleSentences(org.languagetool.rules.Rule rule, java.util.ResourceBundle messages)static java.lang.StringgetLabel(java.lang.String label)Returns translation of the UI element without the control character&.static chargetMnemonic(java.lang.String label)Returns mnemonic of a UI element.(package private) static java.io.FileopenDirectoryDialog(java.awt.Frame frame, java.io.File initialDir)Show a directory chooser dialog, starting with a specified directory(package private) static java.io.FileopenFileDialog(java.awt.Frame frame, javax.swing.filechooser.FileFilter fileFilter)Show a file chooser dialog and return the file selected by the user ornull.(package private) static java.io.FileopenFileDialog(java.awt.Frame frame, javax.swing.filechooser.FileFilter fileFilter, java.io.File initialDir)Show a file chooser dialog in a specified directoryprivate static java.io.FileopenFileDialog(java.awt.Frame frame, javax.swing.filechooser.FileFilter fileFilter, java.io.File initialDir, int mode)(package private) static voidopenURL(java.lang.String url)Launches the default browser to display a URL.(package private) static voidopenURL(java.net.URL url)Launches the default browser to display a URL.static java.lang.StringshortenComment(java.lang.String comment)LibO shortens menu items with more than ~100 characters by dropping text in the middle.(package private) static voidshowError(java.lang.Exception e)Show the exception (with stacktrace) in a dialog and print it to STDERR.(package private) static voidshowErrorMessage(java.lang.Exception e)Show the exception (message without stacktrace) in a dialog and print the stacktrace to STDERR.(package private) static voidshowErrorMessage(java.lang.Exception e, java.awt.Component parent)Show the exception (message without stacktrace) in a dialog and print the stacktrace to STDERR.(package private) static voidshowRuleInfoDialog(java.awt.Component parent, java.lang.String title, java.lang.String message, org.languagetool.rules.Rule rule, java.net.URL matchUrl, java.util.ResourceBundle messages, java.lang.String lang)
-
-
-
Method Detail
-
openFileDialog
static java.io.File openFileDialog(java.awt.Frame frame, javax.swing.filechooser.FileFilter fileFilter)Show a file chooser dialog and return the file selected by the user ornull.
-
openFileDialog
static java.io.File openFileDialog(java.awt.Frame frame, javax.swing.filechooser.FileFilter fileFilter, java.io.File initialDir)Show a file chooser dialog in a specified directory- Parameters:
frame- Owner framefileFilter- The pattern of files to choose frominitialDir- The initial directory- Returns:
- the selected file
- Since:
- 2.6
-
openDirectoryDialog
static java.io.File openDirectoryDialog(java.awt.Frame frame, java.io.File initialDir)Show a directory chooser dialog, starting with a specified directory- Parameters:
frame- Owner frameinitialDir- The initial directory- Returns:
- the selected file
- Since:
- 3.0
-
openFileDialog
private static java.io.File openFileDialog(java.awt.Frame frame, javax.swing.filechooser.FileFilter fileFilter, java.io.File initialDir, int mode)
-
showError
static void showError(java.lang.Exception e)
Show the exception (with stacktrace) in a dialog and print it to STDERR.
-
showErrorMessage
static void showErrorMessage(java.lang.Exception e, java.awt.Component parent)Show the exception (message without stacktrace) in a dialog and print the stacktrace to STDERR.
-
showErrorMessage
static void showErrorMessage(java.lang.Exception e)
Show the exception (message without stacktrace) in a dialog and print the stacktrace to STDERR.
-
shortenComment
public static java.lang.String shortenComment(java.lang.String comment)
LibO shortens menu items with more than ~100 characters by dropping text in the middle. That isn't really sensible, so we shorten the text here in order to preserve the important parts.
-
getLabel
public static java.lang.String getLabel(java.lang.String label)
Returns translation of the UI element without the control character&. To have&in the UI, use&&.- Parameters:
label- Label to convert.- Returns:
- String UI element string without mnemonics.
-
getMnemonic
public static char getMnemonic(java.lang.String label)
Returns mnemonic of a UI element.- Parameters:
label- String Label of the UI element- Returns:
- Mnemonic of the UI element, or
-
-