コード例 #1
0
ファイル: SledDocument.cs プロジェクト: victorzhangl/SLED
        private static IEnumerable <object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
        {
            // Grab all SLED document plugins
            var docPlugins = SledServiceInstance.GetAll <ISledDocumentPlugin>();

            // Collect popup commands from SLED document plugins
            var commandTags = new List <object>();

            foreach (var docPlugin in docPlugins)
            {
                var lstCommandTags = docPlugin.GetPopupCommandTags(args);
                if (lstCommandTags == null)
                {
                    continue;
                }

                commandTags.AddRange(lstCommandTags);
                commandTags.Add(null);
            }

            if (commandTags.Count > 0)
            {
                commandTags.RemoveAt(commandTags.Count - 1); // trim last null
            }
            return(commandTags);
        }
コード例 #2
0
        private static ISledLanguagePlugin GetLanguagePlugin(string languagePluginString)
        {
            if (string.IsNullOrEmpty(languagePluginString))
            {
                return(null);
            }

            var languagePluginService =
                SledServiceInstance.Get <ISledLanguagePluginService>();

            foreach (var kv in languagePluginService.LanguagePlugins)
            {
                var plugin = kv.Value;
                if (plugin == null)
                {
                    continue;
                }

                if (string.Compare(plugin.LanguageName, languagePluginString, StringComparison.Ordinal) == 0)
                {
                    return(plugin);
                }
            }

            return(null);
        }
コード例 #3
0
        void IInitializable.Initialize()
        {
            if (IsInitialized)
            {
                return;
            }

            var networkPlugins = SledServiceInstance.GetAll <ISledNetworkPlugin>();

            m_lstPlugins.Clear();

            using (new SledOutDevice.BreakBlock())
            {
                foreach (var netPlugin in networkPlugins)
                {
                    // Add plugin to list
                    m_lstPlugins.Add(netPlugin);

                    // Report the plugin was found
                    SledOutDevice.OutLine(
                        SledMessageType.Info,
                        SledUtil.TransSub(Localization.SledNetworkPluginLoaded, netPlugin.Protocol, netPlugin.Name));
                }
            }

            try
            {
                Initialized.Raise(this, EventArgs.Empty);
            }
            finally
            {
                IsInitialized = true;
            }
        }
コード例 #4
0
            public static ILuaCompiler Create()
            {
                try
                {
                    if (s_luaVersionService == null)
                    {
                        s_luaVersionService = SledServiceInstance.TryGet <ISledLuaLuaVersionService>();
                    }

                    if (s_luaVersionService == null)
                    {
                        return(new Sce.Lua.Utilities.Lua51.x86.LuaCompiler());
                    }

                    switch (s_luaVersionService.CurrentLuaVersion)
                    {
                    case LuaVersion.Lua51: return(new Sce.Lua.Utilities.Lua51.x86.LuaCompiler());

                    case LuaVersion.Lua52: return(new Sce.Lua.Utilities.Lua52.x86.LuaCompiler());

                    default: throw new NullReferenceException("Unknown Lua version!");
                    }
                }
                catch (Exception ex)
                {
                    SledOutDevice.OutLine(
                        SledMessageType.Error,
                        "{0}: Exception creating Lua compiler: {1}",
                        typeof(SledLuaCompilerServiceFactory), ex.Message);

                    return(null);
                }
            }
コード例 #5
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DebugConnect          += DebugServiceDebugConnect;
            m_debugService.DebugDisconnect       += DebugServiceDebugDisconnect;
            m_debugService.DebugStart            += DebugServiceDebugStart;
            m_debugService.DebugCurrentStatement += DebugServiceDebugCurrentStatement;
            m_debugService.DebugStepInto         += DebugServiceDebugStepInto;
            m_debugService.DebugStepOver         += DebugServiceDebugStepOver;
            m_debugService.DebugStepOut          += DebugServiceDebugStepOut;
            m_debugService.BreakpointHitting     += DebugServiceBreakpointHitting;
            m_debugService.BreakpointHit         += DebugServiceBreakpointHit;
            m_debugService.BreakpointContinue    += DebugServiceBreakpointContinue;
            m_debugService.Disconnected          += DebugServiceDisconnected;

            m_documentService =
                SledServiceInstance.Get <ISledDocumentService>();

            m_documentService.Opened  += DocumentServiceOpened;
            m_documentService.Saving  += DocumentServiceSaving;
            m_documentService.Saved   += DocumentServiceSaved;
            m_documentService.Closing += DocumentServiceClosing;

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectService.FileAdded    += ProjectServiceFileAdded;
            m_projectService.FileRemoving += ProjectServiceFileRemoving;
        }
コード例 #6
0
        void IInitializable.Initialize()
        {
            m_luaLanguagePlugin =
                SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.UpdateEnd    += DebugServiceUpdateEnd;
            m_debugService.Disconnected += DebugServiceDisconnected;

            var projectService =
                SledServiceInstance.Get <ISledProjectService>();

            projectService.Created += ProjectServiceCreated;
            projectService.Opened  += ProjectServiceOpened;
            projectService.Saved   += ProjectServiceSaved;
            projectService.Closing += ProjectServiceClosing;

            m_editor.TreeListViewAdapter.RetrieveVirtualItem += TreeListViewAdapterRetrieveVirtualItem;

            // Adjust to shortened name if this language plugin is the only one loaded
            if (m_languagePluginService.Get.Count == 1)
            {
                m_editor.Name = Localization.SledLuaMemoryTraceTitleShort;
            }
        }
コード例 #7
0
        void IInitializable.Initialize()
        {
            PreviousStackLevel = -1;

            m_luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_projectService.Created += ProjectServiceCreated;
            m_projectService.Opened  += ProjectServiceOpened;
            m_projectService.Closing += ProjectServiceClosing;

            m_debugService               = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.UpdateBegin  += DebugServiceUpdateBegin;
            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.UpdateEnd    += DebugServiceUpdateEnd;
            m_debugService.Disconnected += DebugServiceDisconnected;

            m_luaFunctionCursorWatcherService = SledServiceInstance.Get <ISledLuaFunctionCursorWatcherService>();
            m_luaFunctionCursorWatcherService.CursorFunctionChanged += LuaFunctionCursorWatcherServiceCursorFunctionChanged;

            m_callStackEditor.MouseClick       += CallStackEditorMouseClick;
            m_callStackEditor.MouseDoubleClick += CallStackEditorMouseDoubleClick;

            // Adjust to shortened name if Lua language plugin is the only one loaded
            if (m_languagePluginService.Value.Count == 1)
            {
                m_callStackEditor.Name = Localization.SledLuaCallStackTitleShort;
            }

            //m_liveConnectService = SledServiceInstance.TryGet<ISledLiveConnectService>();
            //if (m_liveConnectService != null)
            //{
            //}
        }
コード例 #8
0
        void IInitializable.Initialize()
        {
            m_luaLanguagePlugin =
                SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.UpdateEnd    += DebugServiceUpdateEnd;
            m_debugService.Disconnected += DebugServiceDisconnected;

            var projectService =
                SledServiceInstance.Get <ISledProjectService>();

            projectService.Created += ProjectServiceCreated;
            projectService.Opened  += ProjectServiceOpened;
            projectService.Saved   += ProjectServiceSaved;
            projectService.Closing += ProjectServiceClosing;

            m_editor.MouseDoubleClick += EditorMouseDoubleClick;

            m_funcCallsEditor.MouseDoubleClick += FuncCallsEditorMouseDoubleClick;
            m_funcCallsEditor.TreeListViewAdapter.ItemLazyLoad += FuncCallsEditorItemLazyLoad;

            // Adjust to shortened name if this language plugin is the only one loaded
            if (m_languagePluginService.Get.Count != 1)
            {
                return;
            }

            m_editor.Name          = Localization.SledLuaProfileInfoTitleShort;
            m_funcCallsEditor.Name = Localization.SledLuaProfileFuncCallsTitleShort;
        }
コード例 #9
0
        public void Initialize(ISledDocument sd)
        {
            m_sd = sd;

            // Default state
            m_bChangingSelection = true;
            Items.Add(NotProjectFile);
            SelectedItem         = NotProjectFile;
            Enabled              = false;
            m_bChangingSelection = false;

            // Follow user interaction
            SelectedIndexChanged += SledLuaFunctionToolbarSelectedIndexChanged;

            m_gotoService = SledServiceInstance.Get <ISledGotoService>();

            m_projectService = SledServiceInstance.Get <ISledProjectService>();

            m_projectService.FileOpened   += ProjectServiceFileOpened;
            m_projectService.Opened       += ProjectServiceOpened;
            m_projectService.FileAdded    += ProjectServiceFileAdded;
            m_projectService.FileRemoving += ProjectServiceFileRemoving;

            m_luaFunctionParserService = SledServiceInstance.Get <ISledLuaFunctionParserService>();
            m_luaFunctionParserService.ParsedFunctions += LuaFunctionParserServiceParsedFunctions;

            m_luaFunctionCursorWatcherService = SledServiceInstance.Get <ISledLuaFunctionCursorWatcherService>();
            m_luaFunctionCursorWatcherService.CursorFunctionChanged += LuaFunctionCursorWatcherServiceCursorFunctionChanged;
        }
コード例 #10
0
        private void WriteToDisk()
        {
            if (!m_bDirty)
            {
                return;
            }

            try
            {
                if (m_collection == null)
                {
                    return;
                }

                if (m_collection.ProfileInfo.Count <= 0)
                {
                    return;
                }

                var schemaLoader =
                    SledServiceInstance.Get <SledSharedSchemaLoader>();

                if (schemaLoader == null)
                {
                    return;
                }

                var projDir =
                    m_projectService.Get.ProjectDirectory;

                var filePath =
                    Path.Combine(
                        projDir + Path.DirectorySeparatorChar,
                        m_collection.Name + ".xml");

                var uri = new Uri(filePath);

                using (var stream =
                           new FileStream(uri.LocalPath, FileMode.Create, FileAccess.Write))
                {
                    var writer =
                        new DomXmlWriter(schemaLoader.TypeCollection);

                    writer.Write(m_collection.DomNode, stream, uri);
                }
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    "[SledLuaProfilerService] Failure to " +
                    "save profiler data to disk: {0}",
                    ex.Message);
            }
            finally
            {
                m_bDirty = false;
            }
        }
コード例 #11
0
 protected override void Initialize()
 {
     m_luaCallStackService                     = SledServiceInstance.Get <ISledLuaCallStackService>();
     m_luaCallStackService.Clearing           += LuaCallStackServiceClearing;
     m_luaCallStackService.LevelAdding        += LuaCallStackServiceLevelAdding;
     m_luaCallStackService.StackLevelChanging += LuaCallStackServiceStackLevelChanging;
     m_luaCallStackService.StackLevelChanged  += LuaCallStackServiceStackLevelChanged;
 }
コード例 #12
0
        void IInitializable.Initialize()
        {
            var luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            var ttyService = SledServiceInstance.Get <ISledTtyService>();

            ttyService.RegisterLanguage(luaLanguagePlugin);
        }
コード例 #13
0
        void IInitializable.Initialize()
        {
            m_debugService = SledServiceInstance.Get <ISledDebugService>();

            m_networkPluginService = SledServiceInstance.Get <ISledNetworkPluginService>();

            LoadImportedTargets();
            UpdateRemoteTargetComboBox();
        }
コード例 #14
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.Ready        += DebugServiceReady;
            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.Disconnected += DebugServiceDisconnected;
        }
コード例 #15
0
        void IInitializable.Initialize()
        {
            m_debugService               = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.Connected    += DebugServiceConnected;
            m_debugService.DataReady    += DebugServiceDataReady;
            m_debugService.Disconnected += DebugServiceDisconnected;

            m_luaStatesEditor.TreeListViewAdapter.ItemChecked += TreeListViewAdapterItemChecked;
        }
コード例 #16
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.Connecting   += DebugServiceConnecting;
            m_debugService.Connected    += DebugServiceConnected;
            m_debugService.Disconnected += DebugServiceDisconnected;
        }
コード例 #17
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_debugService.DataReady += DebugServiceDataReady;

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();
        }
コード例 #18
0
        /// <summary>
        /// Validate the condition string has some text in it
        /// </summary>
        /// <param name="sender">object that fired the event</param>
        /// <param name="e">event arguments</param>
        private void BtnOkClick(object sender, EventArgs e)
        {
            // Need to make sure if a condition is being saved then it must be valid
            var bSyntaxCheckCondition = (ConditionEnabled || !string.IsNullOrEmpty(Condition));

            if (!bSyntaxCheckCondition)
            {
                return;
            }

            if (string.IsNullOrEmpty(Condition))
            {
                MessageBox.Show(
                    this,
                    Localization.SledBreakpointConditionErrorNoCondition,
                    Localization.SledBreakpointConditionError,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);

                // Make user enter valid stuff
                DialogResult = DialogResult.None;
            }
            else
            {
                // Check syntax
                if (m_plugin != null)
                {
                    // Wrap the condition in a function like how it would be when running in libluaplugin
                    var szCondFunc = string.Format("function libluaplugin_condfunc(){0}    return ({1}){0}end", Environment.NewLine, Condition);

                    // Format actual syntax checker to use
                    var szSyntaxCheckFunc =
                        string.Format("function libluaplugin_condfunc()\nreturn ({0})\nend", Condition);

                    var syntaxCheckerService = SledServiceInstance.Get <ISledSyntaxCheckerService>();

                    // Force a syntax check of the string
                    var errors = syntaxCheckerService.CheckString(m_plugin, szSyntaxCheckFunc);
                    if (errors.Any())
                    {
                        // Show error
                        MessageBox.Show(
                            this,
                            SledUtil.TransSub(
                                Localization.SledBreakpointConditionErrorVarArg,
                                Environment.NewLine, szCondFunc, errors.ElementAt(0).Error),
                            Localization.SledBreakpointConditionSyntaxError);

                        // Make user fix error
                        DialogResult = DialogResult.None;
                    }
                }
            }
        }
コード例 #19
0
        public void Initialize()
        {
            BuildControl();

            var mainForm = SledServiceInstance.TryGet <MainForm>();

            mainForm.Shown += MainFormShown;

            SkinService.ApplyActiveSkin(SledTtyMessageColorer.Instance);
            SkinService.SkinChangedOrApplied += SkinServiceSkinChangedOrApplied;
        }
コード例 #20
0
        void IInitializable.Initialize()
        {
            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectWatcherService =
                SledServiceInstance.Get <ISledProjectWatcherService>();

            m_projectWatcherService.AttributeChangedEvent += ProjectWatcherServiceAttributeChangedEvent;
            m_projectWatcherService.FileChangedEvent      += ProjectWatcherServiceFileChangedEvent;
        }
コード例 #21
0
        void IInitializable.Initialize()
        {
            m_luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_debugService            = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.DataReady += DebugServiceDataReady;

            var projectService = SledServiceInstance.Get <ISledProjectService>();

            projectService.Closing += ProjectServiceClosing;
        }
コード例 #22
0
        void IInitializable.Initialize()
        {
            var documentClients = SledServiceInstance.GetAll <ISledDocumentClient>();

            foreach (var client in documentClients)
            {
                m_dictExtensions.Add(client.Info.FileType, client.Info.Extensions.ToList());
            }

            m_bModifiedSinceLastBuild = true;
        }
コード例 #23
0
        void IInitializable.Initialize()
        {
            m_documentService = SledServiceInstance.Get <ISledDocumentService>();
            m_documentService.ActiveDocumentChanged += DocumentServiceActiveDocumentChanged;

            m_projectService              = SledServiceInstance.Get <ISledProjectService>();
            m_projectService.Created     += ProjectServiceCreated;
            m_projectService.Opened      += ProjectServiceOpened;
            m_projectService.Closed      += ProjectServiceClosed;
            m_projectService.NameChanged += ProjectServiceNameChanged;
        }
コード例 #24
0
        void IInitializable.Initialize()
        {
            var projectService = SledServiceInstance.Get <ISledProjectService>();

            projectService.Created        += ProjectServiceCreated;
            projectService.Opened         += ProjectServiceOpened;
            projectService.SavedAsing     += ProjectServiceSavedAsing;
            projectService.SavedAsed      += ProjectServiceSavedAsed;
            projectService.SavingSettings += ProjectServiceSavingSettings;
            projectService.SavedSettings  += ProjectServiceSavedSettings;
            projectService.Closing        += ProjectServiceClosing;
        }
コード例 #25
0
ファイル: SledDocument.cs プロジェクト: victorzhangl/SLED
        private void EditorMouseHoveringOverToken(object sender, MouseHoverOverTokenEventArgs e)
        {
            // Collect values to display, if any
            var toolTips = new List <string>();

            var docPlugins = SledServiceInstance.GetAll <ISledDocumentPlugin>();

            var ea = new SledDocumentHoverOverTokenArgs(this, e);

            // Gather all tooltips from plugins
            foreach (var docPlugin in docPlugins)
            {
                var lstToolTips = docPlugin.GetMouseHoverOverTokenValues(ea);

                if (lstToolTips == null)
                {
                    continue;
                }

                toolTips.AddRange(lstToolTips);
            }

            // If no tooltips then abort
            if (toolTips.Count <= 0)
            {
                return;
            }

            var bFirst = true;

            m_sbToolTip.Remove(0, m_sbToolTip.Length);

            // Concatenate uber tooltip
            foreach (var toolTip in toolTips)
            {
                if (!bFirst)
                {
                    m_sbToolTip.Append("<br/>");
                }

                m_sbToolTip.Append(toolTip);

                if (bFirst)
                {
                    bFirst = false;
                }
            }

            // Show uber tooltip
            e.TooltipText = m_sbToolTip.ToString();
        }
コード例 #26
0
        public override void Initialize()
        {
            base.Initialize();

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectService.Created += ProjectServiceCreated;
            m_projectService.Opened  += ProjectServiceOpened;
            m_projectService.Closing += ProjectServiceClosing;

            KeyUp            += ControlKeyUp;
            MouseDoubleClick += ControlMouseDoubleClick;
        }
コード例 #27
0
        public override void Initialize()
        {
            base.Initialize();

            m_projectService          = SledServiceInstance.Get <ISledProjectService>();
            m_projectService.Created += ProjectServiceCreated;
            m_projectService.Opened  += ProjectServiceOpened;
            m_projectService.Closed  += ProjectServiceClosed;

            m_syntaxCheckerService = SledServiceInstance.Get <ISledSyntaxCheckerService>();
            m_syntaxCheckerService.FilesCheckFinished += SyntaxCheckerServiceFilesCheckFinished;

            MouseDoubleClick += ControlMouseDoubleClick;
        }
コード例 #28
0
        /// <summary>
        /// Create project watch from Lua variable
        /// </summary>
        /// <param name="luaVar"></param>
        /// <returns></returns>
        public static SledLuaProjectFilesWatchType CreateFromLuaVar(ISledLuaVarBaseType luaVar)
        {
            var projectFilesWatch =
                new DomNode(SledLuaSchema.SledLuaProjectFilesWatchType.Type)
                .As <SledLuaProjectFilesWatchType>();

            var luaLanguagePlugin = SledServiceInstance.TryGet <SledLuaLanguagePlugin>();

            projectFilesWatch.Name           = luaVar.DisplayName;
            projectFilesWatch.LanguagePlugin = luaLanguagePlugin;
            projectFilesWatch.Scope          = luaVar.Scope;
            projectFilesWatch.Context        = SledLuaVarLookUpContextType.WatchProject;
            projectFilesWatch.LookUp         = SledLuaVarLookUpType.FromLuaVar(luaVar, projectFilesWatch.Context);

            return(projectFilesWatch);
        }
コード例 #29
0
        void IInitializable.Initialize()
        {
            m_debugService =
                SledServiceInstance.Get <ISledDebugService>();

            m_luaLanguagePlugin =
                SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_projectService =
                SledServiceInstance.Get <ISledProjectService>();

            m_projectService.Created   += ProjectServiceCreated;
            m_projectService.Opened    += ProjectServiceOpened;
            m_projectService.FileAdded += ProjectServiceFileAdded;
            m_projectService.Closing   += ProjectServiceClosing;
        }
コード例 #30
0
        void IInitializable.Initialize()
        {
            m_debugService               = SledServiceInstance.Get <ISledDebugService>();
            m_debugService.Connected    += DebugServiceConnected;
            m_debugService.Disconnected += DebugServiceDisconnected;

            m_luaLanguagePlugin = SledServiceInstance.Get <SledLuaLanguagePlugin>();

            m_luaVariableParserService              = SledServiceInstance.Get <ISledLuaVariableParserService>();
            m_luaVariableParserService.ParsedFiles += LuaVariableParserServiceParsedFiles;

            var breakpointService = SledServiceInstance.Get <ISledBreakpointService>();

            breakpointService.Added       += BreakpointServiceAdded;
            breakpointService.SilentAdded += BreakpointServiceSilentAdded;
        }