Development Facilities

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.

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.

find and replace strings

Find

Enter a search string and sequentially find strings that match the criteria.

Replace

After entering a search string and a string to replace, sequentially find and replace strings that match the criteria, or find and replace multiple strings at the same time.

Options

Description

Replace in selection only

Only the area selected as a block is replaced with the target.

You can use only the function to find and replace multiple strings in a block at the same time (Replace All)

Find in File

Set the files in the set directory, find the files containing the string that meets the value entered in the search string and the condition, and display them in the form of a list in the Find Results window.

Options

Description

Include sub-folders

Select whether or not to include subdirectories of the directory to be searched in the search target.

Exclude folders

Set the subdirectory name to be excluded from the search target.

You can set more than one name using a semicolon (;).

common options

Options

Description

Direction

Sets the string search direction.

Match Case

Matches the case of the search string.

Match whole words only

Verifies that the search string matches text separated by independent words.

If the search string is "Button", <Button> is treated as a matching result, but Button00 is treated as a non-matching result, as it is recognized as a word associated with a number.

Regular expressions

Choose whether to use regular expressions in search strings or replacement strings.

Regular expressions

It may not work when characters other than alphabets or numbers are set as a search string.

expression

Description

.

Matches any single character, including space and tab characters.

If the search string is ".T", "AT", " T", and "1T" are all matched.

\(...\)

Group subexpressions. Can be used to specify the nth group when using \n expressions.

\n

Group numbers from 1 to 9 can be set during swap operation.

If the search string is "Button\([0-1]\)\([0-9]\)_TEST", setting the string to be replaced with "TEST\1\2_Button" will change the string "Button00_TEST" to "TEST00_Button". can.

\<

Matches the search string to the starting character of text separated by independent words.

Setting the search string to "\<T" will only find the starting characters in "TEST".

\>

Matches the search string as the last character of text separated by independent words.

Setting the search string to "T\>" will only find the last character in "TEST".

\x

Special characters used in regular expressions are treated like regular characters.

Setting the search string to "\[" will find the regular character "[". However, if the search string is set to "[", it is recognized as [...], which means a character set, and does not operate normally.

[...]

character set. For example, [abc] means any of the letters a, b, or c. [a-z] can also indicate a range.

[^...]

It means the rest of the characters except for the character set. For example, [^A-Za-z] means any character except alphabetic characters.

^

The character set after is the first character of the line.

$

Matches the previous set character to the last character of the line.

Setting the search string to ")$" will find the trailing ")" in "function ( )".

*

Matches the previously set character zero or more times.

If you set the search string to "Button0*1", you can find "Button1", "Button01", "Button001".

+

Matches the previously set character one or more times.

If you set the search string to "Button0*1", you can find "Button01", "Button001", "Button0001".

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.

AutoRecover Messagebox

Auto Recover displays the target recovery list and recovers the work in process using the saved backup file.

AutoRecover

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, DataSchema, 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, DataSchema 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, DataSchema Specifications

ServiceList

In ServiceList, the DOMAIN, MODEL items among the ColumnInfo items are required values and the corresponding values should be specified as "metadata".

DataSchema

In DataSchema, 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 Add on

You can create and use Add on to process, check, or output open project information in Nexacro Studio.

You can check or output basic information using Add on Template. You can also modify the template project to create Add on in the desired format.

If Add on (including the nexacrostudio method) is run in NRE, WRE other than the Add on window, then a script error occurs. Add on is designed to operate only in the Add on 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 Add on.

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 > Add on] to display the Add on window.

5

Click the Options button in the Add on 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 Add on.

8

Select the application registered in the Add on window from the drop-down list, the screen is then executed and displayed.

9

Click the button in the Add on 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.