In-Depth
Activation condition: Controlling Plugin Availability
You can control when the plugin functionality becomes active within the µRadiant editor. This is done by creating activation conditions to the relevant EditorModelExtensions.
The plugin metamodel provides an <activation> element to be defined on EditorModelExtension. The activation
condition can be defined in two ways, each assigning a type to the activation:
- Activate plugin functionality when a certain ontology is loaded (present in the DataRegistry). The activation type
is
ActivateIfOntologyPresent. - Activate plugin functionality when an instance of a certain
ElementTypeis detected in the model. The activation type isActivateIfElementTypePresent.
- Activate if Ontology is present.
- Activate if ElementType is present.
<editorModelExtension
xmlns="https://schemas.normalizedsystems.org/xsd/editorElements/4/0/0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>prime-diagrams</name>
<activation type="editorElements::ActivateIfOntologyPresent" xsi:type="activateIfOntologyPresent">
<ontology>elements</ontology>
</activation>
</editorModelExtension>
The configuration in this example ensures that the prime-diagrams extension will only be active if the elements
ontology is supported by the expansion-resources defined by the project.
<editorModelExtension
xmlns="https://schemas.normalizedsystems.org/xsd/editorElements/4/0/0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>application-project</name>
<activation type="editorElements::ActivateIfElementTypePresent" xsi:type="activateIfElementTypePresent">
<elementType>elements::Application</elementType>
</activation>
</editorModelExtension>
This means the application-project extension will become active only if an instance of elements::Application
exists within the model being edited.
DiagramComponent: Visualizing your model
A DiagramComponent defined in an EditorModelExtension allows for visual representations of the model. When
defined, the editor generates a (customizable) component that can render diagrams. These diagrams are typically
displayed within the 3-pane and diagram views, offering users an intuitive way to understand complex model
structures.
<editorModelExtension xmlns="https://schemas.normalizedsystems.org/xsd/editorElements/4/0/0">
<name>prime-diagrams</name>
<diagramComponents>
<diagramComponent>
<name>DataElementsClass</name>
<title>Data Elements</title>
<autogenerate>false</autogenerate>
<projectViews>
<elementClass>elements::Component</elementClass>
</projectViews>
</diagramComponent>
</diagramComponents>
</editorModelExtension>
ElementTreeExtension: Integrating Model Extensions into the Tree View
An ElementTreeExtension attaches elements to the editor's tree view. This allows elements linked to the model by an extension reference to appeas as nodes in the main structure.
You define ElementTreeExtensions within the <elementTreeExtensions> section of your editorModelExtension:
<editorModelExtension xmlns="https://schemas.normalizedsystems.org/xsd/editorElements/3/4/0">
<name>workflows</name>
<elementTreeExtensions>
<elementTreeExtension>
<name>workflows</name>
<actions>
<editorAction>workflows::createWorkflow</editorAction>
</actions>
<!-- Extension reference used a data source-->
<extensionReference>workflows::Workflow::component</extensionReference>
<nodeType>workflows::Workflow</nodeType>
</elementTreeExtension>
</elementTreeExtensions>
</editorModelExtension>
In this example the <extensionReference>workflows::Workflow::component</extensionReference> indicates that this
extension will draw its elements from the component reference of the workflows::Workflow element.
EditorTask
An EditorTask can be defined within an EditorModelExtension. This element can define a task that needs to run when loading the plugin. It generates a service skeleton that can be customized.