Skip to main content

Event

Overview

  • You can receive Next Design internal processing events and add your own functions.
  • You can execute your own processing in conjunction with internal processing by declaring the Next Design internal processing events to subscribe to and associating event handlers with those events.

List of subscribeable events

The following is a list of subscribeable events.

For more information, see API > Overview > Events.

Application

Event nameDescription
onAfterStartEvent after application start
onBeforeQuitEvent before application quit

Command

Event nameDescription
onBeforeExecuteEvent before command execution
onAfterExecuteEvent after command execution

Project

Event nameDescription
onAfterNewEvent after creating a new project
onBeforeOpenEvent before opening a project
onAfterOpenEvent after opening a project
onBeforeSaveEvent before saving a project
onAfterSaveEvent after saving a project
onBeforeCloseEvent before closing a project
onAfterCloseEvent after closing a project
onBeforeReloadEvent before reloading a project
onAfterReloadEvent after project reload
onAfterModelUnitLoadEvent after additional load

Model

  • Area name: models

  • Event name

Event nameDescription
onBeforeNewEvent before adding model
onAfterNewEvent after adding model
onFieldChangedEvent after changing field value
onBeforeDeleteEvent before deleting model
onBeforeChangeOwnerEvent before changing model parent
onAfterChangeOwnerEvent after changing model parent
onBeforeChangeOrderEvent before changing model order
onAfterChangeOrderEvent after changing model order
onBeforeNewRelationEvent before adding relation
onAfterNewRelationEvent after adding relation
onValidateEvent when validating model
onErrorEvent when adding error
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
onBeforeChangePage before change event
onAfterChangePage after change event

Navigator

Event nameDescription
onShowNavigator display event
onHideNavigator hide event
onSelectionChangedNavigator model selection event

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 you do not subscribe 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 enabled in the following order of priority.

(1) Events that specify a class name or target name as the event filter value.
(2) Events that specify a fully qualified class name as the event filter value (applies only to model event filters).
(3) Events that specify a wildcard: * as the event filter value or omit the event filter.

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

  • If an event is defined multiple times and an event with an empty event handler is written in an event definition with a higher priority, the event subscription will be canceled. (Example: "onAfterNew": "" )
  • If multiple extensions subscribe to the same event, the event firing order between extensions cannot be controlled. The event firing order is the order in which the manifest is loaded.
  • If multiple extensions subscribe to the same event and the event is canceled in one of the extensions, the event will not fire in the remaining extensions.

Event Filters

  • For models, you can narrow down the events to be subscribed to by specifying the class name (or the fully qualified name of the class) of the metamodel as the value of the event filter.
  • For editors, you can narrow down the events to be subscribed to by specifying the view definition name as the value of the event filter.
  • For info windows, you can narrow down the events to be subscribed to by specifying the page name as the value of the event filter.
  • By using this event filter mechanism to narrow down the events to be subscribed to, you can avoid the slowdown in response caused by unnecessary event handlers being called for unnecessary events.

Event Filters for Models

  • Events can be subscribed to only for models of a specific class by specifying the class name in the metamodel of the target model in the class property.
  • You can also specify the fully qualified name of the class instead of the class name.
  • If multiple classes are to be targeted, specify the class names separated by commas.
  • You can also subscribe to events common to all models by specifying the wildcard: * as the value or omitting the property.
  • You cannot specify the inherited class name. You must specify the class name of the model.

Editor event filter

  • By specifying the target view definition name in the viewDefinition property, you can subscribe to events only in 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 in a specific navigator.
  • You can specify the following values ​​as the target navigator name.
  • Model: Model navigator
  • ProductLine: Product line navigator
  • Scm: Configuration management navigator
  • Project: Project navigator
  • Profile: Profile navigator
  • If you specify the wildcard * as the value or omit the property, you can subscribe to events in all navigators.
  • If you want to target multiple navigators, specify the navigator names separated by commas.

Information window event filter

  • By specifying the target page name in the information property, you can subscribe to events only on specific pages.

  • You can specify the following values ​​as the target page name.

  • Error: Error page

  • SearchResult: Search result page

  • Output: Output page

  • If you specify the wildcard * as the value or omit the property, you can subscribe to events on all pages.

  • If you want to target multiple pages, specify the page names separated by commas.

Example of event definition

manifes.json
{ 
"name": "Manifest Test",
"main": "main.cs",
"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

Do not write an empty event in the event handler.
If an event occurs with an empty event, an error will be displayed in the output tab.

Example of an 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 according to the event type, see the interface for each event area in API > Overview > Events.