public SledLuaFunctionType GetCurrentCursorFunction(ISledDocument sd)
        {
            if (sd == null)
                return null;

            // No project file to contain functions
            if (sd.SledProjectFile == null)
                return null;

            // No functions parsed
            if (m_dictFunctions.Count <= 0)
                return null;

            // No parsed functions for project file
            List<SledLuaFunctionType> lstLuaFuncs;
            if (!m_dictFunctions.TryGetValue(sd.SledProjectFile, out lstLuaFuncs))
                return null;

            var lineNumber = sd.Editor.CurrentLineNumber;

            // Figure out which function the cursor is in
            var lstPotentialFuncs = GetPotentialFunctions(lineNumber, lstLuaFuncs).ToList();

            var cursorFunc = GetClosestFromPotentialFunctions(lineNumber, lstPotentialFuncs);

            return cursorFunc;
        }
Esempio n. 2
0
        /// <summary>
        /// Go to a specific word on a line in a file
        /// </summary>
        /// <param name="sd">document</param>
        /// <param name="szWord">word to find</param>
        /// <param name="iLine">line in document</param>
        /// <param name="iOccurence">if the word occurs multiple times on a line then this represents which occurence</param>
        /// <param name="bUseCsi">whether to use a "current statement indicator" or not</param>
        public void GotoLineWord(ISledDocument sd, string szWord, int iLine, int iOccurence, bool bUseCsi)
        {
            if (sd == null)
                return;

            // Bring this files tab to the front
            m_controlHostService.Show(sd.Control);

            try
            {
                if (iOccurence < 0)
                {
                    // Selecting whole line
                    sd.Editor.SelectLine(iLine);
                }
                else
                {
                    // Selecting part of line

                    // Try and select the word "name" on the line
                    var szLine = sd.Editor.GetLineText(iLine);

                    var iBeg = -1;
                    for (var i = 0; i < iOccurence; i++)
                        iBeg = szLine.IndexOf(szWord, iBeg + 1);

                    var iEnd = iBeg + szWord.Length - 1;

                    // Select
                    sd.Editor.SelectLine(iLine, iBeg, iEnd);
                }

                // Scroll to line
                sd.Editor.CurrentLineNumber = iLine;

                if (bUseCsi)
                    sd.Editor.CurrentStatement(iLine, true);
            }
            catch (Exception ex)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Error,
                    SledUtil.TransSub(
                        Localization.SledGotoLineError1,
                        iLine, Path.GetFileName(sd.Uri.LocalPath), ex.Message));
            }

            // Now force focus to actually see the cursor on the newly selected line
            sd.Control.Focus();
        }
Esempio n. 3
0
        public void AddFile(ISledDocument sd)
        {
            lock (m_lock)
            {
                if (m_lstFiles.Contains(sd))
                    return;

                // Add to collection
                m_lstFiles.Add(sd);
                // Add to list box
                m_lstBoxFiles.Items.Add(new SledModifiedFilesFormItem(sd));

                // Select first item added
                if (m_lstBoxFiles.Items.Count == 1)
                    m_lstBoxFiles.SelectedIndex = 0;
            }
        }
        /// <summary>
        /// Create a new project file or return a reference to one in the project if it already exists
        /// </summary>
        /// <param name="sd">Open document</param>
        /// <param name="bAlreadyInProject">Whether the project file already exists in the project</param>
        /// <param name="project">Project to aid in file creation</param>
        /// <returns>Project file</returns>
        public SledProjectFilesFileType CreateFrom(ISledDocument sd, SledProjectFilesType project, out bool bAlreadyInProject)
        {
            // Check for existing
            var file = m_projectFilesFinderService.Get.Find(sd);
            if (file != null)
            {
                bAlreadyInProject = true;
                return file;
            }

            // Create new
            file = SledProjectFilesFileType.Create(sd.Uri.LocalPath, project);
            SetupFile(file);

            // Set references
            SetReferences(file, sd);

            bAlreadyInProject = false;
            return file;
        }
        /// <summary>
        /// Determines whether breakpoint can be added
        /// </summary>
        /// <param name="sd">Document (if any - might be null)</param>
        /// <param name="lineNumber">Line number of breakpoint</param>
        /// <param name="lineText">Text on line of breakpoint</param>
        /// <param name="numLanguagePluginBreakpoints">The current number of breakpoints that belong to the language plugin</param>
        /// <returns></returns>
        public bool CanAdd(ISledDocument sd, int lineNumber, string lineText, int numLanguagePluginBreakpoints)
        {
            // Allow all breakpoints to be added if disconnected
            if (m_debugService.IsDisconnected)
                return true;

            // Figure out if we can add the breakpoint & show message if not
            var bCanAdd = ((numLanguagePluginBreakpoints + 1) <= m_iMaxBreakpoints);
            if (!bCanAdd)
            {
                SledOutDevice.OutLine(
                    SledMessageType.Info,
                    SledUtil.TransSub(
                        "[%s0] Breakpoint cannot be added due to target setting " + 
                        "(will be over max allowed breakpoints: %s1).",
                        m_luaLanguagePlugin.LanguageName, m_iMaxBreakpoints));
            }

            return bCanAdd;
        }
        private void Remove(ISledDocument sd)
        {
            if (!IsValidDocument(sd))
            {
                return;
            }

            sd.UriChanged -= SledDocumentUriChanged;

            SledFileSystemWatcher watcher;

            if (!m_dict.TryGetValue(sd, out watcher))
            {
                return;
            }

            watcher.EnableRaisingEvents = false;
            watcher.Changed            -= WatcherChanged;
            watcher.Dispose();

            // Remove from dictionary
            m_dict.Remove(sd);
            m_dictFileStats.Remove(sd);
        }
        public SledLuaFunctionType GetCurrentCursorFunction(ISledDocument sd)
        {
            if (sd == null)
            {
                return(null);
            }

            // No project file to contain functions
            if (sd.SledProjectFile == null)
            {
                return(null);
            }

            // No functions parsed
            if (m_dictFunctions.Count <= 0)
            {
                return(null);
            }

            // No parsed functions for project file
            List <SledLuaFunctionType> lstLuaFuncs;

            if (!m_dictFunctions.TryGetValue(sd.SledProjectFile, out lstLuaFuncs))
            {
                return(null);
            }

            var lineNumber = sd.Editor.CurrentLineNumber;

            // Figure out which function the cursor is in
            var lstPotentialFuncs = GetPotentialFunctions(lineNumber, lstLuaFuncs).ToList();

            var cursorFunc = GetClosestFromPotentialFunctions(lineNumber, lstPotentialFuncs);

            return(cursorFunc);
        }
Esempio n. 8
0
        /// <summary>
        /// Try and remove the read only attribute from a file
        /// </summary>
        /// <param name="sd">Document to remove read only attribute from</param>
        /// <returns>True if read only attribute was removed false if it wasn't</returns>
        public bool TryRemoveReadOnlyAttribute(ISledDocument sd)
        {
            var bResult = false;
            var bValidDoc = IsValidDocument(sd);

            try
            {
                if (bValidDoc)
                    Disable(sd);

                File.SetAttributes(sd.Uri.LocalPath, FileAttributes.Normal);

                // Successful
                bResult = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    m_mainForm,
                    string.Format(
                        "{0}{1}{1}{2}",
                        Localization.SledFailChangePermissions,
                        Environment.NewLine,
                        SledUtil.TransSub(Localization.SledExceptionWas, ex.Message)),
                    Localization.SledFileReadOnlyError,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
            finally
            {
                if (bValidDoc)
                    Enable(sd);
            }

            return bResult;
        }
Esempio n. 9
0
        private static void EnableOrDisable(ISledDocument sd, int iLine, bool bEnable)
        {
            if (sd == null)
                return;

            if (!sd.IsValidLine(iLine))
                return;

            var ibp = sd.Editor.GetBreakpoint(iLine);
            if (ibp == null)
                return;

            var file = sd.SledProjectFile;
            if (file == null)
                return;

            var bp = FindBreakpointInFile(file, ibp);
            if (bp == null)
                return;

            // Make change (will cause events to fire in DomCollection_AttributeChanging/DomCollection_AttributeChanged)
            bp.Enabled = bEnable;
        }
Esempio n. 10
0
        private void RemoveBreakpoints(ISledDocument sd, IEnumerable<IBreakpoint> ibps)
        {
            // Called when remove-all is selected

            try
            {
                m_bAddingOrRemoving = true;

                var file = sd.SledProjectFile;

                foreach (var ibp in ibps)
                {
                    sd.Editor.Breakpoint(ibp.LineNumber, false);

                    if (file == null)
                        continue;

                    var bp = FindBreakpointInFile(file, ibp);

                    // Remove breakpoint from file (will fire event through Collection_Removing)
                    if (file.Breakpoints.Contains(bp))
                        file.Breakpoints.Remove(bp);
                }

                // Save changes
                m_projectService.SaveSettings();
            }
            finally
            {
                m_bAddingOrRemoving = false;
            }
        }
Esempio n. 11
0
        private void AddBreakpoints(ISledDocument sd, IEnumerable<IBreakpoint> ibps)
        {
            // Add breakpoints from "ibps" to the open document "sd"

            foreach (var ibp in ibps)
            {
                // Check for duplicates
                var bp = FindBreakpointInFile(sd.SledProjectFile, ibp);
                if (bp != null)
                    continue;

                // Create new
                bp = SledProjectFilesBreakpointType.Create(ibp);

                // Add breakpoint to GUI (will fire event through Collection_Inserted)
                sd.SledProjectFile.Breakpoints.Add(bp);
            }

            m_projectService.SaveSettings();
        }
Esempio n. 12
0
 private static bool IsValidDocument(ISledDocument sd)
 {
     return sd != null && File.Exists(sd.Uri.LocalPath);
 }
Esempio n. 13
0
        private bool Enable(ISledDocument sd)
        {
            // Check if item in the dictionary
            SledFileSystemWatcher watcher;
            if (!m_dict.TryGetValue(sd, out watcher))
                return false;
                
            watcher.EnableRaisingEvents = true;
            m_dictFileStats[sd] = SledFileSystemFileStats.GetStats(sd.Uri.LocalPath);

            // Successfully enabled
            return true;
        }
Esempio n. 14
0
        //private void ProjectService_FileRenaming(object sender, SledProjectServiceFileEventArgs e)
        //{
        //    ISledDocument sd = e.File.SledDocument;
        //    if (sd == null)
        //        return;

        //    if (!IsValidDocument(sd))
        //        return;

        //    Remove(sd);
        //}

        //private void ProjectService_FileRenamed(object sender, SledProjectServiceFileEventArgs e)
        //{
        //    ISledDocument sd = e.File.SledDocument;
        //    if (sd == null)
        //        return;

        //    if (!IsValidDocument(sd))
        //        return;

        //    Add(sd);
        //}

        #endregion

        #region Member Methods

        private void Add(ISledDocument sd)
        {
            if (!IsValidDocument(sd))
                return;

            sd.UriChanged += SledDocumentUriChanged;

            if (m_dict.ContainsKey(sd))
                return;

            var watcher =
                new SledFileSystemWatcher
                    {
                        Tag = sd,
                        Path = Path.GetDirectoryName(sd.Uri.LocalPath),
                        Filter = Path.GetFileName(sd.Uri.LocalPath),
                        NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Attributes,
                        SynchronizingObject = m_mainForm
                    };
            watcher.Changed += WatcherChanged;
            watcher.EnableRaisingEvents = true;

            // Add to dictionary
            m_dict[sd] = watcher;
            m_dictFileStats[sd] = SledFileSystemFileStats.GetStats(sd.Uri.LocalPath);
        }
Esempio n. 15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sd">SledDocument</param>
 /// <param name="e">Event arguments</param>
 public SledDocumentHoverOverTokenArgs(ISledDocument sd, MouseHoverOverTokenEventArgs e)
 {
     m_sd = sd;
     m_e = e;
 }
Esempio n. 16
0
 public SledModifiedFilesFormItem(ISledDocument sd)
 {
     m_sledDocument = sd;
 }
Esempio n. 17
0
 private static bool IsValidDocument(ISledDocument sd)
 {
     return(sd != null && File.Exists(sd.Uri.LocalPath));
 }
Esempio n. 18
0
 public SledModifiedFilesFormItem(ISledDocument sd)
 {
     m_sledDocument = sd;
 }
Esempio n. 19
0
            private static void AddEmbeddedTypes(
                IEnumerable <SledDocumentEmbeddedTypeInfo> embeddedTypes,
                Control parent,
                ISledDocument sd,
                ref int x,
                ref int y,
                ref int width,
                ref int height,
                ICollection <ISledDocumentEmbeddedType> lstEmbeddedTypes)
            {
                if (embeddedTypes == null)
                {
                    return;
                }

                // Embedded types must be assignable to
                // each of these types
                var ifaces =
                    new[]
                {
                    typeof(Control),
                    typeof(ISledDocumentEmbeddedType)
                };

                foreach (var embeddedType in embeddedTypes)
                {
                    var type = embeddedType;
                    if (!ifaces.All(t => t.IsAssignableFrom(type.Type)))
                    {
                        SledOutDevice.OutLine(
                            SledMessageType.Error,
                            "Cannot create embedded " +
                            "SledDocument type \"{0}\"",
                            type);

                        continue;
                    }

                    try
                    {
                        // Create embedded type
                        var cntrl =
                            (Control)Activator.CreateInstance(
                                embeddedType.Type);

                        var cntrlEmbed =
                            cntrl.As <ISledDocumentEmbeddedType>();

                        // Initialize
                        cntrlEmbed.Initialize(sd);

                        // Add to list
                        lstEmbeddedTypes.Add(cntrlEmbed);

                        // Adjust positioning
                        switch (embeddedType.Position)
                        {
                        case SledDocumentEmbeddedTypePosition.Left:
                        {
                            cntrl.Location = new Point(x, y);
                            cntrl.Height   = height;

                            x     += cntrl.Width;
                            width -= cntrl.Width;

                            cntrl.Anchor =
                                AnchorStyles.Left |
                                AnchorStyles.Top |
                                AnchorStyles.Bottom;
                        }
                        break;

                        case SledDocumentEmbeddedTypePosition.Top:
                        {
                            cntrl.Location = new Point(x, y);
                            cntrl.Width    = width;

                            y      += cntrl.Height;
                            height -= cntrl.Height;

                            cntrl.Anchor =
                                AnchorStyles.Left |
                                AnchorStyles.Top |
                                AnchorStyles.Right;
                        }
                        break;

                        case SledDocumentEmbeddedTypePosition.Right:
                        {
                            cntrl.Location = new Point(width - cntrl.Width, y);
                            cntrl.Height   = height;

                            width -= cntrl.Width;

                            cntrl.Anchor =
                                AnchorStyles.Top |
                                AnchorStyles.Right |
                                AnchorStyles.Bottom;
                        }
                        break;

                        case SledDocumentEmbeddedTypePosition.Bottom:
                        {
                            cntrl.Location = new Point(x, height - cntrl.Height);
                            cntrl.Width    = width;

                            height -= cntrl.Height;

                            cntrl.Anchor =
                                AnchorStyles.Left |
                                AnchorStyles.Right |
                                AnchorStyles.Bottom;
                        }
                        break;
                        }

                        parent.Controls.Add(cntrl);
                    }
                    catch (Exception ex)
                    {
                        SledOutDevice.OutLine(
                            SledMessageType.Error,
                            "Cannot create embedded " +
                            "SledDocument type \"{0}\": {1}",
                            type, ex.Message);
                    }
                }
            }
Esempio n. 20
0
 /// <summary>
 /// Constructor for Save[ing/ed] as events
 /// </summary>
 /// <param name="sd">SledDocument</param>
 /// <param name="uri">URI to old file when Save[ing/ed] as</param>
 public SledDocumentServiceEventArgs(ISledDocument sd, Uri uri)
 {
     Document = sd;
     Uri      = uri;
 }
Esempio n. 21
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sd">ISledDocument</param>
 public SledDocumentServiceEventArgs(ISledDocument sd)
     : this(sd, null)
 {
 }
        private void UnregisterDocument(ISledDocument sd)
        {
            if (!IsValidSledDocument(sd))
                return;

            if (!m_registeredDocs.Contains(sd))
                return;

            try
            {
                sd.Editor.CurrentLineNumberChanged -= EditorCurrentLineNumberChanged;
            }
            finally
            {
                m_registeredDocs.Remove(sd);
            }
        }
Esempio n. 23
0
        private static void RemoveCurrentStatementIndicators(ISledDocument sd)
        {
            if (sd == null)
                return;

            foreach (var line in sd.Editor.CurrentStatements)
            {
                sd.Editor.CurrentStatement(line, false);
            }
        }
        private void ColorBreakpoint(ISledDocument sd, SledProjectFilesBreakpointType bp)
        {
            if (!m_debugService.IsConnected)
                return;

            if (sd.SledProjectFile == null)
                return;

            // Grab parsed breakpoint line numbers associated with this file
            var parsedBreakpointsLineNumbers = m_luaVariableParserService.ValidBreakpointLineNumbers(sd.SledProjectFile);
            if (parsedBreakpointsLineNumbers == null)
                return;

            // If breakpoint line number not in list then mark it as invalid
            if (!parsedBreakpointsLineNumbers.Contains(bp.Line))
                bp.Breakpoint.BackColor = m_bpInvalidColor;
        }
Esempio n. 25
0
 private static void SetReferences(SledProjectFilesFileType file, ISledDocument sd)
 {
     file.SledDocument  = sd;
     sd.SledProjectFile = file;
 }
        private void FindFunction(ISledDocument sd, int lineNumber)
        {
            if (m_dictFunctions.Count <= 0)
                return;

            // Skip non-project files
            if (sd.SledProjectFile == null)
                return;

            List<SledLuaFunctionType> lstLuaFuncs;
            if (!m_dictFunctions.TryGetValue(sd.SledProjectFile, out lstLuaFuncs))
                return;

            // Figure out which function the cursor is in
            var lstPotentialFuncs = GetPotentialFunctions(lineNumber, lstLuaFuncs).ToList();

            var cursorFunc = GetClosestFromPotentialFunctions(lineNumber, lstPotentialFuncs);

            // Fire event if cursor function is different
            if (!ReferenceEquals(cursorFunc, m_lastFunc))
            {
                CursorFunctionChanged.Raise(
                    this,
                    new SledLuaFunctionCursorWatcherServiceEventArgs(
                        sd.SledProjectFile,
                        cursorFunc));
            }

            // Save last function
            m_lastFunc = cursorFunc;
        }
Esempio n. 27
0
 /// <summary>
 /// Go to a specific line in a file
 /// </summary>
 /// <param name="sd">document</param>
 /// <param name="iLine">line in document</param>
 /// <param name="bUseCsi">whether to use a "current statement indicator" or not</param>
 public void GotoLine(ISledDocument sd, int iLine, bool bUseCsi)
 {
     GotoLineWord(sd, null, iLine, -1, bUseCsi);
 }
Esempio n. 28
0
        private void Remove(ISledDocument sd)
        {
            if (!IsValidDocument(sd))
                return;

            sd.UriChanged -= SledDocumentUriChanged;

            SledFileSystemWatcher watcher;
            if (!m_dict.TryGetValue(sd, out watcher))
                return;

            watcher.EnableRaisingEvents = false;
            watcher.Changed -= WatcherChanged;
            watcher.Dispose();

            // Remove from dictionary
            m_dict.Remove(sd);
            m_dictFileStats.Remove(sd);
        }
 public SledReadOnlyDocResolutionFormEventArgs(ISledDocument sd, SledReadOnlyDocResolutionFormOptions option)
 {
     m_sd     = sd;
     m_option = option;
     Result   = false;
 }
Esempio n. 30
0
 private void Disable(ISledDocument sd)
 {
     SledFileSystemWatcher watcher;
     if (!m_dict.TryGetValue(sd, out watcher))
         return;
         
     watcher.EnableRaisingEvents = false;
 }
Esempio n. 31
0
        private void AddFile(ISledDocument sd)
        {
            var project = ActiveProject;

            bool bAlreadyInProject;
            var file =
                m_projectFilesUtilityService.Get.CreateFrom(sd, project, out bAlreadyInProject);
            
            if (bAlreadyInProject)
                return;

            // Add to project (MasterCollection_ChildInserted will handle firing the event)
            project.Files.Add(file);

            SaveSettings();
        }
Esempio n. 32
0
        private void RemoveFile(ISledDocument sd)
        {
            // Grab project file version
            var file = sd.SledProjectFile;

            // Grab parent folder
            var folder =
                file.DomNode.Parent.As<SledProjectFilesFolderType>();

            // Remove file from project (events (removing & removed) get fired
            // from MasterCollection_ChildRemoving & MasterCollection_ChildRemoved)
            folder.Files.Remove(file);

            SaveSettings();
        }
Esempio n. 33
0
 /// <summary>
 /// Go to a specific line in a file
 /// </summary>
 /// <param name="sd">document</param>
 /// <param name="iLine">line in document</param>
 /// <param name="bUseCsi">whether to use a "current statement indicator" or not</param>
 public void GotoLine(ISledDocument sd, int iLine, bool bUseCsi)
 {
     GotoLineWord(sd, null, iLine, -1, bUseCsi);
 }
Esempio n. 34
0
        private void AddBreakpoint(ISledDocument sd, IBreakpoint ibp)
        {
            // Called when click-adding a breakpoint in an open document

            AddBreakpoints(sd, new[] { ibp });
        }
Esempio n. 35
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sd">ISledDocument</param>
 public SledFileWatcherServiceEventArgs(ISledDocument sd)
 {
     Document = sd;
 }
Esempio n. 36
0
        private void RemoveBreakpoint(ISledDocument sd, IBreakpoint ibp)
        {
            // Called when click-removing a breakpoint in an open document

            var file = sd.SledProjectFile;
            if (file == null)
                return;
            
            var bp = FindBreakpointInFile(file, ibp);
            if (bp == null)
                return;

            // Remove breakpoint from file (will fire event through Collection_Removing)
            if (file.Breakpoints.Contains(bp))
                file.Breakpoints.Remove(bp);

            // Save changes
            m_projectService.SaveSettings();
        }
Esempio n. 37
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sd">ISledDocument</param>
 public SledDocumentServiceEventArgs(ISledDocument sd)
     : this(sd, null)
 {
 }
Esempio n. 38
0
        private void ShowBreakpointConditionForm(ISledDocument sd, int lineNumber)
        {
            // Show form coming from context menu in an open document
            if (sd == null)
                return;

            if (!sd.IsValidLine(lineNumber))
                return;

            if (sd.LanguagePlugin == null)
                return;

            if (sd.SledProjectFile == null)
                return;

            var ibp = sd.Editor.GetBreakpoint(lineNumber);
            if (ibp == null)
                return;

            var bp =
                FindBreakpointInFile(sd.SledProjectFile, ibp);

            if (bp == null)
                return;

            ShowBreakpointConditionFormInternal(bp);
        }
Esempio n. 39
0
 /// <summary>
 /// Constructor for Save[ing/ed] as events
 /// </summary>
 /// <param name="sd">SledDocument</param>
 /// <param name="uri">URI to old file when Save[ing/ed] as</param>
 public SledDocumentServiceEventArgs(ISledDocument sd, Uri uri)
 {
     Document = sd;
     Uri = uri;
 }
Esempio n. 40
0
        private void HandleEditAndContinue(ISledDocument sd)
        {
            var res =
                MessageBox.Show(
                    m_mainForm,
                    Localization.SledEditAndContinueReloadFileQuestion,
                    Localization.SledEditAndContinueTitle,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

            if (res == DialogResult.Yes)
            {
                // Tell target to reload the file
                m_debugService.SendScmp(
                    new EditAndContinue(
                        sd.SledProjectFile.LanguagePlugin.LanguageId,
                        sd.SledProjectFile.Path.Replace(
                            Path.DirectorySeparatorChar,
                            Path.AltDirectorySeparatorChar)));
            }
            else
            {
                // Show message to user
                MessageBox.Show(
                    m_mainForm,
                    Localization.SledEditAndContinueFileNotSentError,
                    Localization.SledEditAndContinueTitle,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }
        }
Esempio n. 41
0
 /// <summary>
 /// Try and find a SledDocument in the project
 /// </summary>
 /// <param name="sd">SledDocument to look for</param>
 /// <returns>Reference to file in the project otherwise null</returns>
 public SledProjectFilesFileType Find(ISledDocument sd)
 {
     return(Find(sd, m_projectService.ActiveProject));
 }
Esempio n. 42
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sd">Document</param>
 /// <param name="region">Region</param>
 /// <param name="lineNumber">Line number</param>
 public SledDocumentContextMenuArgs(ISledDocument sd, SledDocumentRegions region, int lineNumber)
 {
     m_sd = sd;
     m_region = region;
     m_lineNumber = lineNumber;
 }
Esempio n. 43
0
 /// <summary>
 /// Try and find a SledDocument in the specified project
 /// </summary>
 /// <param name="sd">SledDocument to look for</param>
 /// <param name="project">Project to look in</param>
 /// <returns>Reference to file in the project otherwise null</returns>
 public SledProjectFilesFileType Find(ISledDocument sd, SledProjectFilesType project)
 {
     return(sd == null ? null : Find(sd.Uri, project));
 }
Esempio n. 44
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="sd">ISledDocument</param>
 public SledFileWatcherServiceEventArgs(ISledDocument sd)
 {
     Document = sd;
 }
 private bool IsValidSledDocument(ISledDocument sd)
 {
     return
         ((sd != null) &&
         (sd.Editor != null) &&
         (sd.LanguagePlugin != null) &&
         (sd.LanguagePlugin.LanguageId == m_luaLanguagePlugin.LanguageId));
 }