- Opening the Source Editor
- Managing Automatic Insertion of Closing Characters
- Displaying Line Numbers
- Generating Code Snippets without Leaving the Keyboard
- Using Code Completion
- Inserting Snippets from Code Templates
- Using Editor Hints to Generate Missing Code
- Matching Other Words in a File
- Generating Methods to Implement and Override
- Generating JavaBeans Component Code
- Creating and Using Macros
- Creating and Customizing File Templates
- Handling Imports
- Displaying Javadoc Documentation While Editing
- Formatting Code
- Text Selection Shortcuts
- Navigating within the Current Java File
- Navigating from the Source Editor
- Searching and Replacing
- Deleting Code Safely
- Changing a Method's Signature
- Encapsulating a Field
- Moving a Class to a Different Package
- Moving Class Members to Other Classes
- Creating a Method from Existing Statements
- Creating an Interface from Existing Methods
- Extracting a Superclass to Consolidate Common Methods
- Changing References to Use a Supertype
- Unnesting Classes
- Tracking Notes to Yourself in Your Code
- Comparing Differences Between Two Files
- Splitting the Source Editor
- Maximizing Space for the Source Editor
- Changing Source Editor Keyboard Shortcuts
Managing Automatic Insertion of Closing Characters
When typing in the Source Editor, one of the first things that you will notice is that the closing characters are automatically inserted when you type the opening character. For example, if you type a quote mark, the closing quote mark is inserted at the end of the line. Likewise, parentheses(()), brackets ([]), and curly braces ({}) are completed for you.
While this might seem annoying at first, the feature was designed to not get in your way. If you type the closing character yourself, the automatically inserted character is overwritten. Also, you can end a line by typing a semicolon (;) to finish a statement. The semicolon is inserted at the end of the line after the automatically generated character or characters.
See the following subtopics for information on how to use the insertion of matching closing characters.
Finishing a Statement
When the Source Editor inserts matching characters at the end of the line, this would appear to force you to move the insertion point manually past the closing character before you can type the semicolon. In fact, you can just type the semicolon without moving the insertion point, and it will be placed at the end of the line automatically.
For example, to get the line
ArrayList ls = new ArrayList();
you would only have to type
ArrayList ls = new ArrayList(;
Splitting a String Between Two Lines
If you have a long string that you want to split between two lines, the Source Editor adds the syntax for concatenating the string when you press Enter.
For example, to get the lines
String s = "Though typing can seem tedious, reading long" + "and convoluted sentences can be even worse."
you could type
String s = "Though typing can seem tedious, reading long and convoluted sentences can be even worse.
The final three quote marks and the plus sign (+) are added for you.
If you want to break the line without creating the concatenation, press Shift-Enter.