2020-05-26 07:53:41 +00:00
|
|
|
import '@ccms/nashorn'
|
|
|
|
|
|
|
|
import { command, plugin } from '@ccms/api'
|
|
|
|
import { inject, provideSingleton, postConstruct } from '@ccms/container'
|
|
|
|
|
2020-06-02 09:50:47 +00:00
|
|
|
import { CommandMap } from './internal/command'
|
|
|
|
|
2020-05-26 07:53:41 +00:00
|
|
|
@provideSingleton(command.Command)
|
|
|
|
export class SpringCommand extends command.Command {
|
|
|
|
@inject(plugin.PluginInstance)
|
|
|
|
private pluginInstance: any
|
2020-06-02 09:50:47 +00:00
|
|
|
@inject(CommandMap)
|
|
|
|
private commandMap: CommandMap = new CommandMap()
|
2020-05-26 07:53:41 +00:00
|
|
|
|
|
|
|
protected create(plugin: any, command: string) {
|
2020-06-02 09:50:47 +00:00
|
|
|
return this.commandMap.register(plugin, command)
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
protected remove(plugin: any, command: string) {
|
2020-06-02 09:50:47 +00:00
|
|
|
this.commandMap.unregister(plugin, command)
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
protected onCommand(plugin: any, command: any, executor: Function) {
|
2020-06-02 09:50:47 +00:00
|
|
|
command.setExecutor(super.setExecutor(plugin, command, executor))
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
protected onTabComplete(plugin: any, command: any, tabCompleter: Function) {
|
2020-06-02 09:50:47 +00:00
|
|
|
command.setTabCompleter(super.setExecutor(plugin, command, tabCompleter))
|
2020-05-26 07:53:41 +00:00
|
|
|
}
|
|
|
|
}
|