Using the Editor

Together comes with a multi-page built-in code/text editor with a set of standard and extended features. You can switch between tabs by clicking on tab's header, located right under the editor.

Standard features

These commands are available from the main Edit menu, or the speedmenu of Editor. You can use hot-key combinations to speed up access to a particular command.

Edit menu commands and hot keys 

Command

Function

Hot-key

Undo

Rolls back last several changes.

Ctrl-Z

Redo

Reinstates last Undo operations.

Ctrl-Y

Cut *

Cuts selected text to Clipboard.

Ctrl-X

Copy *

Copies selected text to Clipboard.

Ctrl-C

Paste *

Pastes text from Clipboard at the cursor position.

Ctrl-V

Delete

Deletes selected text. (Restore with Undo)

Del

Select All

Selects all the text in the currently focused file

(none)

Insert Text From File

Displays standard "Open File" dialog to pick up the file containing the text to be inserted.

(none)

Go To Line

Displays dialog to specify a line number, then jumps to the specified line number

Ctrl-G

* (Note: Clipboard commands also work with diagram elements in the diagram pane.)

Editor speedmenu commands

The Editor speedmenu contains a number of commands, some of which are self-explanatory or highly intuitive (Save, Save As, Cut, Copy, Paste, Select All, Close, Close All), while others require some brief explanation.

Commands for the Integrated Debugger

The Editor interacts with the Integrated Debugger by means of several speedmenu commands:

*(Hidden when no breakpoints are set in the file)

Extended features

The Editor provides the following advanced features:

Note:  you can change the hot keys for extended features using "Editor" tab of the Options dialog. See Configuring the Editor for more information. 

Configuring the Editor

You can configure the Editor using the Options dialog at any of the multiple configuration levels. On the Main menu choose Options | [level ], where level is the configuration level at which the settings will apply ( Default for example) . Select the Editor tab (displays as Text Editor in some builds). You will see the following nodes representing the main categories of configuration options for the Editor:

Options node

Expand the Options node to view and modify general configuration options for the Editor.

Keyboard node

Expand this node to view the current settings for keyboard shortcuts that invoke Editor commands. You can redefine the settings to fully customize keyboard shortcuts for the Editor.

Schemes node

This node presents a tree of option subnodes. Use these options to tune the Editor for working with different contents:

For each of these types of text you can set up color schemes, Code Templates for programming languages, and common Editor parameters such as Tab Size, Right Margin, etc. The Editor will automatically pick up the particular scheme depending on type of file is loaded and focused in the Editor.

Defining Code Templates

Use code templates to significantly speed up the process of developing your applications. Define as many templates as you want. Then, while coding in the Editor, you type the name of the template and press Ctrl-F9 to insert the entire block of code contained in the template. There are already several default templates for common constructs in each supported language: if, for, while, etc.

Templates vs. Blueprints

Don't confuse Code Templates with Blueprints. Blueprints allow you to set up global defaults, including default code fragments, like "/*Generated by Together*/". Blueprints work automatically and all the time, but you invoke Code Templates whenever you want, as needed.

Defining your own templates

  1. Open Options Dialog by choosing Options | Default... menu item.

  2. Select the Editor (or Text Editor) tab.

  3. Expand the Schemes option node in the tree of options.

  4. Expand the node for the programming language you want to configure to work with templates (C++, Java, or IDL).

  5. Select the Code Template option node to display the Code Template Editor dialog.

  6. Select one of the existing templates listed at left, or click the "+" (plus) button to add a new template.

  7. If adding a new template, give it a name.

  8. Edit or add the actual code that you want inserted in your source files when you invoke this template as you work later on.

  9. Define additional properties using Space Expand field.

  10. Click OK when done.

Deleting templates

  1. Complete steps 1-5 listed above.

  2. Select the template name you no longer need at the left.

  3. Click the "-" (minus) button. The selected template is permanently deleted.

Using Code Sense

The Code Sense feature is currently available in products with Java language support. It helps you to auto-complete references to standard Java classes in Java code, significantly speeds up your coding and helps you avoid syntax errors. Code sense works in two modes: it is invoked by a hotkey stroke (CTRL-SPACE by default), or activated upon delay. This is defined in the Editor tab of the Options dialog, Code Sense and Keyboard nodes.

Example 1

  1. Type System.

  2. With the insertion point cursor placed after the second period character, press Ctrl-Space. The list of available methods for this class is displayed.

  3. Select the desired method with mouse or arrow keys and press Enter. The name of the selected method is inserted into the line.

Example 2

  1. Type System.out.p

  2. With the insertion point cursor placed after the letter p, press "Ctrl-Space". The list of available methods for this class beginning with the letter p is displayed.

  3. Select the desired method with mouse or arrow keys and press Enter. The name of the selected method is inserted into the line.

Browse Symbol

When you click on a class name or attribute name, Browse Symbol opens the source code of this class and highlights declaration. When you click on an operation name, the source code of the corresponding class opens, highlighting the method signature.

By default, Browse Symbol works with the project classes only. To work with the library classes, it needs additional customization of the $SOURCEPATH$.

Setting Breakpoints

Breakpoints specify where to stop code execution during debugging to permit inspection of variables, expressions, class members, etc.

Setting a breakpoint

There are several ways to set breakpoints in the Editor. In every case, place the insertion point cursor at the beginning of the line of code at which execution should stop, and then...

When a breakpoint is set, a red dot appears in the extreme left margin.

Removing a breakpoint

To remove a breakpoint, place the insertion point cursor at the beginning of the line that has the breakpoint, then use any of the techniques listed above to remove the breakpoint.

Working with breakpoints

Once set, a breakpoint can be disabled or re-enabled using the speedmenu commands Disable Breakpoint and Enable Breakpoint.

You can edit properties of a breakpoint by placing the insertion point in the line containing the breakpoint and choosing the speedmenu command Breakpoint Properties.

"Throw-away" breakpoints

You don't need to set a breakpoint that you think you will need only once. Instead you can use the Run to Cursor option to run your application up to a specific line in your program.

To use Run to Cursor:

Setting and navigating Bookmarks

You can set bookmarks in your source code files and navigate to them from any open file that is part of your project. You can view, edit, classify, and navigate to bookmarks in the project using the Bookmarks dialog. Once set, the bookmarks are stored in the project profile and will be re-used when the project opens next time.

Bookmarks have lower priority then the breakpoints. It means that if you set a breakpoint and a bookmark on the same line, the breakpoint will override the bookmark and executable line icon.

Setting and removing bookmarks

To set bookmarks:

  1. Open the file to be bookmarked in the Editor.

  2. Scroll to the line where you want to set a bookmark and place the insertion cursor anywhere on the line.

  3. Right-click and choose Toggle Bookmark from the speedmenu. (Note that the menu command displays a keyboard shortcut which is user-defined in Text Editor options.)

The default bookmark icon displays in the margin. A default bookmark description is saved using up to the first 50 characters of the line. You can edit this description if you wish (see Viewing, Editing, and Classifying Bookmarks below).

To remove a bookmark:

  1. Navigate to the line in the open file where the bookmark has been set.

  2. Right-click and choose Toggle Bookmark from the speedmenu. (Note that this menu command displays a keyboard shortcut which is user-defined in Text Editor options.)

Tips


Viewing, editing, and classifying bookmarks

The Bookmarks dialog displays a list of all the bookmarks currently set in files in the current project. In this dialog you can:

To display the Bookmarks dialog:

  1. Open any file in the project in the Editor.

  2. Right-click and choose Show Bookmarks on the speedmenu. (Note that this menu command displays a keyboard shortcut which is user-defined in Text Editor options.)

Editing bookmark descriptions

By default, the Description field for a bookmark contains the characters of the bookmarked line (up to maximum 50 characters). The field has in-place editing, or you can use the Edit Bookmark dialog (invoked from the Bookmarks dialog toolbar) to change the description.

Note: You cannot edit the Line and File fields.

You can change the list order of any bookmark by selecting its row in the Bookmarks dialog and using the Up/Down icons on the dialog's toolbar to reposition the bookmark in the list.

Classifying bookmarks

The Bookmark dialog enables you to classify the various bookmarks in your project. A set of icons is provided for this purpose. You can use this icon set to devise any sort of classification scheme that is meaningful to you.

For example, you might use one icon only for bookmarking constructors, another for start of business methods, another for JavaBean getter/setter methods, etc.

When you select a bookmark in the Bookmarks dialog, you can change its associated icon in either of two ways:

The icon you select for each bookmark displays in the margin of the Editor next to the bookmarked line.

Navigating with bookmarks

Once bookmarks have been set, you can use them to navigate from any open file in the project, to any bookmarked line in other project files.

To navigate to a bookmarked line:

  1. Open the Bookmarks dialog (as previously described).

  2. Select the target bookmark in the list.

  3. Click the Go To button.

If the target file is not open, it opens in a new Editor tab and the cursor moves to the bookmarked line. No diagram is opened... just the file.

If the target file is already open in the Editor, the insertion cursor moves to the start of the bookmarked line.

If you have a small number of bookmarks, you can navigate within a single file using hotkeys. CTRL/Grey+ moves forward, CTRL/Grey- moves backwards. Hotkeys do not work for the entire project.

 

Split pane

For the ease of editing large files, the you can split the Editor pane into two or four segments, each one with own scroll bars.

To split the Editor pane horisontally, grab the upper right corner of the pane and the drag splitting line down.

If you grab the lower left corner of the pane and drag the splitting line to the right, you can split it vertically.

Typing in any split pane is reproduced in all the other panes.

 

 

To remove split you need only to drag the splitting line away.

 

 

 

 

 

 

 

General usage tips

Using the Editor with no open project

When you launch Together, the Editor pane fills the entire right side of the Main Window and displays a single tab. A new file "<Untitled>" is open. You can immediately edit and save this file, or you can use the Directory tab in the Explorer or the Editor speedmenu to open one or more other files (see Opening Files below). Files supported by the Editor pane include the source files of the supported language(s), text type files, and configuration files such as *.properties or *.config.

Although you can open and edit source files without opening any project, most of the time you will probably work with diagrams and files in the context of an open Together project.

Using the Editor with an open project

When a project is open, you can have one or more source-generating diagrams open concurrently in the Diagram pane. As you click on source-generating elements in the current diagram, the contents of the Editor updates to display the source code for the selected element. It displays that same file until you select a different source-generating element in the same or another open source-generating diagram.

You may also open non-source diagrams such as Use Case or State concurrently with source-generating diagrams. When you first open a project, the following default Editor pane behavior is in effect:

This default behavior prevails unless you override it by using the Main Toolbar or View menu to show the Editor pane while you are focused on a non source-generating diagram. From that point on, until the end of the current session, you control the display of the Editor pane using the View menu or Main Toolbar.

Note: If you have a file already opened in some of the Editor's tabs, Together will open the existing tab on attempt to open that file again.

Using 'Preserve Tab'

As noted above, source code files automatically open, replacing the contents of the active tab, when you select source-generating elements in diagrams (classes for example). You can override this default behavior by checking Preserve Tab in the Editor pane speedmenu while the active tab is selected. The current tab remains and a new tab appears named <untitled>. Your next selection of a source-generating element in the diagram opens its source in this new tab (or you can open some other file using the pane speedmenu).

Checking Preserve Tab for a selected tab doesn't prevent you from closing it later. It only means that if you open another file while the tab is active, the other file will open in a new tab thus preserving the flagged tab. This enables you keep several source files from the same diagram open in the Editor pane.

Opening files for editing

You can open one or more files for editing. Each file opens in its own tabbed page in the Editor pane.

There are several ways to open files for editing:

To close a file you don't need anymore, select it and choose Close from the Editor pane speedmenu.

Tips


See also:

Using the Integrated Debugger
Using compile and make from Together
Using Code Templates