public class Macro
extends java.lang.Object
RTextArea
.
Macro
s are static; when a Macro is loaded, it can be run by any
instance of RTextArea
in the application. To activate and play
back a macro, use the following methods:
RTextArea.beginRecordingMacro()
(this discards the previous
"current" macro, if any)
RTextArea.endRecordingMacro()
(at this point, you could call
playbackLastMacro()
to play this macro immediately if
desired)
RTextArea.getCurrentMacro()
.saveToFile(File)
Macro
s save themselves as XML files, a common technique is
to save all macros in files named "getName()
.xml
", and
place them all in a common directory.构造器和说明 |
---|
Macro()
Constructor.
|
Macro(java.io.File file)
Loads a macro from a file on disk.
|
Macro(java.lang.String name)
Constructor.
|
Macro(java.lang.String name,
java.util.List<com.fr.design.gui.syntax.ui.rtextarea.Macro.MacroRecord> records)
Constructor.
|
限定符和类型 | 方法和说明 |
---|---|
void |
addMacroRecord(com.fr.design.gui.syntax.ui.rtextarea.Macro.MacroRecord record)
Adds a macro record to this macro.
|
java.util.List<com.fr.design.gui.syntax.ui.rtextarea.Macro.MacroRecord> |
getMacroRecords()
Returns the macro records that make up this macro.
|
java.lang.String |
getName()
Returns the name of this macro.
|
void |
saveToFile(java.io.File file)
Saves this macro to an XML file.
|
void |
saveToFile(java.lang.String fileName)
Saves this macro to a file.
|
void |
setName(java.lang.String name)
Sets the name of this macro.
|
public Macro()
public Macro(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file
- The file from which to load the macro.java.io.FileNotFoundException
- If the specified file does not exist, is
a directory instead of a regular file, or otherwise cannot be
opened.java.io.IOException
- If an I/O exception occurs while reading the file.saveToFile(String)
,
saveToFile(File)
public Macro(java.lang.String name)
name
- The name of the macro.public Macro(java.lang.String name, java.util.List<com.fr.design.gui.syntax.ui.rtextarea.Macro.MacroRecord> records)
name
- The name of the macro.records
- The initial records of the macro.public void addMacroRecord(com.fr.design.gui.syntax.ui.rtextarea.Macro.MacroRecord record)
record
- The record to add. If null
, nothing happens.getMacroRecords()
public java.util.List<com.fr.design.gui.syntax.ui.rtextarea.Macro.MacroRecord> getMacroRecords()
addMacroRecord(com.fr.design.gui.syntax.ui.rtextarea.Macro.MacroRecord)
public java.lang.String getName()
setName(String)
public void saveToFile(java.io.File file) throws java.io.IOException
File
parameter; this is the mechanism
for saving macros.file
- The file in which to save the macro.java.io.IOException
- If an error occurs while generating the XML for
the output file.saveToFile(String)
public void saveToFile(java.lang.String fileName) throws java.io.IOException
File
parameter; this is the mechanism
for saving macros.fileName
- The name of the file in which to save the macro.java.io.IOException
- If an error occurs while generating the XML for
the output file.saveToFile(File)
public void setName(java.lang.String name)
name
- The new name for the macro.getName()