InterfaceIContextActionRegistryBeta

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 = [];
}
}
interface IContextActionRegistry {
    getTypeName(): string;
    isOfType(type: string): boolean;
    isSame(other: ScriptObject): boolean;
    registerAction(action: ((arg1: IContext) => Editor)): IGuard;
}

Hierarchy (view full)

Methods