コード例 #1
0
ファイル: LineOffsetConverter.cs プロジェクト: maresja1/SDenc
 /// <summary>
 /// Builds converter from <c>DomRegion</c> and <c>IDocument</c>.
 /// </summary>
 /// <param name="region">DomRegion</param>
 /// <param name="doc">Document</param>
 /// <returns>Convertor</returns>
 public static LineOffsetConverter BuildConverter(DomRegion region, IDocument doc)
 {
     LineOffsetConverter lineCon = new LineOffsetConverter();
     lineCon.startLine = region.BeginLine;
     int stOffset = doc.PositionToOffset(region.BeginLine,0);
     for(int i = region.BeginLine;i <= region.EndLine; i++){
         lineCon.lineOffsets.Add(doc.PositionToOffset(i,0) - stOffset);
     }
     return lineCon;
 }
コード例 #2
0
        /// <summary>
        /// Builds converter from <c>DomRegion</c> and <c>IDocument</c>.
        /// </summary>
        /// <param name="region">DomRegion</param>
        /// <param name="doc">Document</param>
        /// <returns>Convertor</returns>
        public static LineOffsetConverter BuildConverter(DomRegion region, IDocument doc)
        {
            LineOffsetConverter lineCon = new LineOffsetConverter();

            lineCon.startLine = region.BeginLine;
            int stOffset = doc.PositionToOffset(region.BeginLine, 0);

            for (int i = region.BeginLine; i <= region.EndLine; i++)
            {
                lineCon.lineOffsets.Add(doc.PositionToOffset(i, 0) - stOffset);
            }
            return(lineCon);
        }
コード例 #3
0
ファイル: EditorEventCreator.cs プロジェクト: maresja1/SDenc
        /// <summary>
        /// Event callback for change in documents text.
        /// </summary>
        /// <param name="src">Document, that is being changed.</param>
        /// <param name="arg">Additional info about changes in text.</param>
        private void changingEvent(object src, TextChangeEventArgs arg)
        {
            IDocument doc = (IDocument)src;

            ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;

            changingFilename = provider.TextEditor.FileName;

            if (DebuggerService.IsDebuggerStarted)
            {
                if (arg.InsertedText.Length > 0 || arg.RemovedText.Length > 0)
                {
                    if (!actualEvent.touched.Exists(changingFilename.Equals))
                    {
                        actualEvent.touched.Add(changingFilename);
                    }
                    changeMade = true;
                    uint       token;
                    BodyChange change = findBodyChanges(arg, doc);
                    if (change != null && lastProjectContent.Exist(change.NewEntity))
                    {
                        if (!actualEvent.changes.Exists(delegate(SourceChange sChange) { return(bodyChangeEquals(sChange, change.NewEntity)); }))
                        {
                            actualEvent.changes.Add(change);
                        }
                    }
                    else
                    {
                        return;
                    }
                    if (getMethodToken(change, out token))
                    {
                        BodyChangeHistory hist;
                        if (!actualEvent.sourceTextChanges.TryGetValue(token, out hist))
                        {
                            hist = new BodyChangeHistory(LineOffsetConverter.BuildConverter(change.NewEntity.BodyRegion, doc));
                            actualEvent.sourceTextChanges.Add(token, hist);
                        }
                        int bOffset = doc.PositionToOffset(change.NewEntity.BodyRegion.BeginLine, 0);

                        SourceTextChange sTchange;
                        sTchange.Offset = arg.Offset - bOffset;

                        if (arg.InsertionLength > 0)
                        {
                            sTchange.Length    = arg.InsertionLength;
                            sTchange.Removed   = false;
                            sTchange.Semicolon = semicolonFind(arg.InsertedText);
                            hist.TextChanges.Add(sTchange);
                        }
                        if (arg.RemovalLength > 0)
                        {
                            sTchange.Length    = arg.RemovalLength;
                            sTchange.Removed   = true;
                            sTchange.Semicolon = semicolonFind(arg.RemovedText);
                            hist.TextChanges.Add(sTchange);
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: BodyChangeHistory.cs プロジェクト: maresja1/SDenc
 public BodyChangeHistory(LineOffsetConverter conv)
 {
     TextChanges = new List <SourceTextChange>();
     Converter   = conv;
 }
コード例 #5
0
ファイル: BodyChangeHistory.cs プロジェクト: maresja1/SDenc
 public BodyChangeHistory(LineOffsetConverter conv)
 {
     TextChanges = new List<SourceTextChange>();
     Converter = conv;
 }