Skip to main content

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 nameDescription
    onAfterStartEvent after application startup
    onBeforeQuitPre-application event
project
  • Area name: project

  • event name

    Event nameDescription
    onAfterNewEvent after creating a new project
    onBeforeOpenPre-project opening event
    onAfterOpenEvent after project opening
    onBeforeSavePre-project event
    onAfterSaveEvent after project save
    onBeforeClosePre-project event
    onAfterCloseEvent after project close
    onBeforeReloadPre-project reload event
    onAfterReloadEvent after project reload
model
  • Area name: models

  • event name

    Event nameDescription
    onBeforeNewPre-model event
    onAfterNewEvent after model addition
    onFieldChangedEvent after field value change
    onBeforeDeletePre-model event
    onBeforeChangeOwnerPre-model parent change event
    onAfterChangeOwnerEvent after model parent change
    onBeforeChangeOrderEvent before model order change
    onAfterChangeOrderEvent after model order change
    onBeforeNewRelationPre-related events
    onAfterNewRelationEvents after related additions
    onValidateEvents during model validation
    onErrorEvent when error is added
    onModelEditedModel Editing Event
    onUndoRedoUndo Redo Event
command
editor
  • Area name: editors

  • event name

    Event nameDescription
    onShowEditor Display Event
    onHideEditor Hidden Event
    onSelectionChangedModel selection event in the editor
Page
  • Area name: pages

  • event name

    Event nameDescription
    onBeforeChangePre-page change event
    onAfterChangeEvent after page change
Navigator
  • Area name: navigators

  • event name

    Event nameDescription
    onShowNavigator display event
    onHideNavigator Hidden Event
    onSelectionChangedModel selection event in the navigator
Information window
  • Area name: informations

  • event name

    Event nameDescription
    onShowInformation Window Page Display Event
    onHideInformation window page hidden 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 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 value

    In 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.
  • 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 navigator
    • ProductLine: Product Line Navigator
    • Scm: Configuration management navigator
    • Project: Project navigator
    • Profile: 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 page
    • SearchResult: Search result page
    • Output: 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.