|
Editor Features
Good editing facilities are essential for programming productivity. TJI provides a wide range of features to facilitate the code writing and editing process.
Fonts The default font is a 'Sans Serif' font which provides good readability while preserving space. An all-bold version is available too. A 'Classic' (Courier) font is also available, which is a monospaced font (all characters have the same width). Four different font sizes are available to suit personal preference and screen resolution. Whichever you prefer, your preference is remembered from one run of TJI to the next. Font and font size selection is available from the 'Font' submenu of the 'Edit' menu. The same is true for the tab size. Your font preferences are used across all text in all editors. You can change the font settings at any time.
Indenting Indenting is essential for readable and easily maintainable source files. TJI supports indenting in the following ways :
Selecting Text You may select text either with the mouse or by holding down a shift key and then using the cursor keys. Using the mouse, you may double-click to select a 'word' (in fact, any continuous text between two spaces or various symbols such as ';' and '(') - or treble-click to select a whole line. You may also double-click on the text and, while holding down the mouse button on the second click, 'pull out' the highlight to select the desired text. Or, select a position with mouse or cursor keys, hold down the shift key and select another position with a mouse click to select all the text inbetween. It is also possible to select a line by clicking in the left-hand margin adjacent to the desired line. A purple arrow cursor will appear when your mouse pointer is in the correct area. In the case of a folded block line, the whole block is selected. Ctrl + a can be used to select all the text.
Cut, Copy and Paste Once text has been selected, it may be cut or copied to the multiple-entry clipboard. A text field in the status bar shows the current content of the clipboard. This clip view is restricted to the first 30 characters; if the actual content of the clipboard is longer than that shown, this is indicated by an ellipsis (...). Obviously, the full text is used when pasting. To select an alternative clipboard entry, press the button next to the clipboard view and select from the drop-down list. Note that the following key combinations can be used :
There is also access to the operating system's clipboard. This allows text to be copied to and from other applications. The current system clipboard content (if it is text) is automatically imported when the IDE is started and whenever the IDE regains focus. So, you can go to another program, copy some text, and when you return to the IDE, that text will be in the IDE's clipboard. When text is cut or copied within the IDE, the text is automatically copied to the system clipboard as well as to TJI's clipboard. As is the standard protocol, if any text is currently selected within a source file, it will be replaced by pasted text. Similarly, note that if you select some text and then start typing, the selected text will be replaced by the newly typed text.
Drag & Drop Editing The mouse can be used to edit text by 'dragging' selected text to a new location. Two modes are possible - move and copy. When you point the mouse at selected text, a hand cursor appears. You can now press the mouse button and while holding it down, drag the text to the 'drop' location. This action will move the selected text. If at some time before the drop (mouse button release) you press and hold down the 'Ctrl' key, the text will be copied rather than moved. In the case of 'move', the selected text is moved from the original location at the moment of the drop. To abandon a drag & drop operation midway, you can simply point the mouse cursor back at the original text location, or press the Escape ('Esc') key.
Search and Replace Both 'Search' and 'Search & Replace' are available in the 'Search' tab, with text fields where you can type and edit the text to be searched for and replaced by. Previous search strings are stored in a drop-down list from which the current search string can be selected (and optionally edited). When files are open, the operation takes place on the current editor text (there is no need to save first) - and otherwise on the files on disk. You can search, or search & replace, either in the current editor or in the whole project (all the project files). The search can optionally be made case sensitive. You can also choose whether the search will find only 'Whole Word' occurences - not the search text within a longer word. A 'whole word' is text and numerals surrounded by 'whitespace' (space, new-line, tab) or symbols (such as ';'). Further, in the case of searching within the current editor, you can choose to search from the current caret position down or up, or the whole text. If a selection is current, search or search & replace is limited to the selected text (if the 'only in selected text checkbox is ticked) - which can be very useful sometimes. If you search in the current editor, all found occurences will be highlighted. You can use the 'next' and 'previous' buttons to jump from one to another. The 'Clear' button will remove all the highlights. When searching in the whole project, the result tree shows all the occurences found per source file (whether the source files are open or not). Clicking on an entry in the result tree will take you straight to that occurence, opening the source file first if it is not already open. In the case of Search & Replace in the current editor, a confirmation dialog box appears at each occurrence of the searched for text, offering you the option to replace the occurrence, skip to the next, or cancel (exit) searching. You can also choose to replace 'All', but be careful! The Overview Bar will show the location of found occurrences throughout the current file. Search & Replace throughout the project proceeds without a confirmation dialog for each change. Search & Replace can also be invoked by typing the key combination Ctrl + f ('f' for 'find') and also from the 'Edit' menu. Or simply click on the 'Search and Replace' tab.
Syntax Coloring You may choose to view your source code with color coding of syntax markers, Java keywords, and comments. This can ease the reading of source code considerably, thereby helping you to spot errors, for example. Colour syntax is updated as you type. Color syntax is also available for HTML, XML and JSP source files. If you find that the colour syntax feature slows operation with very large files, it can be switched off using an option in the 'Editor Options' submenu of the 'Options' menu. To further improve performance, you can also disable the 'Split View' and 'Syntax Checking' features. Whether you choose syntax coloring or not, you have the choice of a white or a black editor page. The black option is easier on the eye and enhances syntax colors and readbility - but the choice is yours.
Undo & Redo The Undo function allows you to 'roll back' editing changes (edits) - both insertions and deletions. Redo does the opposite - it allows you to 'undo your undos'. You can undo edits as far back as the start of changes - to the state of the document when it was created, loaded or last saved. Note that if you undo to a particular point and then begin editing again, those edits that have been undone can no longer be recovered (those edits are thrown away); this is standard undo/redo protocol. It is still possible to roll back to the document's original state. TJI allows you to 'Undo All' - which restores the document to its original state before any edits were made (or it was last saved). This option is available from the 'Edit' menu. An edit is normally a 'word' - any text between spaces, tabs and end-of-line returns - but multi-word insertions (such as pasted text) and deletions count as a single edit. Undo and Redo are also available from buttons on the tool bar. Undo (single step) can also be invoked by typing the key combination Ctrl + z
Revert to Backup You can choose to revert an open Java source file to one of the previous 10 backup copies. TJI automatically stores a backup of open Java source files approximately every 20 minutes of activity. By selecting the 'Revert' option from the 'Edit' menu you will see a list of up to 10 backups listed by date and time. You can view any of these backups in a pop-up viewer. If you choose to revert to one of these backup copies, it will replace the text in the current editor.
Tab Formatting Available from the 'Edit' menu and also through a button on the toolbar, Tab Format will indent a Java source file correctly in a one-off manner, at the time this function is selected. It can be selected any number of times. Auto tab formatting can also be applied to HTML, XML and JSP source files. Auto Tab Format is automatically applied to a Java, XML, JSP or HTML source file when it is opened. Note that the correct formatting of script files (HTML, JSP and XML) requires that the script is carefully written. XML demands this, but HTML, in particular, is often written in a 'relaxed' or 'sloppy' way, most often by omitting end tags. Although it may seem reasonable to assume that character attributes should continue after a paragraph break - or not, depending on your view - the consequence is actually often undefined and different browsers may display such HTML pages in different ways. Some parts of the HTML definition do not require strict adherence to XML-style rigour with respect to every tag having an end end, or itself being both start and end. In HTML, for example, <img src='a.gif'> is a standard tag, but ideally would have been defined to require the following : <img src='a.gif'/> TJI's script formatting is aware of the idiosyncracies in HTML, but cannot allow for missing end tags. To give a simple example, the following is badly formatted because the </b> tag is missing: <html>
It is sometimes reasonale to put a number of tags on the same line, so long as one maintains balance: <html>
</html>
But the following is truly messy: <html>
</body> </html>
Remove 'Commented Out Code' Available from the 'Edit' menu, this function provides a quick way to tidy up a source file. When developing a program and going around the edit-compile-run cycle, it is sometimes useful to 'comment out' some code sections, perhaps when trying alternatives. Once the code works correctly, such old code should be removed in order to keep the source file readable and maintainable. This function will remove such old code fragments in a one-off manner. It distinguishes between 'commented out code' and normal comments (which are left intact) by looking for tell-tale indicators such as the inclusion of the ';' and '=' symbols which are unlikely to be (but might be) used in a normal comment.
Jump to Code This feature allows you to jump straight to any class field, method, inner class, import, package designation or signature (class or interface definition). Just click on the item of interest from the lists on the 'Class' tab. These lists are updated when a file is opened or [re]compiled. You can update it at any time by clicking on the 'Update' button. Another way to jump to a method declaration is by using the editor's contextual pop-up menu. Suppose you click on a call to method getValue() within the current editor's source code using the right-hand mouse button. This right-hand click will invoke a pop-up menu containing a 'Jump to getValue()' option. Selecting this option will take you to the declaration of this method, even if that is in a different source file within the same project; the file will be automatically opened if it is not already open.
Common Structure Insertion This feature allows the fast insertion of all the most common java structural elements, such as :
Many elements for HTML and JSP source files are also available for quick insertion.
Code Completion This feature provides help with the Java API - specifically, with the methods available for all the core Java classes and interfaces. When the method denoting '.' is typed, a list of available methods is shown to the right of the editor; the Code Completion tab is selected automatically. This happens when the IDE recognizes the preceding word as a class or interface, or an instance of a class (standard Java class or project class). The available methods list is alphabetically sorted and shows all methods available, including methods inherited from parent classes. It can be ignored completely but as you type a method name, the method list reduces to show only those that match the method name that is being typed. Parameters and return type are also shown. At any time you can select an item from this list with the left mouse button and it will be inserted into the editor, taking account of what you have already typed. If there are required parameters then spaces are left for them to be filled in and the caret is placed ready for the first parameter to be typed. You can see a description of any method by clicking on it with the right mouse button. This feature is useful for checking available methods, for the correct signature, and for parameter and return types. It can also save a lot of typing! Code completion will also show available constructors and the parameters required for each after one types 'new' followed by the class name and the opening '('.
Word Completion This feature allows the editor to auto-complete any word being typed that it recognises as already existing in the current editor file that is able to uniquely complete what you have typed so far. This feature is ideal for people who type only slowly, or who look at the screen as they type (so as to notice that the word being typed has been auto-completed). The text to complete the word will be highlighted (selected). To accept it, press either the right cursor key or the 'End' key (the right cursor key is designed to behave the same as the 'End' key in this special case : the caret is moved to the end of the auto-completed text ready for you to continue). To not accept it, simply keep typing what you do want and the text will be replaced.
Custom ShortCuts This feature allows to define 'shortcuts' that will apply in any editor at any time. For example, you could define that 'sop' will be a shortcut (shorthand) for 'System.out.println'. To add to or edit your custom shortcuts, select 'Edit Shortcuts' from the 'Edit' menu. Shortcuts are stored in the user preferences.
Split View If you would like to see one part of a source file while editing a different part, then the Split View feature is what you need. If Split View is enabled, then at the bottom of each editor there is a 'divider' which you can pull up with the mouse to reveal a second editable view of the source file. On the divider there are two small arrowed buttons to the left which allow you to quickly move the divider up and down. You can edit in either view; a change in one updates the other automatically. Hence, one possibility is to copy and paste from one view to the other in order to duplicate some code (although you should consider making the duplicated code a separate method). You can enable or disable Split View from the 'Editor Options' submenu of the 'Options' menu.
Block Folding This very useful feature allows you to fold and unfold any { } block in Java source files, such that when folded, the 'contents' are hidden; by hiding blocks, one can more easily concentrate on the code that one is most interested in, because there is less code to distract one, or scroll through. To fold a block, click with the mouse (left button) on the line number adjacent to the first line of the block (a line ending in '{'). The line number will be shown with a darker background to indicate that there is a fold at that point, and the subsequent line numbering will be updated. To unfold the block, click again on the line number. You can fold any type of block - from an if (~) {...} block to a complete method or inner class. Folds can be nested - you can fold a block that contains folded blocks. TJI will fold all methods and inner classes when a source file is loaded (if block folding is enabled). To enable or disable block folding, go to the 'Editor Options' submenu of the 'Options' menu and toggle the 'Enable Block Folding' option. This setting is remembered from one run of TJI to the next. 'Syntax Formatting' must be enabled for block folding to be enabled. There are 'Fold All' and 'Unfold All' functions available in the 'Edit' menu and also the editor's context menu (click with the right mouse button within the editor to invoke an editor's context menu).
Context PopUp Menus Many commonly used editor functions are available in the editor context menu which can be invoked by a right-button mouse click within the editor. The caret is first moved to the location of the click unless one clicks on selected text, in which case a different context menu is displayed (with cut, copy and paste functions plus Search & Replace, and in which case the selected text is automatically made the search text). Save, print and close editor functions are available from the context menu invoked by a right-button mouse click on an editor title tab.
End Block Comments These can be automatically inserted or removed when the action is selected. They are added only where there are more than five lines between the start and end of the block. The end block comment follows the ending brace and begins with 'end:'. For example,
Enclose Selected Text This feature allows selected lines of source code to be 'enclosed' by a structure such as 'try {...} catch () {}' or 'if () {...}
Comment / Uncomment Selected Text This feature allows you to quickly comment out or un-comment out selected lines of source code.
BookMarks You can place special comments in the source code that will be treated as bookmarks. Bookmarks are flagged in the line numbers bar on the left of the editor (if syntax coloring is on). You can quickly search for all bookmarks from the 'Edit' menu. To create a bookmark, simple add a '//' style comment that includes '::' (two consecutive colons). For example:
Miscellaneous KeyStrokes
|