|
28.10.2006, 16:40 | #1 |
Участник
|
Dynamics AX Geek: cross-references & find
Источник: http://AxGeek.spaces.live.com/Blog/c...DB13!136.entry
============== One of the cool things in Axapta is that you can read and modify the actual source code (provided you have the source code license, of course). When working with a standard object you often need to know where and how it is used. This is where two essential tools come in: cross-references and the find-dialog. Cross-References Cross references answer questions like "Where is this object used?" and "What objects is it using?". You access it by right clicking any object in the AOT, Add-Ins/Cross-Reference. The key is to keep the references updated. The initial references are built during the installation (installation check list / update cross-reference). It is up to you to keep it updated when you later change or add objects to the AOT. You can do that periodically by right clicking the top AOT node, Add-Ins / Cross-reference / Update or you can have the system update the reference whenever you compile some code. To do that go to Menu Tools / Options / Button Compiler and activate the Cross-reference checkbox. Find Dialog The find dialog is more powerful than you might think. The search text is actually a regular expression. The syntax for regular expressions in Axapta can be found under System Documentation / Functions / match. It is not quite as powerful as Unix users might be used to, but it’ll do. The find dialog allows you to search not only methods, but “All nodes”. Properties for example can be found easily, if you know they are stored as text as Property blank(s)#Value. Find all temp. tables: Go to Data Dictionary\Tables find “All nodes” containing text Temporary *#Yes Ever wondered why searching for static method calls or enum types didn’t return any results? Colons are treated as special characters in regular expressions, so to find them you have to escape them with a backslash InventDirection\:\:Receipt finds all occurrences of InventDirection::Receipt in the selected scope. The dialog even let’s you define your own filter code. Your code is actually compiled to a method called FilterMethod(). The method has four parameters:
You can define any filter you want, your source simply needs to return a boolean to indicate found / not found. For example to find all insert() methods that do not call super(): Go to Data Dictionary / Tables find methods named insert, then copy this into the source field: TextBuffer tb = new textbuffer(); tb.setText(_treeNodeSource); return !tb.find("super()"); The method is also useful to match or-conditions. TextBuffer tb = new textbuffer(); tb.setText(_treeNodeSource); return tb.find("insert()") || tb.find("delete()"); Execute this find on the classes node to return all methods that call insert() or delete(). ============== Источник: http://AxGeek.spaces.live.com/Blog/c...DB13!136.entry |
|
|
|