MDT on Facebook MDT on Twitter

Magik Code Editing

Magik Editor

Magik editor is a handy and powerful tool for editing Magik files. It makes code development much easier and faster than in any other available editor for Magik. It is equipped in many functionalities which accelerate code edition and navigation.

The major editor features:

  • Syntax Colorizing

  • Aesthetic colorizing of Magik lexical elements for better code readability.
  • Templates

  • The ability for defining and reusing frequently used Magik code chunks.
  • Emacs-like Auto Indentation

  • Code formatting consistent with Emacs editor rules. Changes in Emacs-Like Auto Indentation mechanims now allow to customize the formatting style so it is identical with Emacs and recognize the differences in code formatting depending on the version of Smallworld GIS.
  • Magik Occurrences

  • Functionality responsible for searching and marking occurrences of selected symbol or identifier in Magik source file.
  • Smart Caret Positioning

  • Ctrl + ‹ and Ctrl + › stop at the beginning/end of Magik words. Their ‘shifted’ equivalents extend the selection in the same way.
  • Code Folding

  • Enables folding/unfolding of Magik compound statements.

One of the functionalities of the Magik editor are code problem markers. The contents of a file are checked on the fly, during code editing and detected problems (e.g. syntax errors) are instantly marked in the editor. The problems are marked in a few different ways, so they can be easily found even in case of big files. The code checking is independent of the Smallworld™ GIS platform and does not demand running of the GIS session. Magik editor also offers Quick Fix functionality for the frequently occurring problems. It presents one or more possible fixes that can be automatically applied in order to resolve a specific problem.

Apart from the standard Magik editor there is also a draft editor available. The draft editor may be used for editing write-protected Magik files. Draft editor allows you to make temporary changes to any important Magik files without fear of accidental changes in their content. Draft editor allows you to save local copy of the modified Magik file in a workspace if necessary.

Outline

The Outline view displays the structure of the file that is currently opened in Magik file editor. It shows structural elements that can be easily accessed. The content of the Outline view is editor-specific. For a Magik source file, the structural elements are exemplars, slots, methods, shared variables, shared constants, procedures and blocks. Every element is shown in outline with a specific set of icons which give you information about their type and modifiers. With the use of Outline you can navigate the source code much faster. 

Code Assist

Code Assist is a ticket for easier and more flexible style of programming. It is a feature that shows you a list of valid alternatives for completing current line of code. Code Assist can be accessed by the user or triggered automatically after specific conditions. The resulting dialog provides a context sensitive coding help by making available a listing of all applicable Magik code elements for the location where code assist was activated. For the Magik editor, the code elements are methods, templates, keywords etc. Types of code elements are grouped and displayed separately. There is a possibility of cyclic switching between groups. User can choose which groups of proposals should be displayed and in what order.


Code Templates

Code Templates are used by actions that generate code. It is a very powerful functionality which improves the level of coding style. There are two kinds of code templates in Magik editor - “Comments” and “Pragmas”. You can define which template structure, will be applied to specific code element like method, exemplar definition, block, procedure etc. Templates may contain variables that are substituted when the template is applied. All code templates can be defined separately for each of the code element types. Additionally each Magik project can possess specific set of code templates. With use of code templates during Magik code developing, the programmer is able to add defined templates for any given element very quickly.


Transmitting Magik Code

During work with Magik editor you can, at any time, transmit the code to running GIS session. A user can transmit whole file, selected region or any code element in a file. Even modules and projects can be transmitted with one mouse click. For safety reasons you may choose to be warned when original Magik file is dirty. Each problem in transmitted code is automatically reported via special window which pops up after transmit operation.

Type Overview new

Type Overview is a kind of read-only editor that allows to see the source code of an entire class in case it is spread between many files - it occurs quite often if a particular class is frequently patched. Type Overview collects all information directly from the session, so the shown code is always up-to-date. It groups the methods coming from the same files and marks them with different background color so they are easily distinguished. It is not possible to make changes directly in the Type Overview but you can easily jump to the source file of any method. Moreover Type Overview is equipped with features like outline and hyperlinks for simpler navigation.

Messages File Editor new

Messages File Editor is dedicated to handle .msg files. It has all common editor features like outline, syntax colorizing, code assist, code validation mechanism etc.

Draft Editor new

Draft Editor is a different kind of common Magik editor created to safeguard files from unwanted changes. Draft Editor is used by default to open files from Project Dependencies or write-protected files. In case you would like to save your changes anyway a local copy of the file will be made without affecting its original source. Files opened in Draft Editor are easily distinguished by the “glasses” icon overlay.