|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fife.rtext.RTextUtilities
Collection of tools for use by any of the RText components.
| Field Summary | |
static java.lang.String |
MACRO_EXTENSION
The extension at the end of all macro files. |
| Constructor Summary | |
RTextUtilities()
|
|
| Method Summary | |
static void |
addDefaultCodeTemplates()
Adds a set of "default" code templates to the text areas. |
static void |
centerSelectionVertically(RSyntaxTextArea textArea)
Scrolls the selected text of a text area so that it is centered vertically. |
static void |
configureFindInFilesDialog(FindInFilesDialog fnfd)
Configures a find-in-files dialog for RText. |
static javax.swing.JPanel |
createAssistancePanel(javax.swing.JComponent comp,
DecorativeIconPanel iconPanel)
Creates a panel containing the specified component and an (optional) dedorative (or assistance) icon panel. |
static RTextFileChooser |
createFileChooser(RText rtext)
Creates and initializes a file chooser suitable for RText. |
static boolean |
enableTemplates(RText rtext,
boolean enabled)
Enables or disables template usage in RText text areas. |
static java.lang.String |
escapeForHTML(java.lang.String s,
java.lang.String newlineReplacement)
Returns a string with characters that are special to HTML (such as <, > and &) replaced
by their HTML escape sequences. |
static java.lang.String |
escapeForHTML(java.lang.String s,
java.lang.String newlineReplacement,
boolean inPreBlock)
Returns a string with characters that are special to HTML (such as <, > and &) replaced
by their HTML escape sequences. |
static boolean |
getDropShadowsEnabledInEditor()
Returns whether the experimental "drop shadows" option is enabled. |
static java.awt.Image |
getImageFromFile(java.lang.String fileName)
Returns an image from a file in a safe fashion. |
static java.lang.String |
getLookAndFeelToSave()
Returns the name of the LookAndFeel to load RText with the next time it starts up. |
static java.io.File |
getMacroDirectory()
Returns the directory in which the user's macros are stored. |
static java.lang.String |
getMacroName(java.io.File macroFile)
Returns the name of the macro in the specified file. |
static java.util.regex.Pattern |
getPatternForFileFilter(java.lang.String fileFilter,
boolean showErrorDialog)
Converts a String representing a wildcard file filter into
a Pattern containing a regular expression good for
finding files that match the wildcard expression. |
static java.io.File |
getPreferencesDirectory()
Returns the directory in which to load and save user preferences (beyond those saved via the Java preferences API). |
static java.lang.String |
getPrettyStringFor(javax.swing.KeyStroke keyStroke)
Returns a pretty string value for a KeyStroke, suitable for display as the keystroke's value in a GUI. |
static java.io.File[] |
getSavedMacroFiles()
Returns all macro files saved in the macro directory. |
static java.awt.image.BufferedImage |
getTranslucentImage(RText rtext,
java.awt.Image image,
float alpha)
Returns a translucent version of a given java.awt.Image. |
static boolean |
isPreJava6()
Returns whether the Java Runtime that RText is running in is 1.4 or 1.5. |
static void |
openAllFilesIn(RText rtext,
java.io.File directory)
Opens all files in the specified directory tree in RText. |
static void |
saveFileChooserFavorites(RText rtext)
Saves the "Favorite Directories" of RText's file chooser. |
static void |
setDropShadowsEnabledInEditor(boolean enabled)
Toggles whether the experimental "drop shadows" option is enabled. |
static void |
setLookAndFeel(RText rtext,
java.lang.String lnfClassName)
Sets the Look and Feel for all open RText instances. |
static java.lang.String |
stripBackupExtensions(java.lang.String fileName)
Strips ".orig", ".bak", and ".old" from the end of a fileName, if they are there. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String MACRO_EXTENSION
| Constructor Detail |
public RTextUtilities()
| Method Detail |
public static final void addDefaultCodeTemplates()
public static void centerSelectionVertically(RSyntaxTextArea textArea)
textArea - The text area.public static final void configureFindInFilesDialog(FindInFilesDialog fnfd)
fnfd - The FindInFilesDialog to configure.
public static javax.swing.JPanel createAssistancePanel(javax.swing.JComponent comp,
DecorativeIconPanel iconPanel)
comp - The component.iconPanel - The icon panel. If this is null, then a
spacer is used.
public static final RTextFileChooser createFileChooser(RText rtext)
rtext - The RText instance that will own this file chooser.
saveFileChooserFavorites(RText)
public static boolean enableTemplates(RText rtext,
boolean enabled)
enabled - Whether templates should be enabled.
true if everything went okay; false
if the method failed.
public static final java.lang.String escapeForHTML(java.lang.String s,
java.lang.String newlineReplacement)
<, > and &) replaced
by their HTML escape sequences.
s - The input string.newlineReplacement - What to replace newline characters with.
If this is null, they are simply removed.
s.
public static final java.lang.String escapeForHTML(java.lang.String s,
java.lang.String newlineReplacement,
boolean inPreBlock)
<, > and &) replaced
by their HTML escape sequences.
s - The input string.newlineReplacement - What to replace newline characters with.
If this is null, they are simply removed.inPreBlock - Whether this HTML will be in within pre
tags. If this is true, spaces will be kept as-is;
otherwise, they will be converted to " ".
s.public static boolean getDropShadowsEnabledInEditor()
setDropShadowsEnabledInEditor(boolean)public static java.awt.Image getImageFromFile(java.lang.String fileName)
fileName - The file from which to get the image (must be .jpg,
.gif or .png).
null if the
image file was invalid.public static java.lang.String getLookAndFeelToSave()
public static final java.io.File getMacroDirectory()
null if it cannot be found
or created.public static final java.lang.String getMacroName(java.io.File macroFile)
macroFile - A file containing an RTextArea macro.
If this file is null, then null
is returned.
public static java.io.File getPreferencesDirectory()
public static java.lang.String getPrettyStringFor(javax.swing.KeyStroke keyStroke)
keyStroke - The keystroke.
public static java.util.regex.Pattern getPatternForFileFilter(java.lang.String fileFilter,
boolean showErrorDialog)
String representing a wildcard file filter into
a Pattern containing a regular expression good for
finding files that match the wildcard expression.Example: For
String regEx = RTextUtilities.getPatternForFileFilter("*.c");
the returned pattern will match ^.*\.c$.
fileFilter - The file filter for which to create equivalent regular
expressions. This filter can currently only contain the
wildcards '*' and '?'.showErrorDialog - If true, an error dialog is
displayed if an error occurs.
Pattern representing an equivalent regular
expression for the string passed in. If an error occurs,
null is returned.public static final java.io.File[] getSavedMacroFiles()
public static java.awt.image.BufferedImage getTranslucentImage(RText rtext,
java.awt.Image image,
float alpha)
java.awt.Image.
image - The java.awt.Image on which to apply the
alpha filter.alpha - The alpha value to use when defining how translucent you
want the image to be. This should be in the range 0.0f to 1.0f.public static final boolean isPreJava6()
public static void openAllFilesIn(RText rtext,
java.io.File directory)
rtext - The RText instance in which to open the files.directory - The top of the directory tree, all files in which
you want opened in RText.public static void saveFileChooserFavorites(RText rtext)
createFileChooser(RText) before calling this method.
If an error occurs saving the favorites, an error message is
displayed.
rtext - The parent RText instance.createFileChooser(RText)public static void setDropShadowsEnabledInEditor(boolean enabled)
enabled - Whether the option is enabled.getDropShadowsEnabledInEditor()
public static void setLookAndFeel(RText rtext,
java.lang.String lnfClassName)
rtext - An RText instance to display a message if an exception is
thrown.lnfClassName - The class name of the Look and Feel to set.public static java.lang.String stripBackupExtensions(java.lang.String fileName)
fileName - The file name.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||