Ejemplo n.º 1
0
        private List <IScript> GetScriptsToSearch(string token, out int?startSearchAtLineIndex, out int?endSearchAtLineIndex)
        {
            List <IScript> scriptsToSearch = null;

            startSearchAtLineIndex = null;
            endSearchAtLineIndex   = null;
            ScriptToken scriptToken = null;

            if (_scriptEditor != null && _scintilla != null)
            {
                scriptToken = _scriptEditor.FindTokenAsLocalVariable(token, true);
            }
            if (scriptToken != null)
            {
                ScriptFunction function = _scintilla.FindFunctionAtCurrentPosition();
                if (function != null)
                {
                    scriptsToSearch = new List <IScript> {
                        _script
                    };
                    startSearchAtLineIndex = _scintilla.FindLineNumberForCharacterIndex(function.StartsAtCharacterIndex);
                    endSearchAtLineIndex   = _scintilla.FindLineNumberForCharacterIndex(function.EndsAtCharacterIndex);
                }
            }

            if (scriptsToSearch == null)
            {
                ScriptStruct scriptStruct = null;
                if (_scriptEditor != null)
                {
                    scriptStruct = _scriptEditor.FindGlobalVariableOrType(token);
                }
                if (scriptStruct == null)
                {
                    scriptsToSearch = _agsEditor.GetAllScripts();
                }
                else
                {
                    scriptsToSearch = new List <IScript> {
                        _script
                    };
                }
            }
            return(scriptsToSearch);
        }
Ejemplo n.º 2
0
 private List<IScript> GetScriptsForFindReplace(LookInDocumentType lookIn, bool findAll, out bool jumpToStart)
 {
     switch (lookIn)
     {
         case LookInDocumentType.CurrentDocument:
             jumpToStart = !findAll;
             return new List<IScript> { _script };
         case LookInDocumentType.CurrentProject:
             jumpToStart = false;
             List<IScript> scripts = _agsEditor.GetAllScripts();
             if (!findAll)
             {
                 OrderScriptsBySelectedScript(scripts);
             }
             return scripts;
         default:
             throw new NotSupportedException(string.Format("{0} is not supported yet", lookIn));
     }
 }