Axaptapedia is now maintained by AgileCadence For more information please click here.

Go component

From Axaptapedia
Jump to: navigation, search

This IDE extension is used to open component it AOT by it's name (download) Go component screenshot.png

it can be integrated via editor script to go to identifier under cursor (EditorScripts_go.xpp in the archive)

<xpp> // util, bmi, 23.06.04 void go(Editor e) {

   boolean hasSelection()
   {
       return e.selectionStartCol()!=e.selectionEndCol();
   }
   str selection()
   {
   ;
       return subStr(e.currentLine(),
                     e.selectionStartCol(),
                     e.selectionEndCol()-e.selectionStartCol());
   }
   boolean isIdentifier(str _char)
   {
       return match('[a-z0-9_]', _char);
   }
   str currentIdentifier()
   {
       str line = e.currentLine();
       int pos;
       int idStart;
   ;
       for(pos = e.selectionStartCol(); pos >= 0 && isIdentifier(subStr(line, pos, 1)); pos--)
           pos=pos;
       idStart = pos + 1;
       for(pos = e.selectionStartCol()+1; pos <= strLen(line) && isIdentifier(subStr(line, pos, 1)); pos++)
           pos=pos;
       return subStr(line, idStart, pos - idStart);
   }
   str currentText()
   {
       return hasSelection() ? selection() : currentIdentifier();
   }
   void goComponent(str _componentName="")
   {
       FormRun r;
       Object o;
       SysGlobalCache cache=infolog.globalCache();
       boolean go;
   ;
       if(cache.isSet(formStr(Dev_GoComponent), 'running'))
       {
           r=cache.get(formStr(Dev_GoComponent), 'running');
           infolog.activateWindow(r.hWnd());
       }
       else
       {
           r=new FormRun(new Args(formStr(Dev_GoComponent)));
           r.run();
       }
       o=r;
       o.componentName(_componentName);
       if (o.isSingle())
       {
           go = o.go();
       }
       r.detach();
       if(go)
           r.close();
   }
   goComponent(currentText());

} </xpp>