Working with Studio Editor
Overview
Studio contains a full featured Editor that helps in developing applications. Some important Editor features are:
- Editing code: Cut, copy, paste, undo, redo, change case
- Matching parentheses: Selects the matching parenthesis in the code if any
- Syntax coloring: Supports color coding for Java, JSP, HTML and XML files
- Abbreviations: Completes abbreviations for a code and allows the user to set new abbreviations for common commands
- Colors and fonts: Enables the user to set a colour for a particular token in a code
- Bookmarks: Enables easy manoeuvrability between lines
- Show line number: A gutter in Editor exhibits line numbers for an open file
- Configurable new line character: Enables the user to configure a new line character
- Handling read-only files: Enables the user to convert a file into read only
This document describes Editor UI, how to set Editor properties using the IDE options, and using Editor features.
Parts of Editor
Studio Editor has the following parts:
- Gutter: Displays bookmarks and breakpoints that are added
- Line number gutter: Shows line number for the open file
- Row and column box: Displays the row and column number for the caret position
- Read only box: Converts the file from editable format to read only and vice versa when clicked
- Validation status box: Shows the validation status as `errors found in file' and `errors not found in file' for the file currently open in the Editor
- Overview bar: Displays the number of errors and respective error messages
Setting IDE options for Editor
To set Editor properties, select File > IDE Options from the main menu. This panel provides the following buttons for each IDE option:
Table 1:
|
Buttons
|
Functions
|
|
Reset to Default
|
Resets the configuration to default settings
|
|
Apply
|
Saves the settings for the open file only
|
|
Save and Close
|
Saves the current settings and close the panel
|
|
Cancel
|
Retains the last saved settings
|
Configure properties as described in the following sections.
Setting general properties
In the IDE Options panel, select General and enter details for Studio Settings, as per requirement.
- File chooser remembers last opened folder: Selecting File > Open opens the file chooser that displays the last used folder
- Reopen last used Desk as startup: On Studio restart, the last used desk opens automatically
- Recent Desks count: Maximum number of desks that can be listed in the desk menu can be set here. The count ranges between 0 to 10
- Recent Files count: Maximum number of files that can be displayed in the file menu can be set here. The count ranges between 0 to 10
- Auto Interface Code Generation: Generates the home and remote interfaces automatically, each time a bean is created
- Browser Command: The path of browser to be used to view all JSP and HTML files
- Exclude Files and Folders: Studio does not open files that exist in the locations mentioned in this field
Setting Editor properties
Select Editor in the IDE Options panel and enter details as required. To configure general Studio properties, select File > IDE Options from the main menu.
- Tab Size: Set tab character size between 2 and 8
- Column Line: Specify column line number ranging between 1 and 998. It defines the number of characters that can be typed in a file open in Editor. A gray line is displayed at the specified column position
- Use Spaces For Tab Character: Press the Tab key to insert spaces equivalent to the tab size, in the open file
- Auto Indent: Enables automatic indentation on adding a new line in Editor
- Blinking Caret: Make the caret blink
- Bracket Highlighting: Highlight the corresponding brace for the selected one
- Show Line Number: Introduces the line number gutter and displays row number for each line in the open file
- New Line character: Allows to match a new line character \n, return character \r, both \n\r, restore character, or system dependent character to be used while saving a file.
- For example, System dependent selects the new line character based on the OS. \r\n for Windows, \n for Unix
Setting abbreviation properties
A list of abbreviations is provided that help to capture commonly used code snippets. Studio enables you to:
- Add and remove abbreviations
- Switch abbreviations on and off
Select Abbreviations in the IDE Options panel. A list of predefined abbreviations is displayed.
To add or modify an abbreviation, type the abbreviation name in Abbreviation field and text to be replaced in the Value field. Always place the cursor at the position where it should appear after the abbreviation has been expanded. Click plus to add abbreviation and minus to remove an abbreviation. In Editor, type the abbreviation defined and press Space key to complete the line. For example, typing SOP and pressing Space key converts it to System.out.println(" ");
Abbreviations can be switched on and off by checking and un-checking the Abbreviations checkbox in the Edit menu. Abbreviations are enabled by default.
Setting colors and fonts
Studio enables you to set display colors and fonts for frequently used coding languages. Select Colors And Fonts in the IDE Options panel, set attributes as per requirement, and preview the effect before applying settings.
- Font: Set fonts for the text
- Size: Set the font size between 6 to 32
- Editor foreground Color: Select and set the font colour by double clicking the colour field. Black is selected by default
- Editor background Color: Select the background colour for the line where the cursor is placed by double clicking the colour field. White is selected by default
- Show LineHighlighter: Set the colour to highlight the line where the cursor is placed. It is yellow by default
Using other Editor features
Word completion
Word completion is useful when the classes or fields being used are not already created. Press Ctrl + Enter while typing the class or field name for the second time. This displays all the words beginning with that character one after another. Select the required word, release the keys to complete the word automatically. For example, type QueueConnerctionFactory and at the next usage, type Q and press Ctrl + Enter. The word is completed as QueueConnectionFactory.
Line completion
Type one or more initial characters of the line of code to be completed and press Ctrl + K. This displays all possible lines one after another. On reaching the required line of code, release the keys to complete the line automatically. The cursor is placed at the end of the sentence.
This feature is useful in case of long import statements and multiple variable declarations.
Joining lines
Place the cursor at the beginning or end of a line in the open file. Press Ctrl + J to join the next line to the selected line.
Viewing open files
Select View > Show Open File(s) or press Shift + F11.
It displays the names of all open files in a panel. Single click on the name of a file displays it in the Display Panel. Another alternative to move between open files is to press Ctrl + Tab. On Linux, to move between open files press Ctrl + Tab, release them and press Ctrl key again.
Introducing a newline
Press Shift + Enter to introduce a new line after the current line and set the caret position in the newline. Press Ctrl + Enter to introduce a newline at the caret position with out moving the caret.
Saving untitled files
Studio intelligently saves an untitled file by considering the absolute path of the open desk and module, currently open in the Editor. A node for the new file is created in the desk tree.
This eliminates the need to save an untitled file at a temporary location and import it later into a desired location under a desk.
Reopening last used files on Studio restart
Studio remembers all the last opened files; all desks and files that were open in the Editor before, are reopened automatically on Studio restart. The last used file is made the current file. The view-port and location of the caret are same as before.
Caret position in a file
When a file is closed, Editor remembers the caret position. On reopening the file, the view-port and location of caret are the same as they were when the file was last closed.
Table 2: Edit options available in Studio menu
|
Item
|
Description
|
Shortcut Keys
|
|
Undo
|
Undos the changes made to the text
|
Ctrl + Z
|
|
Redo
|
Redos the changes done by undo
|
Ctrl + Y
|
|
Cut
|
Cuts the selected text
|
Ctrl + X
|
|
Copy
|
Copies the selected text
|
Ctrl+ C
|
|
Paste
|
Places the copied text where the caret is positioned
|
Ctrl+ V
|
|
Delete
|
Deletes the selected text
|
Delete
|
|
Change Case
|
Upper Case: Converts the selected expression into upper case
Lower Case: Converts the selected expression into lower case
Invert Case: Converts upper case to lower or vice-versa for the selected expression
|
Ctrl+U
Ctrl+L
Ctrl+I
|
|
Abbreviation
|
Enables or disables abbreviations listed under IDE Options
|
|
|
Select All
|
Selects the complete text in the open file
|
Ctrl+A
|
Edit menu
If there is no selection in the Editor and a cut (Ctrl + X) or copy (Ctrl + C) operation is performed, it is applied to the current line.
Table 3:
|
Item
|
Description
|
Shortcut Keys
|
|
Find
|
Searches for keywords and the nearest match. Provides advanced search options such as, Match Whole Word, Match Case, Regular Expression, Find Backwards
|
Ctrl + Shift + F
|
|
Find Next
|
Searches for the next occurrence of the text found during a search
|
F3
|
|
Find Previous
|
Searches for the previous occurrence of the text found during a search
|
Shift + F3
|
|
Find Word at Caret
|
Finds the next or previous occurrence of a word and highlights it
|
Ctrl+F3
|
|
Highlight at Occurrences
|
Highlights all occurrences of a selected word or line
|
Ctrl+Shift+F7
|
|
Incremental Search
|
Highlights the string specified in the search panel. A string with no match appears in red colour
|
Ctrl + F
|
|
Replace
|
Replaces one text with another. Provides advanced search options such as, Match Whole Word, Replace in Selection, Regular Expression, Match Case
|
Ctrl + Shift + P
|
|
Find in Files
|
Searches for a word in all files of a type such as *.java, in a selected folder. Provides with advanced search options such as, Match Whole Word, Match Case, Open in New Tab, Look in Subfolders, Regular Expression, Search in desk
|
Ctrl l+ Shift + I
|
|
Find Usages
|
Searches for a word in open files only.
|
Ctrl + Alt + F7
|
|
Go to Line
|
Moves cursor to the specified line number
|
Ctrl + G
|
|
Add/Remove Bookmark
|
Adds or removes bookmarks to or from the active file
|
Ctrl + B
|
|
Remove All Bookmarks
|
Removes all existing bookmarks from the active file
|
Ctrl + Shift + B
|
|
Next Bookmark
|
Takes the control to the next bookmark in the active file and places the cursor at the beginning of the line
|
F2
|
|
Previous Bookmark
|
Takes the control to the previous bookmark and places the cursor at the begining of the line
|
Shift+ F2
|
Search menu
Using Incremental search
Select a desk node in the explore panel and type the string to be searched for. As each character is typed, the search proceeds to the next occurrence of the string in the open tree structure in the explore panel as specified so far. Press Enter or Return to open the required file. Typing a word which has no match makes the text appear red.
Adding, removing, and navigating between bookmarks
Bookmarks are placed on lines for easy manoeuvrability between lines. Place the cursor at a suitable position, select Search > Add/ Remove Bookmarks or press Ctrl + B. A bookmark corresponding to the line is introduced into the gutter.
Use Search menu option or press F2 to take the control to the next bookmark in the file. The cursor is placed at the beginning of the line. To take control to the previous bookmark, use Search menu option or press Shift + F2.
The cursor is placed at the beginning of the line.
Regular expressions
Regular expressions are specialized sets of patterns available to specify a set of possible strings that can be matched with other patterns. Studio Editor provides the following characters to be used as Regular Expressions for matching patterns.
Table 4:
|
Positional Operators
|
|
^
|
Matches at the beginning of a line
|
|
$
|
Matches at the end of a line
|
|
\A
|
Matches at the beginning of an entire String
|
|
\Z
|
Matches at the end of an entire String
|
|
\b
|
Matches at a word break
|
|
\B
|
Matches at a non-word break
|
Table 5:
|
One Character Operators
|
|
.
|
Matches any single character
|
|
\d
|
Matches any decimal digit
|
|
\D
|
Matches any non-digit
|
|
\n
|
Matches a new-line character
|
|
\r
|
Matches a return character
|
|
\s
|
Matches any white-space character
|
|
\S
|
Matches any non-white-space character
|
|
\t
|
Matches a horizontal tab character
|
|
\w
|
Matches any word (alphanumeric) character
|
|
\W
|
Matches any non-word (alphanumeric) character
|
|
\x
|
Matches the character x, if x is not one of the above listed escape sequences
|
Table 6:
|
|
Character Class Operator
|
|
[abc]
|
Matches any character in the set a, b or c
|
|
[^abc]
|
Matches any character not in the set a, b or c
|
|
[a-z]
|
Matches any character in the range a to z, inclusive
|
|
A leading or trailing dash is interpreted literally
|
Table 7:
|
Repeating Operators
|
|
?
|
Matches the preceding expression or the null string
|
|
*
|
Matches the null string or any number of repetitions of the preceding expression
|
|
+
|
Matches one or more repetitions of the preceding expression
|
|
{m}
|
Matches exactly m repetitions of the one-character expression
|
|
{m,n}
|
Matches between m and n repetitions of the preceding expression, inclusive
|
|
{m,}
|
Matches m or more repetitions of the preceding expression
|
|
These special characters are used to operate on the previous atomic expression
|