PDSOE - ABL Editor - how to programmatically add code before

Posted by olivier.dunemann on 15-May-2017 06:35

Hi there,

We are in the way to migrate to PDSOE.
By the way, we use Roundtable to manage source files versioning.

Each time we save a source file, we add (or update) a couple of preprocessor variables definition on top of the source code (to reflect the object name and its version).

Inside the kind old OpenEdge ADE, this was made simple using the "_adeevnt.p": Trap the "Before-Save" event, fetch the handle of the Procedure Editor and add/update the required preprocessor variables definition.

Inside PDSOE, I didn't find yet a similar way to achieve this.
I can trap the "Before-Save" event in "_idestartup.p", but how can I get (and modify) the content of the file edited in the (ready to save) ABL Editor?

I've looked at procedures and functions available in the undocumented/unsupported "oeideservice.p" and "oeideservice.i" files. I've even (naïvely) tried:

RUN getWindowOfFile IN hOEIDEService 
  (INPUT  /* File      */ ProgramName
  ,OUTPUT /* winHandle */ hWindowHandle).

But the output parameter is the Unknown Value.

Does anyone have already done similar thing?
Any help would be appreciated.
Thx in advance.

Olivier Dunemann

All Replies

Posted by Jeff Ledbetter on 15-May-2017 07:41

I don't have an answer for the PDSOE question, but you may want to consider doing this via the Roundtable 'checkinObjectBefore' hook in rtb_events.p on the Roundtable appserver.

Posted by olivier.dunemann on 15-May-2017 09:08

Hi Jeff.

Thank you for your suggestion, but... developers are not allowed to "check in" objects.

Creating/checking/updating the preprocessor variables should occur on every "save" of source file.

I would be happy if we could do it via RTB, but I'm afraid there is not enough (official) RTB Hooks in the RTB Plug-in to achieve this.

Posted by marian.edu on 16-May-2017 01:46

developers are not allowed to "check in" objects.

That’s an interesting statement, what are they allowed to do then, how are they going to keep track of changes?

Anyway, most probably the ‘backup’ feature is something that would ease their pain a bit and good news is that this is already triggered on each save but the event is not ‘propagated’ so you can’t probably hook it from outside but you can always try to bribe Jeff and get that implemented ;)

Marian Edu

Acorn IT 
+40 740 036 212

Posted by olivier.dunemann on 16-May-2017 02:49

Hi Marian.

Thank you for your suggestion.

Backup is an interesting feature, but I can't see how it can help us because the goal is to have these preproc variables available on the "real" source files (at any time).

Perhaps should I explain a little bit more what we are doing. As already mentioned these variables reference the object name, its version, but also the task number and the last update timestamp. These values are, among others, queried/checked at runtime in the R&D/Test environment, to make sure that we are using the right (up-to-date) R-Codes (f.i. compilations are not processed inside RTB).

They are, later on, also queried during the quality control, delivery process and sometimes at client side.

And to answer out question, developers "check out" source files, and make their changes.

It's up to a "validation" team to "check in" objects... after a quality control.

Posted by Jeff Ledbetter on 16-May-2017 05:41

With the Backup feature enabled, on each save a copy of the WIP code is stored in the repository (whether it's Central, Task, Lab, etc.). In RTB 11.7, we do have a server-side event hook that will fire every time a Backup is created. This would be a good place to intercept each save regardless of how the Object is checked-out.  Also in RTB 11.7, there is also a hook that fires on Unlock Object which is run each time an Object is closed from the editor. This may be a good spot as well. However, you may be limited on having access to the physical source file depending on share-status.

These could probably be implemented on the plug-in client as well although I generally think it is a best-practice to implement hook customizations on the server as much as possible.

Ideally, your original idea of using the IDE save hook from PDSOE is probably the best place to immediately resolve your issue. Someone from PSC should be able to tell you if it is possible to grab the editor source and insert your changes like you've done in OE Studio.

Posted by olivier.dunemann on 18-May-2017 00:40

>> Someone from PSC should be able to tell you if it is possible


How to access ABL Editor content in Developer Studio with _idestartup.p?

Posted by marian.edu on 18-May-2017 00:58

Indeed, the 4GL runtime (even if not shared between projects) doesn’t keep track of all editors content… it is however fairly easy to hook to the save event using an Eclipse plugin and either do the code update there or call some 4gl routine passing in the editor content.

Marian Edu

Acorn IT 
+40 740 036 212

This thread is closed