Skip to main content

Event

Overview

  • You can receive Next Design internal processing events and add your own functionality.

  • By declaring Next Design internal processing events to subscribe to and associating event handlers with those events, you can execute your own processing in conjunction with internal processing.

List of Subscribeable Events

The list of subscribeable events is shown below.

For details, please refer to API > Overview > Events.

Application

Event NameDescription
onAfterStartEvent after application startup
onBeforeQuitEvent before application shutdown

Command

Event NameDescription
onBeforeExecuteEvent before command execution
onAfterExecuteEvent after command execution

Project

Event NameDescription
onAfterNewEvent after new project creation
onBeforeOpenEvent before project opening
onAfterOpenEvent after project opening
onBeforeSaveEvent before project saving
onAfterSaveEvent after project saving
onBeforeCloseEvent before project closing
onAfterCloseEvent after project closing
onBeforeReloadEvent before project reload
onAfterReloadEvent after project reload
onAfterModelUnitLoadEvent after additional load

Model

  • Area Name: models

  • Event Name

Event NameDescription
onBeforeNewEvent before model addition
onAfterNewEvent after model addition
onFieldChangedEvent after field value change
onBeforeDeleteEvent before model deletion
onBeforeChangeOwnerEvent before model parent change
onAfterChangeOwnerEvent after model parent change
onBeforeChangeOrderEvent before model order change
onAfterChangeOrderEvent after model order change
onBeforeNewRelationEvent before relation addition
onAfterNewRelationEvent after relation addition
onValidateEvent during model validation
onErrorError Added Event
onSelectionChangedModel Selection Event
onModelEditedModel Editing Event
onUndoRedoUndo/Redo Event

Editor

Event NameDescription
onShowEditor Display Event
onHideEditor Hide Event
onSelectionChangedModel Selection Event in Editor

Page

  • Area Name: pages

  • Event Name

Event NameDescription
onBeforeChangeEvent before page change
onAfterChangeEvent after page change

Navigator

Event nameDescription
onShowNavigator display event
onHideNavigator hide event
onSelectionChangedModel selection event in navigator

Information window

Event nameDescription
onShowInformation Window Page Display Event
onHideInformation Window Page Hide Event
onSelectionChangedInformation Window Page Display Element Selection Event
onDoubleClickInformation Window Page Display Element Double-Click Event

Common Events

  • Events that are not subscribed to do not need to be described in the manifest.
  • If the same event is defined multiple times in the manifest, the following events will be effective in order of priority:

(1) Events where the event filter value specifies a class name or target name

(2) Events where the event filter value specifies the fully qualified name of a class (only applies to model event filters)

(3) Events where the event filter value specifies a wildcard: *, or where the event filter is omitted

Furthermore, if events are defined multiple times within the same priority, the first defined event will be effective.

  • If you define an event multiple times and include an event with an empty event handler in a higher-priority event definition, the event subscription will be canceled. (Example: "onAfterNew": "")
  • If multiple extensions subscribe to the same event, you cannot control the order in which events fire between extensions. The order in which events fire is determined by the order in which the manifests are read.
  • If multiple extensions subscribe to the same event and one extension cancels the event, the remaining extensions will not fire the event.

Event Filters

  • For models, you can narrow down the events you subscribe to by specifying the metamodel class name (or the fully qualified name of the class) as the event filter value.
  • For editors, you can narrow down the events you subscribe to by specifying the view definition name as the event filter value.
  • For info windows, you can narrow down the events you subscribe to by specifying the page name as the event filter value.
  • By using this event filter mechanism to narrow down the events you subscribe to, you can avoid unnecessary event handler calls for unnecessary events, which can degrade response times.

Model Event Filtering

  • By specifying the class name in the target model's metamodel in the class property, you can subscribe to events only for models of that specific class.
  • You can also specify the fully qualified name of the class instead of just the class name.
  • If targeting multiple classes, specify the class names separated by commas.
  • Specifying the wildcard * as the value, or omitting the property, allows event subscription common to all models.
  • You cannot specify the name of the inherited class. You must specify the model's class name.

Editor Event Filtering

  • By specifying the target view definition name in the viewDefinition property, you can subscribe to events only for specific view definitions.
  • If targeting multiple view definitions, specify the view definition names separated by commas.
  • By specifying the target navigator name in the navigator property, you can subscribe to events only for specific navigators.

  • The following values ​​can be specified as the target navigator name:

  • Model: Model Navigator

  • ProductLine: Product Line Navigator

  • Scm: Configuration Management Navigator

  • Project: Project Navigator

  • Profile: Profile Navigator

  • Specifying a wildcard: * in the value, or omitting the property, allows event subscription for all navigators.

  • To target multiple navigators, specify the navigator names separated by commas.

Event Filtering in the Information Window

  • Specifying the target page name in the information property allows event subscription only for specific pages.
  • The following values ​​can be specified as the target page name:
  • Error: Error Page
  • SearchResult: Search Results Page
  • Output: Output Page
  • Specifying a wildcard: * in the value, or omitting the property, allows event subscription for all pages.
  • To target multiple pages, specify the page names separated by commas. ## Example of Event Definition
manifes.json
{
"name": "Manifest Test",

"main": "main.cs", //For C# scripts. "main.py" for Python
"lifecycle": "project",

"extensionPoints":
{
"events":
{
"proejct" :
{
"onBeforeSave": "ProjectOnBeforeSave"
},

"models" :
[
{
"class": "*",
"onAfterNew": "AllModel_OnNew",
"onError": "AllModel_OnError"
},
{
"class": "UseCase",
"onAfterNew": "UseCase_OnNew",
"onFieldChanged": "UseCase_OnFieldChanged",
"onBeforeDelete": "UseCase_OnBeforeDelete",
"onValidate": "UseCase_OnValidate"
},
{
"class": "AnalysisFunctionType,SoftwareFunctionType",
"onAfterNew": "FunctionType_OnNew"
}
],

"commands":
[
{
"commandId": "myExtension.createBlock",
"onBeforeExecute": "CommandOnBeforeCreateBlock"
},
{
"commandId": "myExtension.updateBlock",
"onAfterExecute": "CommandOnAfterUpdateBlock"
}
],

"editors":
[
{
"viewDefinition": "*"
},
{
"viewDefinition": "logicalFunctionDiagaram"
},
{
"viewDefinition": "logicalFunctionDetailForm"
}
],

"navigators":
[
{
"navigator": "Model"
},
{
"navigator": "Profile"
}
],

"information" :
[ {
"information": "*"
}
]
},

"commands": [
{
"id": "myExtension.createBlock",
"execFunc": "createBlock"
},
{
"id": "myExtension.updateBlock",
"execFunc": "updateBlock"
},
{
"id": "myExtension.generateCode",
"execFunc": "generateCode"
}
]
}
}
info

Please do not write empty events in event handlers.
If an event occurs with an empty event description, an error will be displayed in the output tab.

Event handler implementation example

public void ProjectOnBeforeSave(IEventContext context, IEventParams eventParams)
{
var projectBeforeSaveEventParams = eventParams as ProjectBeforeSaveEventParams;
if ((projectBeforeSaveEventParams != null) && (projectBeforeSaveEventParams.Project.Name == "temporary"))
{
projectBeforeSaveEventParams.Cancel();
}
}
note

For details on event parameters depending on the event type, please refer to the interface for each event area in API > Overview > Events.