Consultingwerk Blog

Customizing OpenEdge Architect Templates made easy: Personalization

by Marko Rüterbories | Aug 15, 2011

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, https://community.progress.com/community_groups/openedge_general/w/openedgegeneral/1243.openedge-architect-working-with-custom-templates

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_abl_procedure

file_header_author

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:

macro

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:

simple_comment

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

1 comment

Leave a comment
  1. Rolandcharcker | Jun 07, 2019
    I can see and value your hard work here. People who read extensively fill their mind with a lot of facts, thoughts and general info. If any want to write more blogs in the future then they must cultivate the habit of reading. Also need to do writing related practices too. So you can check this best essay writing service for any kind of your writing help. It’s very informative and I am sure it will help many other people like the way it helps me.

    Leave a comment