This chapter introduces useful features of Nexacro Studio, which you can utilize when editing files.
Assist
Copy Full Path
This function is designed to copy a current file's path and store it on the clipboard. If a certain file in the tree of the Project Explorer is selected with the explorer activated, the path of the relevant file will be copied.
Open Containing Folder
This function is designed to open the directory of a current file through the file explorer set by the user's operating system. If a certain file in the tree of the Project Explorer is selected with the explorer activated, the directory of the relevant file will be opened.
Open File in Project
This function is designed to show a list of files that are loaded under a current project.
If you enter characters in the Search String box, the Open File in Project window will show you a list of search results, which are the files whose names include the input characters. The list will be renewed in real time as you type more characters. Double-clicking a certain item in the list will open the editor of the relevant file.
Open Service Folder / Open Folder
This function is used to open the pertinent folder of a service or directory (sub-directory of a file type service). To use This function, open the context menu by right-clicking a relevant item on the Project Explorer.
Code Snippet
A code snippet means a piece of codes that is defined by a user in advance. You can define your frequently-used codes as snippets and apply them when you edit files.
Defining a Code Snippet
You can define a snippet by opening the Code Snippet Editor—[EDIT > Code Assist > Snippet] in the ribbon interface or [Assist > Code Snippet] in the command bar interface.
Basic code snippets are provided by Nexacro Studio while you can add your own snippets.
Menu | Description | |
---|---|---|
1 | Add Group | Adds a code snippet group |
2 | Add Code Snippet | Adds a new code snippet |
3 | Delete Code Snippet | Deletes a selected code snippet |
4 | Import Code Snippet | Imports the code snippet created as the XML file or selects the xpackage file and runs the Import Wizard. |
5 | Export Code Snippet | Saves a code snippet in the form of an XML file |
6 | Options | Configures the code snippet file location. |
7 | Code Snippet List | List of code snippets |
8 | Name | Name of the selected snippet |
9 | Shortcut | Defines a shortcut name used to call the relevant snippet (When you code in the XCSS or Script editor, you can apply a code snippet by entering the name defined as a shortcut of the snippet.) |
10 | Description | Description about the snippet |
11 | Code Snippet Source | Defines the codes of the snippet |
Code Snippet Reserved string
You can use the below reserved words when defining code snippets. For instance, $DATE$
will change a character string into an appropriate format that indicates a today's date.
Reserved string | Description | |
---|---|---|
General | $end$ | Desired position of a caret after applying a code snippet |
$selected$ | Currently selected character string; null if there is no selection | |
$clipboard$ | Character string copied to the clipboard | |
$tab$ | Tab character | |
File | $FILE$ | File path that contains the file name |
$FILE_EXT$ | File name with its extension | |
$FILE_BASE$ | File name without its extension | |
$FILE_PATH$ | File path | |
$FILE_EXT_UPPER$ | File extension (upper case) | |
$FILE_BASE_UPPER$ | File name without its extension (upper case) | |
$FILE_PATH_UPPER$ | File path (upper case) | |
Date | $DATE$ | Year/month/day formatted as "yyyy/MM/dd" |
$DATE_REVERSE$ | Current date written according to the locale format | |
$DAY$ | Current day of a month written numerically (without leading zero) | |
$DAY_02$ | Current day of a month formatted as "dd" | |
$DAYNAME$ | Current day of the week written in the abbreviated forms (eg. Sun, Mon) | |
$DAYLONGNAME$ | Current day of the week written in the locale format (eg. Sunday, Monday) | |
$MONTH$ | Current month written numerically (without leading zero) | |
$MONTH_02$ | Current month formatted as "MM" | |
$MONTHNAME$ | Current month written in the abbreviated forms according to the locale format (eg. Jan, Feb) | |
$MONTHLONGNAME$ | Current month written according to the locale format (eg. January, February) | |
$YEAR$ | Current year written numerically | |
$YEAR_02$ | Current year formatted as "yy" | |
Time | $HOUR$ | Current hour written numerically (without leading zero) |
$HOUR_02$ | Current hour formatted as "HH" | |
$MINUTE$ | Current minute formatted as "mm" | |
$SECOND$ | Current second formatted as "ss" |
You can use the reserved words by accessing [Insert reserved string] in the context menu opened form the code snippet editor pane. Otherwise, type the $ symbol and then select a reserved word from the drop-down list that appears automatically.
Using Code Snippets
You can call the list of code snippets by accessing [Code Snippet] in the context menu opened from the script editor or XCSS editor. Select a code snippet from the list, and then the relevant code fraction will be inserted to the location of the cursor.
Code snippet list opened from the script editor
Code snippet list opened from the XCSS editor
If you enter a shortcut that you have defined in the Code Snippet editor, the relevant code snippet will be suggested. If you select the suggested code snippet, it will be inserted.
A code fraction is inserted to the current location. For example, if you move the cursor by pressing the tab key, a code fraction will also be inserted to the same position.
Intellisense
Intellisense is an assistant to help users to edit a file conveniently and quickly. It provides a list of related codes (members, functions, parameters or code snippets) while users type strings in the script or XCSS editor. If you want to open Intellisense without typing a string, enter the Ctrl+Space key.
include
When you edit a script, Intellisense can present you with a list of .xjs files that can be included in the script. When you write the directive include and then enter a quotation mark, Intellisense will automatically appear showing you a file list.
Script
By considering the current editing location in the script editor, Intellisense will display all the members, functions, parameters and code snippets available within the current scope.
If you want to specify a property value through a script, you should write a function that is comprised of the "set_" prefix and the following property name. Otherwise, just write a property name as it is without adding the "set_" prefix, but append "=". Then, Nexacro Studio will automatically convert it into the function beginning with "set_".
The icons in front of each item indicate code types.
XCSS
In the XCSS editor, Intellisense will display all the available selectors, attributes and Code snippets, varying according to editing locations.
The icons in front of each item indicate code types.
Auto Indent
This function indents a selected block automatically in the script editor.
Rename
This function is used to replace a certain character string with another within the same project. You can use This function by right-clicking a certain word in the script editor and opening the context menu.
The range for finding replacements can cover a project, current service or current file according to your choice. If you want to search the character strings in comments, check "Comments." Likewise, check "Strings" if you want to search general character strings.
Code Line Editing
When you edit a script or other types of source codes, you can cut, copy or delete a code line where a caret is placed. You can use the foregoing functions by right-clicking a line from the code editor to open the context menu.
Auto Recover
When you set up the Auto Recover function from the Tools > Options menu, Nexacro Studio will periodically save backups of files being edited.
With Auto Recover configured, when you open a project that was closed abnormally, Nexacro Studio will check the temporary file and prompt you to recover the file from the most recent backup.
Auto Recover displays the target recovery list and recovers the work in process using the saved backup file.
metadata
The function of applying the data received through the metadata service as the component, object id, and text property value is supported.
The metadata service is a function that provides data that can be referenced when setting the id, text property values. It does not automatically reflect changes in data.
For example, even if the text property value of the Button component is selected from metadata and set to "Submit" for the metadata value to be changed to "OK", then the text property value of the component does not change automatically.
Registering metadata Service
1
Double-click the [TypeDefinition > Services] menu in Project Explorer or right-click and select the [Edit] item to open the edit window as a pop-up window.
2
Register the metadata service.
Select "metadata" for the type item and enter the service path, ServiceList, DatasetLayout, and Search Column items. The Service List item has the return value in XML format in which the domain and the model are defined. The DatasetLayout item has the return value in XML format in which the Dataset is defined.
When specifying the ServiceList, DatasetLayout items, parameters can be transmitted in the following format.
http://172.10.12.54:8080/serviceList/ serviceList.jsp ?filter=FILTER value &domain=DOMAIN value &model=MODEL value
If you do not specify the filter parameter, then there may be restrictions on calling the service.
3
If the service is normally registered, then call the metadata service immediately.
4
When the metadata service is called and data is received, the information is displayed in Project Explorer as shown below.
Applying Data Received through metadata Service as id, text Property Values
1
Select the menu [Options] and open the Options window.
2
In the Options window [Project > Advanced > Metadata] item, check to use "Use user-defined metadata".
If the "Use metadata with prefixID" item is checked to use, then the id property value is set in the [prefixID+Metadata] format when the id property value is applied.
3
When you select the component or object and select the id or text property item, you can check the expand button. Click the expand button.
4
Check that the window where you can search and select metadata is opened.
5
Check the item to be reflected as the id or text property value and click the corresponding cell to be reflected as the id or text property value.
Other Functions
Refresh Filtered
You can transmit the filtered data from the service by specifying the filter parameter value. After selecting the service or model in Project Explorer, select the [Refresh Filtered] item from the context menu to display a window where you can enter the text to be filtered.
The entered value is transmitted as the filter parameter value of ServiceList, DatasetLayout.
[serviceURL + serviceList]?filter=sales [serviceURL + datasetLayout]?filter=sales &domain=[DOMAIN value]&model=[MODEL value]
Search Column
If you specify the Search Column item in TypeDefinition, you can specify the search target column when searching for text in the window where you select metadata. If no value is specified, then the search is processed for all columns.
Display text
You can format the metadata information displayed in Project Explorer. The default appearance is as follows.
Depending on the selected item, you can change the format of the metadata information displayed in Project Explorer.
metadata Loading at Project Start
In the Options window [Project > Startup] item, check to use "Load layout information of a business service/metadata on Startup".
The metadata loading at the project start uses the Service.xds file created in the project folder. If the data is changed, you must select the [Refresh] or [Refresh Filtered] item from the context menu after selecting the service or model in Project Explorer.
ServiceList, DatasetLayout Specifications
ServiceList
In ServiceList, the DOMAIN, MODEL items among the ColumnInfo items are required values and the corresponding values should be specified as "metadata".
DatasetLayout
In DatasetLayout, the name, type items among the ColumnInfo items are required values, and the corresponding values should be specified as "metadata", "dataset". Also, define Dataset with "metadata" as id and process the data to be actually used.
Developing External Application
You can create and use External Application to process, check, or output open project information in Nexacro Studio.
You can check or output basic information using External Application Project Template. You can also modify the template project to create External Application in the desired format.
If External Application (including the nexacrostudio method) is run in NRE, WRE other than the External Application window, then a script error occurs. External Application is designed to operate only in the External Application window and the corresponding script error is normal.
ReferenceError: nexacrostudio is not defined
Below, we will look at how to create and connect a simple External Application.
1
Create a new project.
2
Place the Button, TextArea components on the screen.
3
Write the onclick event handler function of the Button component as follows.
this.Button00_onclick = function(obj:nexacro.Button,e:nexacro.ClickEventInfo) { this.TextArea00.set_value(nexacrostudio.request(requesttype.all)); };
4
Select the menu [View > External Application] to display the External Application window.
5
Click the Options button in the External Application window to display the option setting window.
6
Click the [+] button and select the start.json file.
In the file explorer, the output folder location of the currently open project is opened as the default location.
7
Check the content and click the [OK] button to register External Application.
8
Select the application registered in the External Application window from the drop-down list, the screen is then executed and displayed.
9
Click the button in the External Application window to see the information displayed.
10
If you click the Disconnect button, then the connection is terminated and the screen will not be displayed.
When the [?] button is clicked, help related to the nexacrostudio method is displayed.
The corresponding help item may not open normally depending on the execution environment.
Please refer to the Appendix > nexacrostudio Interface > Method item.