AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 12.08.2008, 12:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
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

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Kashperuk Ivan: SysMultiTableLoookup - dynamic lookups based on multiple tables Blog bot DAX Blogs 11 16.10.2008 12:26
Kashperuk Ivan: 3 great Tabax Plugins Blog bot DAX Blogs 2 15.05.2007 11:55
Kashperuk Ivan: Buy MorphX IT in Russian Blog bot DAX Blogs 6 13.04.2007 17:48
Kashperuk Ivan: Adding Menu ReferencesMany developers often find... Blog bot DAX Blogs 0 26.01.2007 05:51

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 11:27.