Topic
Prev Next

Using the Source Code Panel

The 'Source Code' panel brings together a number of facilities for working with source code. Here you can import existing source code files into your model, creating new model elements that represent the classes in those files. You can select a Class in your model, then click a button to open the code editor window and automatically load the source code file associated with that Class. Facilities for editing Code Generation Templates and Language Grammars are also accessed from this panel, as are the commands to generate source code from the model and synchronize the model from the source code.

Available Facilities

Facility

Description

See also

Edit Code

This icon provides a collection of tools for viewing and editing source code files associated with elements in the current model. Also provided are tools that generate source code for a particular element or synchronize an element to reflect changes in its associated source code file.

  • Open Source File - display a 'File Chooser' dialog to browse for a source code file to open in the code editor window
  • Edit Element Source - open the code editor window and load the source code file associated with the currently selected element
  • Browse Element Source - open a docked source code window and load the source code file associated with the currently selected element
  • Open in External Editor - launch the configured External Editor and load the source code file associated with the currently selected element
  • Generate Current with Options - display the 'Generate Code' dialog, for the currently selected element
  • Synchronize Current - update the selected model element to match the declaration/definition in its associated source code file

Import Code

Click on the drop-down arrow to display a list of options for importing code from a variety of sources, selecting from a range of popular coding languages.

  • Import Directory - display the 'Import Source Directory' dialog from which you import a complete directory tree in one pass; language and other options can be specified within the dialog
  • ActionScript Files - import ActionScript files into the current model
  • C Files - import C files into the current model
  • C# Files - import C# files into the current model
  • C++ Files - import C++ files into the current model
  • Delphi Files - import Delphi files into the current model
  • Java Files - import Java files into the current model
  • PHP Files - import PHP files into the current model
  • Python Files - import Python files into the current model
  • Visual Basic Files - import Visual Basic files into the current model
  • VB .Net Files - import VB.Net files into the current model
  • Binary File - import a binary file; supported file types are: Java JAR files and .NET PE or IL format (exe, dll)
  • Windows .RC File - import a Windows C/C++ .RC file into the model, as a series of screen definitions
Importing Source Code

Configure

Click on the drop-down arrow to display a list of options for managing templates and grammars, which determine the way source code is imported into your model and generated from your model

  • Code Template Editor - display the Code Template Editor window, where you can review and edit the templates used for generating source code from your model
  • Manage Local Paths - display the 'Local Paths' dialog, where you can set up and manage a list of Local Path definitions, used for path substitutions in collaborative environments
  • Language Grammar Editor - display the Grammar Editor window, an advanced facility that allows you to view, add, edit and manage language grammars, used for importing source code
Editing Grammars Local Paths Dialog The Code Template Editor

Generate

Use this command to generate source code for the currently selected model elements. Source code is generated into the file that is associated with each individual element. Code is generated only for elements that are of type Class or Interface.

Generate a Single Class

Synch

Use this command to synchronize the currently selected model elements, with their associated source code files, updating the elements in the model.

Synchronize Model and Code

Generate All

Use this command to generate source code for all of the elements in the currently selected Package. Source code is generated into the file that is associated with each individual element. Code is generated only for elements that are of type Class or Interface.

Generate a Package

Synch All

Use this command to synchronize all elements in the currently selected Package, with their associated source code files, updating the elements in the model.

Synchronize Model and Code

Learn more