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

  • Area name: application

  • Event name

    Event nameDescription
    onAfterStartEvent after application startup
    onBeforeQuitEvent before application shutdown

Command

  • Area name: commands

  • Event name

    Event nameDescription
    onBeforeExecuteEvent before command execution
    onAfterExecuteEvent after command execution

Project

  • Area Name: project

  • Event Name

    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
    onAfterReloadProject Reload Event
    onAfterModelUnitLoadAdditional Load Event
    onAfterAutoLoadBackground Auto Load Event
note

The Project Open Event (onAfterOpen) and Project Reload Event (onAfterReload) occur before the background loading of model files is complete. Additionally, the Additional Load Event (onAfterModelUnitLoad) occurs when a model file with manual loading settings is loaded via screen operation. For details, please refer to Changes in V5.1.

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
    onValidateModel Validation Event
    onErrorError Added Event
    onSelectionChangedModel Selection Event
    onModelEditedModel Editing Event
    onUndoRedoUndo/Redo Event

Editor

  • Event Name

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

Page

  • Event Name

    Event NameDescription
    onBeforeChangeEvent before page change
    onAfterChangeEvent after page change

Navigator

  • Area Name: navigators

  • Event Name

    Event NameDescription
    onShowNavigator display event
    onHideNavigator hide event
    onSelectionChangedModel selection event within the navigator

Info Window

  • Area Name: informations

  • Event Name

    Event NameDescription
    onShowInfo Window Page Display Event
    onHideInfo Window Page Hide Event
    onSelectionChangedInfo Window Page Display Element Selection Event
    onDoubleClickInfo 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 corresponding event will be effective in the following 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 events are defined multiple times and an event handler is empty within a higher priority event definition, the event subscription will be canceled. (Example: "onAfterNew": "")

  • If multiple extensions subscribe to the same event, the order in which events fire between extensions cannot be controlled. 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 that event, the event will not fire in the remaining extensions.

Event Filters​

  • For models, you can narrow down the events you subscribe to by specifying the metamodel class name (or fully qualified class name) 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 information 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 that degrade response times.

Model Event Filters​

  • By specifying the metamodel class name of the target model in the class property, you can subscribe to events only for models of that specific class.
  • You can also specify the fully qualified class name instead of 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 inherited class name. You must specify the model's class name.

Editor Event Filters​

  • By specifying the target view definition name in the viewDefinition property, you can subscribe to events only for a specific view definition.
  • If you want to target 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 a specific navigator.
  • 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 the wildcard * in the value, or omitting the property, allows event subscription for all navigators.
  • If you want to target multiple navigators, specify the navigator names separated by commas. .

Event Filtering for Information Window​

  • By specifying the target page name in the information property, you can subscribe to events only on 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, will allow you to subscribe to events on all pages.
  • If targeting 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"
}
],
"informations": [
{
"information": "*"
}
]
},
"commands": [
{
"id": "myExtension.createBlock",
"execFunc": "createBlock"
},
{
"id": "myExtension.updateBlock",
"execFunc": "updateBlock"
},
{
"id": "myExtension.generateCode",
"execFunc": "generateCode"
}
]
}
}
info

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

Example of Event Handler Implementation​

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.