Editor.IContextActionRegistry
ClassA registry of Editor.ContextAction which will be shown in a contextual menu (i.e. right click).
Index
Properties
Methods
Example
import { CoreService } from 'LensStudio:CoreService';
export class ContextActionRegistry extends CoreService {
static descriptor() {
return {
id: 'com.example.contextActionRegistry',
name: 'ContextActionRegistry',
description: 'ContextActionRegistry',
interfaces: CoreService.descriptor().interfaces,
dependencies: [Editor.IContextActionRegistry]
};
}
constructor(pluginSystem) {
super(pluginSystem);
this.guards = [];
}
start() {
const contextActionRegistry = this.pluginSystem.findInterface(Editor.IContextActionRegistry);
this.guards.push(contextActionRegistry.registerAction((context) => {
const action = new Editor.ContextAction();
action.id = 'Test Action Id';
action.caption = 'Test Action Caption';
action.description = 'Test Action Description';
action.group = ['Test Group'];
action.apply = () => {
};
return action;
}));
}
stop() {
this.guards = [];
}
}
Extends
Properties
interfaceId
staticinterfaceId:InterfaceId
Unique identifier for the IContextActionRegistry interface.
Methods
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
registerAction()
registerAction(
action):IGuard
Adds the action to the registry.
Parameters
| Parameter | Type |
|---|---|
action | (arg1) => Editor |