protected virtual void TreeListViewAdapterItemLazyLoad(object sender, TreeListViewAdapter.ItemLazyLoadEventArgs e)
        {
            if (!DebugService.IsConnected || DebugService.IsDebugging)
            {
                return;
            }

            // Get object as a Lua variable
            var luaVar = e.Item.As <TType>();

            if (luaVar == null)
            {
                return;
            }

            // Item already being looked up
            if (ListInsert.Contains(luaVar))
            {
                return;
            }

            if (luaVar.What == SledLuaVarBaseType.InvalidVarWhat)
            {
                return;
            }

            // Get lookup string
            var lookUp = SledLuaVarLookUpType.FromLuaVar(luaVar, SledLuaVarLookUpContextType.Normal);

            // Convert string to SCMP message
            var scmp = new Scmp.LuaVarLookUp(LuaLanguagePlugin.LanguageId, lookUp);

            //SledOutDevice.OutLine(SledMessageType.Error, "[Variable Lookup] {0}", lookUp.ToString());

            luaVar.Expanded = true;

            // Keep track of item so that children can be added properly
            ListInsert.Add(luaVar);

            // Send lookup message
            DebugService.SendScmp(scmp);
        }
        protected virtual void DomNodeAttributeChanged(object sender, AttributeEventArgs e)
        {
            if (UndoingAttribute)
            {
                return;
            }

            if ((e.AttributeInfo != SledLuaSchema.SledLuaVarGlobalType.valueAttribute) &&
                (e.AttributeInfo != SledLuaSchema.SledLuaVarLocalType.valueAttribute) &&
                (e.AttributeInfo != SledLuaSchema.SledLuaVarUpvalueType.valueAttribute) &&
                (e.AttributeInfo != SledLuaSchema.SledLuaVarEnvType.valueAttribute))
            {
                return;
            }

            var bUndo = true;

            try
            {
                var bCanModifyVariables =
                    DebugService.IsConnected &&
                    !DebugService.IsDebugging;

                if (!bCanModifyVariables)
                {
                    SledOutDevice.OutLine(
                        SledMessageType.Error,
                        Localization.SledLuaModifyVarInvalidTime);

                    return;
                }

                var luaVar = e.DomNode.As <ISledLuaVarBaseType>();
                if (luaVar == null)
                {
                    return;
                }

                // Check if variable type is modifiable by SLED
                if (!SledLuaUtil.IsEditableLuaType(luaVar))
                {
                    SledOutDevice.OutLine(
                        SledMessageType.Error,
                        Localization.SledLuaModifyVarInvalidType);

                    return;
                }

                string szNewValue = null;

                // Check if what the user entered is valid for that particular Lua type
                switch (luaVar.LuaType)
                {
                case LuaType.LUA_TNUMBER:
                {
                    // Make sure no letters
                    double dNumber;
                    var    szValue = e.NewValue.ToString();
                    if (!double.TryParse(szValue, out dNumber))
                    {
                        SledOutDevice.OutLine(
                            SledMessageType.Error,
                            SledUtil.TransSub(Localization.SledLuaModifyVarInvalidValue1, szValue));

                        return;
                    }

                    szNewValue = szValue;
                }
                break;

                case LuaType.LUA_TSTRING:
                {
                    szNewValue = e.NewValue.ToString();
                }
                break;

                case LuaType.LUA_TBOOLEAN:
                {
                    // Make sure true/false/1/0
                    var szValue = e.NewValue.ToString().ToLower();
                    if (string.Compare(szValue, Resources.Resource.True, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        szNewValue = Resources.Resource.One;
                    }
                    else if (string.Compare(szValue, Resources.Resource.False, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        szNewValue = Resources.Resource.Zero;
                    }
                    else
                    {
                        if ((string.Compare(szValue, Resources.Resource.One, StringComparison.Ordinal) != 0) &&
                            (string.Compare(szValue, Resources.Resource.Zero, StringComparison.Ordinal) != 0))
                        {
                            SledOutDevice.OutLine(
                                SledMessageType.Error,
                                SledUtil.TransSub(Localization.SledLuaModifyVarInvalidValue2, e.NewValue));

                            return;
                        }

                        szNewValue = szValue;
                    }
                }
                break;
                }

                // Somehow the value the user wanted didn't make it through
                if (string.IsNullOrEmpty(szNewValue))
                {
                    return;
                }

                // Cheat and use this to get all the key value pairs.
                // This takes into account watched variables as well!
                var lookUp = SledLuaVarLookUpType.FromLuaVar(luaVar, SledLuaVarLookUpContextType.Normal);
                if (lookUp == null)
                {
                    return;
                }

                SledOutDevice.OutLine(SledMessageType.Info, Localization.SledLuaModifyVarSent);

                // Send message off
                DebugService.SendScmp(new Scmp.LuaVarUpdate(LuaLanguagePlugin.LanguageId, lookUp, szNewValue, (int)luaVar.LuaType));

                bUndo = false;
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLineDebug(
                    SledMessageType.Error,
                    "{0}: Exception in DomNodeAttributeChanged: {1}",
                    this, ex.Message);

                bUndo = true;
            }
            finally
            {
                if (bUndo)
                {
                    UndoAttributeChange(e);
                }
            }
        }