Thursday, February 08, 2007

AxGoToDeclaration


I haven't posted in a while. Work, work...

Well, meanwhile, I made some new handy tool for Axapta developers.

Purpose
Finds the declaration of the selected variable and opens the editor on the line with the declaration

Functional capabilities
Searches the current method first. If the declaration is not found, goes to the root of the object and looks in the classDeclaration method. If still not found, continues on with the parent of the class.

Implementation
In order to use the tool simply import the project
HERE
and post the following code as a new method of the EditorScripts class:

void AOT_goToDeclaration(Editor e)
{
AxGoToDeclaration goToDeclEngine;
;
goToDeclEngine = new AxGoToDeclaration(e);
goToDeclEngine.goToDeclaration();
}




Known Issues:
  • ParserClass does not parse the constructor (new) method. So variable declarations cannot be found from this method.
  • Does not find variables this, element, etc.
  • Does not find objects with AutoDeclaration set to Yes on forms, nor the datasources

What is planned for upgrade:
  1. Open AOT objects when this or element is selected (table, class, form, etc)
  2. Open AOT objects with the property sheet for objects with AutoDeclaration = Yes
  3. Include global classes into the search

Credits

Thanks to

  • AndyD - for the timer AOT edit code and the selectedLine method modifications
  • MaxBelugin - for ParserClass description

Feedback

If you have any comments or suggestions, please feel free to contact me.