Exemplo n.º 1
0
		void DocumentChanged(object source, TextChangeEventArgs e)
		{
			documentHasChangedSinceLastFoldUpdate = true;
		}
Exemplo n.º 2
0
		public void FireDocumentChangedEvent(TextChangeEventArgs e)
		{
			if (DocumentChanged != null) {
				DocumentChanged(this, e);
			}
		}
Exemplo n.º 3
0
        /// <summary>
        /// Find first change in project structure. Determines which method is changed etc. .
        /// </summary>
        /// <param name="change">Additional info about change in source code text.</param>
        /// <param name="doc">Document, that was changed.</param>
        /// <returns>Instance of BodyChange, containing info about change in structure.</returns>
        private BodyChange findBodyChanges(TextChangeEventArgs change, IDocument doc)
        {
            IDocumentLine line = doc.GetLineForOffset(change.Offset);

            int row = line.LineNumber;
            int column = change.Offset - line.Offset;

            bool found = false;
            BodyChange entity = null;

            foreach(IClass classEl in ParserService.CurrentProjectContent.Classes)
            {
                if (classEl is CompoundClass)
                {
                    CompoundClass compClass  = classEl as CompoundClass;
                    foreach (IClass compPart in compClass.Parts)
                    {
                        if (compPart.BodyRegion.IsInside(row, column) && FileUtility.IsEqualFileName(classEl.CompilationUnit.FileName, changingFilename))
                        {
                            entity = findBodyChangesClass(compPart, row, column);
                            if(entity != null){
                                found = true;
                                break;
                            }
                        }
                    }
                    if(found)
                        break;
                }
                if (classEl.BodyRegion.IsInside(row, column) && FileUtility.IsEqualFileName(classEl.CompilationUnit.FileName,changingFilename))
                {
                    entity = findBodyChangesClass(classEl, row, column);
                    if(entity != null){
                        found = true;
                        break;
                    }
                }
            }
            return entity;
        }
Exemplo n.º 4
0
        /// <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);
                        }
                    }
                }
            }
        }
 void DocumentChanged(object sender, TextChangeEventArgs e)
 {
     //if (IsOutsideMethodCall()) {
         insightWindow.Close();
     //}
 }
Exemplo n.º 6
0
		public void RaiseChangedEvent()
		{
			TextChangeEventArgs e = new TextChangeEventArgs(0, "", "a");
			if (Changed != null) {
				Changed(this, e);
			}
		}