Customizing OpenEdge Architect Templates made easy: Personalization

OpenEdge Architect’s templates for new files and new code sections like methods or internal procedures are not always what a developer would expect or like to have. The templates used are based in Eclipse JET templates (Java Emitter Templates, http://eclipse.org/articles/Article-JET/jet_tutorial1.html). To customize those it is required to set up an Eclipse Plugin Development environment (PDE).

An introduction into customizing the templates used by OpenEdge Architect can be found on PSDN:

OpenEdge Architect: Working with Custom Templates, http://communities.progress.com/pcom/docs/DOC-16387

However for basic customization or personalization of the way code is generated in OpenEdge Architect simpler steps might be enough or at least provide a first start:

1.) Setting the author name for the file header comments

New files in OpenEdge Architect include the author name in the file header comment. Unfortunately by default this refers to the windows user name of the developer, not it’s real name and does not include the organization name. Typically the files will end up with short names like “mikefe” or “Administrator” in the file header, not the desired author information like “Mike Fechner / Consultingwerk Ltd.”.

An additional startup parameter can be used to customize the author information used in file header:

C:\Progress\OpenEdge102B\oeide\eclipse\eclipse.exe -showlocation -vm “C:\Progress\OpenEdge102B\jre\bin\javaw.exe” -vmargs -Duser.name=”Mike Fechner / Consultingwerk Ltd.”

In this example I have created a copy of the OpenEdge Architect shortcut that was created during the installation of OpenEdge and added the parameters in bold. As a result the file header now includes a more meaningful author information.

New Procedure Dialog

File header comment with author information

Note, this setting can alternatively also be placed in an eclipse.ini file, but I do prefer using a customized shortcut and not modifying the eclipse.ini file (typically somewhere in the OpenEdge installation folder).

2.) Customizing code templates / macros

This author name can also be used when defining code templates or macros. Using the preferences dialog under the menu selection Window à Preferences and then OpenEdge Architect à Editor à Templates (macros) you may defined text elements that can easily be inserted into the source code while typing code. For instance you may add the following macro:

New template dialog


The pattern includes the variable ${user} with refers to the current author name as specified by the previously mentioned startup parameter, ${date} to the current date and ${cursor} which indicates the location of the input cursor after the pattern has been inserted into the source code (note the 3 space characters before the ${cursor} variable, to provide a nice formatting of the individual comment text entered.

After typing the letters “com” followed by the space key in the source code OpenEdge Architect will now automatically insert the following text:

Sample comment after inserted into the editor
OpenEdge Architect supports additional variables in the code templates / macros. Use the “Insert Variable” button in the above dialog to list and insert those into the pattern.

3. Copyright header

In the same way you can create a template for other commonly used code blocks like the copy right header typically inserted into every file. We have chosen “©” as the name for this macro (which is the html named character for the © symbol).

 Copyright header in source code