Skip to main content

Editor.IContextActionRegistry

Class

A registry of Editor.ContextAction which will be shown in a contextual menu (i.e. right click).

Index

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

static interfaceId: InterfaceId

Unique identifier for the IContextActionRegistry interface.

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

IPluginComponent.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

IPluginComponent.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

IPluginComponent.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

IPluginComponent.isSame


registerAction()

registerAction(action): IGuard

Adds the action to the registry.

Parameters

ParameterType
action(arg1) => Editor

Returns

IGuard