AxGoToDeclaration

From Axaptapedia
Jump to: navigation, search

Download[edit]

A handy tool for Dynamics Ax Developers

Purpose[edit]

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

Features[edit]

Version 1.1.2[edit]

New features (by Miker)[edit]

  • View name of variables object, not going to declaration
  • Open object in separate window for viewing properties and methods of object
  • Friendly interface

Version 1.1.1[edit]

Now you can go back to the place that you performed the GoToDeclaration from. (A separate function must be added into EditorScripts for this) Fixed a small bug with selected variable name parsing.

Version 1.1[edit]

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.

Installation[edit]

  • Import the xpo project. (contains 3 classes)
  • Recompile all (in case of errors)
  • Add the following code as a method into the EditorScripts class

<xpp> void AOT_goToDeclaration(Editor e) {

   AxGoToDeclaration   goToDeclEngine;
   ;
   infolog.globalCache().set("AxGoToDeclarationSource", "source_editor", e);
   goToDeclEngine = new AxGoToDeclaration(e);
   goToDeclEngine.goToDeclaration();

}</xpp>

  • Add the following code as a method into the EditorScripts class

<xpp> void AOT_goToDeclarationBack(Editor e) {

   ;
   AxGoToDeclarationGoBack::main(new Args());

}</xpp>

User Guide[edit]

There is not much to describe. Just select the variable, right click, select Scripts\AOT\goToDeclaration and you are done. if the declaration of the selected variable is found, you will be moved to the corresponding line in the editor.

Known Issues (small inconveniences)[edit]

  • 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
  • Does not find variable declarations that are not secure, for example like the following:

<xpp> class Class1 {

   Class2  classVar, classVar2;

} </xpp> ClassVar2 will not be found. (It is insecure because if you declare a class names classVar2, than the compilation of class1 will fail)

Plans for upgrade (Suggestions)[edit]

  • Open AOT objects when this or element is selected (table, class, form, etc)
  • Open AOT objects with the property sheet for objects with AutoDeclaration = Yes
  • Include global classes into the search

Thanks[edit]

  • AndyD - for the timer AOT edit code and the selectedLine method modifications
  • Max Belugin - for ParserClass_class descripton
  • Alex55 - for the idea and basic implementation of AxGoToDeclarationGoBack class
  • Miker - version 1.1.2 implementation

See also[edit]

Editor_scripts_OpenInAOT - Another Editor script for developers