v1.2.0 Summary Chapter 2: Modeling basics 2. Start modeling 2.6. Source code input fields
You're browsing the documentation of a version that is still under development, the features described here may change or even be removed.

2.6. Source code input fields

In almost all source code input fields, we'll find a numbered section that indicates the number of lines loaded. Also, the majority of source input fields highlight the current line (where the text cursor currently lies), by default, in light yellow. These settings can be changed in General settings in the section Printing & Code. Additionally, in these fields, the user can change the text case or change the indentation by selecting a portion of it and hitting Ctrl + U for upper case text, Ctrl + Shift + U for lower case text, Tab to ident right and Shift + Tab to ident left. The mentioned actions can be activated via the context menu as well.

pgModeler allows the loading of the contents of external source files to assign them to any object that demands the usage of a SQL source, for instance, function, view, or custom SQL code. The area highlighted in the red rectangle in the image below shows the buttons available in any input field that is configured to accept source code via an external editor.

The action Load enables the user to simply load the contents of an external text file into the current field, nothing more. Now, the Edit will do some tricks and write the field's contents in a temporary file and open it in the configured external editor. Inside the loaded editor lies the contents of the source field focused in pgModeler that was saved to the temporary file. The user can now edit the file open externally but must not forget to save it. Once the editor is closed, pgModeler detects the changes on the temporary file and places its new contents in the focused field. The Wrap button toggles the text wrap for long lines, breaking them by taking the input field's width as the maximum line width and putting the exceeding content in the line below, without affecting the total number of lines in the text, only the visualization is improved. The Clear action is used to wipe out all text in the current field.

In the General settings (see below), the user can define which editor will open when requested as well as its arguments (specific for any chosen editor). It's important to warn the user to take care of the application being assigned as an external source editor. Since pgModeler isn't capable of guessing if the selected executable is an editor or a system command that wipes out all data from the computer, the user always needs to double-check what application is being used as the preferred source code editor.


Oct 31, 2024 at 10:38