Показать сообщение отдельно
Старый 08.12.2006, 11:12   #7  
belugin is offline
belugin
Участник
Аватар для belugin
Сотрудники Microsoft Dynamics
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии 2011
Лучший по профессии 2009
 
4,622 / 2925 (107) +++++++++
Регистрация: 16.01.2004
Записей в блоге: 5
Слегка поменял EditorScript - теперь в случае только одного варианта окно не мигает
X++:
// util, bmi, 23.06.04
void go(Editor e)
{
    boolean activate;
    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');
            activate = true;
        }
        else
        {
            r=new FormRun(new Args(formStr(Dev_GoComponent)));
            r.init();
        }
        o=r;
        o.componentName(_componentName);
        if (o.isSingle())
        {
            go = o.go();
        }

        if(go)
        {
            r.close();
        }
        else
        {
            if (activate)
                infolog.activateWindow(r.hWnd());
            else
                r.run();
            r.detach();
        }
    }
;
    goComponent(currentText());
}