Data Model editor
The Data Model editor is used for adding, removing, and editing the properties of a Data Model. It works in conjunction with the Properties view, where meta-properties1 are displayed and can be configured.
Opening a Data Model renders the Data Model editor visible. To open a Data Model, double click its .model
file from
the Navigator view or select the file (either via clicking or arrow keys) and press .
Object properties
To show the properties of the Data Model, you can either click the Show Model Properties button from the editor toolbar or click on any empty space in the model tree.
Adding properties
The ways in which you can add a property to Data Model are:
-
Using the toolbar
- Click the plus-shaped green button in the toolbar.
- Click one of the menu items in the appearing menu to select the type of property you want to add.
-
Using the context menu
Right click on the model tree, select Add, and then click the type of property you want to add.
-
Using keyboard shortcuts
-
Via content-assist
Depending on the context of where you choose to add a property, the to-be-created property may either be added as the property of the opened Data Model, or the property of another property that is a Data Model. For example, selecting a Data Model property (a property that is a Data Model) in the tree and then adding a new property from there will add a new property to that Data Model instead of the root Data Model.
Renaming a property
There are multiple ways to rename a Data Model property:
-
Using context menu
Right-click the property then select Rename.
-
Using the Properties view
Select the property to be renamed, go to the Properties view, and then change the value of the
Name
property. -
Using keyboard shortcuts
Select the property you want to rename and then press the or key to rename it.
Deleting a property
You can delete a Data Model property by:
-
Using the toolbar
Select all the properties you want to delete and then click on the red 'x' button in the toolbar.
-
Using the context menu
Select all the properties you want to delete, right click, and then select Delete.
-
Using keyboard shortcuts
Select all the properties you want to delete and then press .
Adding referenced Data Models
You can also add an existing Data Model as a property. When the model is added, you will see a parenthesis with a name
in it, which is the name of the referenced model. You will also see that its Reference
object property has the same
value. These models are called referenced Data Models.
To add referenced Data Models as a property, you may:
- Use content-assist
- Drag and drop the model from the Navigator view to the model tree
Here is a short demonstration showing the use of both options:
Unmodifiable properties
A referenced Data Model's properties could not be modified, but you can add more properties. You can also modify the object properties of a referenced Data Model but not the object properties of its referenced Data Models, if any (for nested Data Models).
Opening a referenced model from the Data Model editor
You can open a property's referenced model in the editor by right-clicking the property and then selecting Open Declaration. You can also do this using the Open Declaration button in the Properties view, which appears when the property is selected. You can also press on the selected property to do the same.
Converting a property's type
When you've mistakenly added a model property with the wrong type, rather than deleting the property and adding a new property with the appropriate type, you can convert its type instead.
To convert the property type of a property:
- Right click on the property.
- Select Convert To from the appearing context menu.
- Select the appropriate type from the nested menu.
After converting a property, you will be able to see the icon change, as well as the Type
object property from the
Properties view.
Moving properties
You can also rearrange your model properties by moving them. You can move properties up, down, left, and right. Moving up means the selected property will switch places with the property that was originally above it. Likewise, moving down means the selected property will switch places with the property originally below it. Moving left would prompt Martini to place the property under the nearest model above the property; the same goes for moving right, but it would go under the nearest model underneath the property.
There are multiple ways to move properties:
-
Using the toolbar
To move properties using the toolbar, select all the properties you want (select multiple by pressing while left-clicking) to move and then click on one of the arrowhead-shaped buttons.
-
Using keyboard shortcuts
-
Via drag and drop
Adding comments to a property
You can add comments to model properties. When a model property has a comment, you will be able to see it in the model tree. There are three ways to add a comment:
-
Using the Properties view
In the Properties view, go to the Comments tab, and then add your comments in the provided text area.
-
Using keyboard shortcuts
Select a property, press , and then type in your comments for that property.
-
Using the toolbar
Searching properties
You can search Data Model properties via the search bar located in the toolbar of the Data Model editor. Martini tries
to find properties whose Name
object property matches the typed-in text in the search bar.
JSON and XML representations
You can also check the JSON or XML representation of a Data Model property simply by clicking the Show JSON
or Show XML button in the toolbar, respectively. The JSON and XML definition also shows the value of the property
based on the meta property Default Value
.
Shortcuts
Command | Description | Shortcut |
---|---|---|
Add big decimal | Adds a big decimal property | ⌥⇧D |
Add big integer | Adds a big integer property | |
Add boolean | Adds a boolean property | |
Add byte array | Adds a byte array property | |
Add byte | Adds a byte property | |
Add character | Adds a character property | |
Add date | Adds a date property | |
Add double | Adds a double property | |
Add float | Adds a float property | |
Add integer | Adds a integer property | |
Add long | Adds a long property | |
Add model | Adds a model property | |
Add object | Adds a object property | |
Add short | Adds a short property | |
Add string | Adds a string property | |
Rename | Renames the selected property | or |
Delete | Deletes all selected properties | |
Move property up | Switches the selected property with the property above it | |
Move property down | Switches the selected property with the property below it | |
Move property left | Takes the property out of the model property it is under | |
Move property right | Adds the property as a property of the nearest model above it | |
Add property comments | Adds a comment to the selected property | |
Open Declaration | Opens the referenced model's file |
Customize shortcuts
The shortcuts listed above are the default keyboard shortcuts for Martini Desktop. You can modify these key-action mappings by opening the Preferences menu, expanding General, and then clicking on Keys.
Command | Description | Shortcut |
---|---|---|
Add big decimal | Adds a big decimal property | |
Add big integer | Adds a big integer property | |
Add boolean | Adds a boolean property | |
Add byte array | Adds a byte array property | |
Add byte | Adds a byte property | |
Add character | Adds a character property | |
Add date | Adds a date property | |
Add double | Adds a double property | |
Add float | Adds a float property | |
Add integer | Adds a integer property | |
Add long | Adds a long property | |
Add model | Adds a model property | |
Add object | Adds a object property | |
Add short | Adds a short property | |
Add string | Adds a string property | |
Move property up | Switches the selected property with the property above it | |
Move property down | Switches the selected property with the property below it | |
Move property left | Takes the property out of the model property it is under | |
Move property right | Adds the property as a property of the nearest model above it | |
Add property comments | Add comments to the selected property | |
Open Declaration | Opens the referenced model's file |
Show shortcuts
To show the entire list of shortcuts, press .
-
Or in other words, the properties of a property. ↩