Showing posts with label Add-In. Show all posts
Showing posts with label Add-In. Show all posts

Friday, January 8, 2010

Add-In Extension: Create default methods for classes

May be you know the Add-In for automated creation of find(..) & exists(..) method for tables provided by Axaptapedia?

Well, I have created a similar Add-In for classes. The goal of that Add-In is the same as the find(..) & exists(..) Add-In, to speed up code implementation.

What's the functionality?
  • It creates required abstract and interface methods
  • If the class is not abstract, a protected new(..) and a static construct(..) constructor will be created
  • If the class is in the RunBase tree, a static main(..) method is created
  • Already created methods will not be touched

How to install:
  • Import this XPO containing a private project with a class and a menu item.
  • Add the menu Item to the menu SysContextMenu (you can decide on what position)
  • Add a the code below to the class method SysContextMenu/verifyItem before line 217 (switch menuItem)
    case menuItemActionStr(DEV_CreateDefClsMeths):
        return ! docNode && _firstType == UtilElementType::Class;
  • In AOT, select a class and open context menu/Add-Ins. You will see now the new entry named Create default class methods. Klick it to process.
Tip: place the modification on a private layer (a layer which is used internally only): it's not really customer related, so you don't have to deliver it to them.

It works in AX 2009. Not tested for AX 4.0

(this article is available in English only)