Event
Overview
- You can receive Next Design internal processing events and add your own functionality.
- By declaring the Next Design internal processing events to be subscribed and associating an event handler with those events, you can execute your own processing in conjunction with the internal processing.
List of events that can be subscribed
Below is a list of events that you can subscribe to.
For more information, see API> Overview> Events.
Application
Area name: application
event name
Event name Description onAfterStart Event after application startup onBeforeQuit Pre-application event
project
Area name: project
event name
Event name Description onAfterNew Event after creating a new project onBeforeOpen Pre-project opening event onAfterOpen Event after project opening onBeforeSave Pre-project event onAfterSave Event after project save onBeforeClose Pre-project event onAfterClose Event after project close onBeforeReload Pre-project reload event onAfterReload Event after project reload
model
Area name: models
event name
Event name Description onBeforeNew Pre-model event onAfterNew Event after model addition onFieldChanged Event after field value change onBeforeDelete Pre-model event onBeforeChangeOwner Pre-model parent change event onAfterChangeOwner Event after model parent change onBeforeChangeOrder Event before model order change onAfterChangeOrder Event after model order change onBeforeNewRelation Pre-related events onAfterNewRelation Events after related additions onValidate Events during model validation onError Event when error is added onModelEdited Model Editing Event onUndoRedo Undo Redo Event
command
Area name: commands
event name
Event name Description onBeforeExecute Pre-command event onAfterExecute Event after command execution Subscribeable commands
editor
Area name: editors
event name
Event name Description onShow Editor Display Event onHide Editor Hidden Event onSelectionChanged Model selection event in the editor
Page
Area name: pages
event name
Event name Description onBeforeChange Pre-page change event onAfterChange Event after page change
Navigator
Area name: navigators
event name
Event name Description onShow Navigator display event onHide Navigator Hidden Event onSelectionChanged Model selection event in the navigator
Information window
Area name: informations
event name
Event name Description onShow Information Window Page Display Event onHide Information window page hidden event onSelectionChanged Information Window Page Display Element Selection Event onDoubleClick Information window page display element Double-click event
Common events
Events that you do not subscribe to do not need to be included in the manifest.
If the same event is duplicated in the manifest, the corresponding event will be valid in the following priority order.
(1) Event for which the class name or target name is specified in the event filter value
(2) Event for which the fully qualified name of the class is specified in the value of the event filter (only for the event filter of the model)
(3) Events for which wildcard:*
is specified or the event filter is omitted for the event filter valueIn addition, if you duplicate an event within the same priority, the first defined event is valid.
If an event is duplicated and the event handler describes an empty event in the high priority event definition, the event will be unsubscribed. (Example:
" onAfterNew ":" "
)If multiple extensions subscribe to the same event, you cannot control the event firing order between the extensions. The event firing order is the manifest loading order.
If you subscribe to the same event with multiple extensions and cancel that event with one of the extensions, the remaining extensions will not fire the event.
Event filter
- For models, you can filter the events you subscribe to by specifying the metamodel class name (or the fully qualified name of the class) in the event filter value.
- For the editor, you can narrow down the events to subscribe by specifying the view definition name in the value of the event filter.
- For the information window, you can narrow down the events to subscribe by specifying the page name in the value of the event filter.
- By using this event filter mechanism to narrow down the events to be subscribed, it is possible to prevent unnecessary event handlers from being called unnecessarily and reducing the response.
Model event filter
- By specifying the class name in the metamodel of the target model in the class property, you can subscribe to the event only in the model of a specific class.
- You can also specify the fully qualified name of the class instead of the class name.
- When targeting multiple classes, specify the class names separated by commas.
- If you specify the wildcard:
*
for the value or omit the property, you can subscribe to the event common to all models. - You cannot specify the inheritance source class name. You need to 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 the event only in a specific view definition.
- When targeting multiple view definitions, specify the view definition names separated by commas.
Navigator event filter
- By specifying the target navigator name in the navigator property, you can subscribe to the event only in a specific navigator.
- You can specify the following values for the target navigator name.
Model
: Model navigatorProductLine
: Product Line NavigatorScm
: Configuration management navigatorProject
: Project navigatorProfile
: Profile navigator
- If you specify the wildcard:
*
for the value or omit the property, you can subscribe to the event in all navigators. - When targeting 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 the event only on a specific page.
- You can specify the following values for the target page name.
Error
: Error pageSearchResult
: Search result pageOutput
: Output page
- If you specify the wildcard:
*
for the value or omit the property, you can subscribe to the event on all pages. - When targeting multiple pages, specify the page names separated by commas.
Event definition example
In the example below, an event that you do not subscribe to (an event with an empty event handler) is also described, but you do not need to actually describe it.
{
"name": "Manifest Test",
"main": "main.cs",
"lifecycle": "project",
"extensionPoints":
{
"events":
{
"application":
{
"onAfterStart": "",
"onBeforeQuit": ""
},
"proejct":
{
"onAfterNew": "",
"onBeforeOpen": "",
"onAfterOpen": "",
"onBeforeSave": "ProjectOnBeforeSave",
"onAfterSave": "",
"onBeforeClose": "",
"onAfterClose": "",
"onBeforeReload": "",
"onAfterReload": ""
},
"models":
[
{
"class": "*",
"onBeforeNew": "",
"onAfterNew": "AllModel_OnNew",
"onFieldChanged": "",
"onBeforeDelete": "",
"onBeforeChangeOwner": "",
"onAfterChangeOwner": "",
"onBeforeChangeOrder": "",
"onAfterChangeOrder": "",
"onBeforeNewRelation": "",
"onAfterNewRelation": "",
"onValidate": "",
"onError": "AllModel_OnError"
},
{
"class": "UseCase",
"onAfterNew": "UseCase_OnNew",
"onFieldChanged": "UseCase_OnFieldChanged",
"onBeforeDelete": "UseCase_OnBeforeDelete",
"onValidate": "UseCase_OnValidate",
"onError": ""
},
{
"class": "AnalysisFunctionType, SoftwareFunctionType",
"onAfterNew": "FunctionType_OnNew"
}
],,
"commands":
[
{
"commandId": "myExtension.createBlock",
"onBeforeExecute": "CommandOnBeforeCreateBlock",
"onAfterExecute": ""
},
{
"commandId": "myExtension.updateBlock",
"onBeforeExecute": "",
"onAfterExecute": "CommandOnAfterUpdateBlock"
}
],,
"editors":
[
{
"viewDefinition": "*",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
},
{
"viewDefinition": "logicalFunctionDiagaram",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
},
{
"viewDefinition": "logicalFunctionDetailForm",
"onShow": "",
"onSelectionChanged": ""
}
],,
"pages":
{
"onBeforeChange": "",
"onAfterChange": ""
},
"navigators":
[
{
"navigator": "Model",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
},
{
"navigator": "Profile",
"onShow": "",
"onHide": "",
"onSelectionChanged": ""
}
],,
"informations":
[
{
"information": "*",
"onShow": "",
"onHide": "",
"onSelectionChanged": "",
"onDoubleClick": ""
}
]
},
"commands": [
{
"id": "myExtension.createBlock",
"execFunc": "createBlock"
},
{
"id": "myExtension.updateBlock",
"execFunc": "updateBlock"
},
{
"id": "myExtension.generateCode",
"execFunc": "generateCode"
}
]
}
}
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 the event parameters according to the event type, refer to the interface for each event area from API> Overview> Events. please.