A registry of Editor.ContextAction which will be shown in a contextual menu (i.e. right click).
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 = []; }} Copy
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 = []; }}
Protected
Snap Hidden
Static
Returns the name of this object's type.
Returns true if the object is of the specified type.
Returns true if this object refers to the same instance as the given object.
Adds the action to the registry.
action
A registry of Editor.ContextAction which will be shown in a contextual menu (i.e. right click).
Example