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); } } }
public HeaderDocumentViewModel(IEditorDoc doc) : base(doc) { Debug.Assert(doc is JadeCore.Editor.SourceDocument); if (HasIndex) { } }
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; }
public DocumentViewModel Create(IEditorDoc doc) { if (IsSourceFile(doc)) { return new SourceDocumentViewModel(doc); } else if(IsHeaderFile(doc)) { return new HeaderDocumentViewModel(doc); } return null; }
public EditorDocChangeEventArgs(IEditorDoc doc) { Document = doc; }
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; }
public DocChangeTracker(IEditorDoc document, CppCodeBrowser.IProjectIndex index) { _doc = document; _index = index; _doc.TextDocument.Changed += TextDocument_Changed; }
private void RaiseDocEvent(EditorDocChangeEvent ev, IEditorDoc doc) { EditorDocChangeEvent handler = ev; if (handler != null) handler(new EditorDocChangeEventArgs(doc)); }
private void OnDocumentSelect(IEditorDoc newValue, IEditorDoc oldValue) { ActiveDocumentChangeEvent handler = ActiveDocumentChanged; if(handler != null) { handler(newValue, oldValue); } }
private void OnDocumentOpened(IEditorDoc doc) { RaiseDocEvent(DocumentOpened, doc); }
private void CloseDocument(IEditorDoc doc) { lock (_lockObject) { _openDocuments.Remove(doc.File.Path); if (ActiveDocument != null && ActiveDocument.Equals(doc)) ActiveDocument = null; } OnDocumentClosed(doc); }
static private bool IsSourceFile(IEditorDoc doc) { string ext = doc.File.Path.Extention.ToLower(); return ext == ".c" || ext == ".cc" || ext == ".cpp"; }
static private bool IsHeaderFile(IEditorDoc doc) { return doc.File.Path.Extention.ToLower() == ".h" || doc.File.Path.Extention.Length == 0; }