internal CodeDocumentViewModelBase(IEditorDoc doc)
            : base(doc)
        {
            DiagnosticHighlighter = new DiagnosticHighlighter(new Highlighting.Highlighter(TextDocument));
            SearchHighlighter = new SearchHighlighter(Document.File.Path, new Highlighting.Highlighter(TextDocument));
            _indexHighlighter = new IndexHighlighter(new Highlighting.Highlighter(TextDocument));

            if(HasIndex)
            {
                JadeCore.Services.Provider.CppParser.TranslationUnitIndexed += OnCppParserTranslationUnitIndexed;

                //DiagnosticHighlighter.ProjectItem = Document.Project.Index.FindProjectItem(Document.File.Path);
               
                _inspectSymbolCommand = new Commands.InspectSymbolCommand(this, doc.File.Path, doc.Project.Index);
                _inspectCursorCommand = new Commands.InspectCursorCommand(this, doc.File.Path, doc.Project.Index);
                _jumpToCommand = new Commands.SourceFileJumpToCommand(this, doc.File.Path, doc.Project.Index);
                _findAllRefsCommand = new Commands.FindAllReferences(this, doc.File.Path, doc.Project.Index);

                _fileMap = Document.Project.Index.FileSymbolMaps.GetMap(Document.File.Path);
                if (_fileMap != null)
                {
                    _indexHighlighter.SetMap(_fileMap);
                }
            }

        }
Example #2
0
 public HeaderDocumentViewModel(IEditorDoc doc) 
     : base(doc)
 {
     Debug.Assert(doc is JadeCore.Editor.SourceDocument);
     if (HasIndex)
     {
     }
 }
Example #3
0
 private void OnControllerActiveDocumentChanged(IEditorDoc newValue, IEditorDoc oldValue)
 {
     DocumentViewModel vm = FindViewModel(newValue);
     if (vm == null && newValue != null)
     {
         vm = _docViewModelFactory.Create(newValue);
         _documents.Add(vm);
     }
     SelectedDocument = vm;
 }
Example #4
0
 public DocumentViewModel Create(IEditorDoc doc)
 {            
     if (IsSourceFile(doc))
     {
         return new SourceDocumentViewModel(doc);
     }
     else if(IsHeaderFile(doc))
     {
         return new HeaderDocumentViewModel(doc);
     }
     return null;
 }
Example #5
0
 public EditorDocChangeEventArgs(IEditorDoc doc)
 {
     Document = doc;
 }
Example #6
0
 protected DocumentViewModel(IEditorDoc doc)
 {
     Title = doc.Name;
     ContentId = doc.File.ToString();
     IconSource = ISC.ConvertFromInvariantString("pack://application:,,,/Images/File.png") as ImageSource;
     _model = doc;
     _model.TextDocument.ModifiedChanged += OnTextDocumentModifiedChanged;
     _caretLocation = new CaretLocation(_model.TextDocument);
     CaretOffset = 0;
     _wantInitialFocus = true;
     _initialLine = 0;
 }
Example #7
0
 public DocChangeTracker(IEditorDoc document, CppCodeBrowser.IProjectIndex index)
 {
     _doc = document;
     _index = index;
     _doc.TextDocument.Changed += TextDocument_Changed;
 }
Example #8
0
 private void RaiseDocEvent(EditorDocChangeEvent ev, IEditorDoc doc)
 {
     EditorDocChangeEvent handler = ev;
     if (handler != null)
         handler(new EditorDocChangeEventArgs(doc));
 }
Example #9
0
 private void OnDocumentSelect(IEditorDoc newValue, IEditorDoc oldValue)
 {
     ActiveDocumentChangeEvent handler = ActiveDocumentChanged;
     if(handler != null)
     {
         handler(newValue, oldValue);
     }
 }
Example #10
0
 private void OnDocumentOpened(IEditorDoc doc)
 {
     RaiseDocEvent(DocumentOpened, doc);
 }
Example #11
0
 private void CloseDocument(IEditorDoc doc)
 {
     lock (_lockObject)
     {
         _openDocuments.Remove(doc.File.Path);
         if (ActiveDocument != null && ActiveDocument.Equals(doc))
             ActiveDocument = null;
     }
     OnDocumentClosed(doc);
 }
Example #12
0
 static private bool IsSourceFile(IEditorDoc doc)
 {
     string ext = doc.File.Path.Extention.ToLower();
     return ext == ".c" || ext == ".cc" || ext == ".cpp";
 }
Example #13
0
 static private bool IsHeaderFile(IEditorDoc doc)
 {
     return doc.File.Path.Extention.ToLower() == ".h" || doc.File.Path.Extention.Length == 0;
 }