12.08.2008, 12:05 | #1 |
Участник
|
Kashperuk Ivan: Another useful Editor Script for AX developers
Источник: http://kashperuk.blogspot.com/2008/0...pt-for-ax.html
============== In AX the principle of upcasting is used quite a lot. Some examples coule be the RunBase hierarchy or the InventMovement class hierarchy. Basically, the base (or super) classes contain the main part of the hierarchy logic, while subclasses only override a couple of methods performing actions specific to this class. When browsing the AOT, trying to find a specific line of code (debugging without the debugger, basically), you often find yourself in a situation when you lookup a definition of a method from a derived class, and end up in this method of the base class instead (because upcasting was used in the code in question). And every time you need to see the same implementation in the child class, you need to go back to the AOT and open it from there manually. Well, not any more. Here is a small editor script, that you can use to navigate to an overridden method of a derived class. I created 2 versions of the same script, one using xReferences, the second using Dictionary class. You will have to pick the one you like more. I, personally, prefer the xRef one, as it, generally, should work faster once the xRefs for the class hierarchy is updated (happens the first time you use the script). You can read more about Editor Scripts and how to use them on Axaptapedia Version 1: public void addIns_OpenOverriddenMethodDef(Editor e) { #AOT #define.AOTDelimiter('\\') // This does not exist in AX versions prior to AX 2009, so I just declare it here TreeNode treeNode = TreeNode::findNode(e.path()); TreeNode treeNodeParent; Dictionary dictionary = new Dictionary(); Counter classCnt = dictionary.classCnt(); Counter iClassCount; ClassId classIdParent; ClassId classIdChild; Counter descendentsCount; SysDictClass dictClassChild; TreeNodeName methodName = treeNode.treeNodeName(); Map map; MapEnumerator mapEnumerator; ; if (subStr(treeNode.treeNodePath(), 1, strLen(#ClassesPath)) == #ClassesPath) { treeNodeParent = TreeNode::findNode(xUtilElements::getNodePathRough(xUtilElements::parentElement(xUtilElements::findTreeNode(treeNode)))); classIdParent = dictionary.className2Id(treeNodeParent.treeNodeName()); map = new Map(Types::String, Types::String); for (iClassCount = 1; iClassCount
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
За это сообщение автора поблагодарили: aidsua (1). |
Теги |
editor script, полезное, ax2009, ax4.0, axapta |
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|