Class CommandCatalog
Commands are implementations of TextBuiltin
,
with an optional Command
class annotation to
insert additional documentation or override the default command name (which
is guessed from the class name).
Commands may be registered by adding them to a services file in the same JAR
(or classes directory) as the command implementation. The service file name
is META-INF/services/org.eclipse.jgit.pgm.TextBuiltin
and it
contains one concrete implementation class name per line.
Command registration is identical to Java 6's services, however the catalog uses a lightweight wrapper to delay creating a command instance as much as possible. This avoids initializing the AWT or SWT GUI toolkits even if the command's constructor might require them.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<String, CommandRef> private static final CommandCatalog
private final ClassLoader
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandRef[]
all()
Get all commands sorted by their nameprivate Enumeration
<URL> catalogs()
static CommandRef[]
common()
Get all common commands sorted by their namestatic CommandRef
Locate a single command by its user friendly name.private void
private void
private static CommandRef[]
-
Field Details
-
INSTANCE
-
ldr
-
commands
-
-
Constructor Details
-
CommandCatalog
private CommandCatalog()
-
-
Method Details
-
get
Locate a single command by its user friendly name.- Parameters:
name
- name of the command. Typically in dash-lower-case-form, which was derived from the DashLowerCaseForm class name.- Returns:
- the command instance; null if no command exists by that name.
-
all
Get all commands sorted by their name- Returns:
- all known commands, sorted by command name.
-
common
Get all common commands sorted by their name- Returns:
- all common commands, sorted by command name.
-
toSortedArray
-
catalogs
-
scan
-
load
-