static public JadeCore.Workspace.IWorkspace Read(FilePath path, IFileService fileService) { WorkspaceType xml; XmlSerializer serializer = new XmlSerializer(typeof(WorkspaceType)); TextReader tr = new StreamReader(path.Str); try { xml = (WorkspaceType)serializer.Deserialize(tr); } finally { tr.Close(); tr.Dispose(); } JadeCore.Workspace.IWorkspace result = new JadeCore.Workspace.Workspace(xml.Name, path); foreach (FolderType f in xml.Folders) { result.AddFolder(MakeFolder(result, result.Directory, f, fileService)); } foreach (ProjectType p in xml.Projects) { result.AddProject(MakeProject(result.Directory, p, fileService)); } return result; }
static private JadeCore.Project.IProject Read(string name, StreamReader reader, FilePath projectPath, IFileService fileService) { IProject project = new JadeCore.Project.Project(name, projectPath); while (!reader.EndOfStream) { string line = reader.ReadLine(); Match match = Regex.Match(line, _compileLineRegex); if (match.Success) { string itemPath = match.Groups[1].Value; itemPath = JadeUtils.IO.PathUtils.CombinePaths(projectPath.Directory, itemPath); project.AddItem(null, new JadeCore.Project.FileItem(fileService.MakeFileHandle(itemPath))); continue; } match = Regex.Match(line, _includeLineRegex); if (match.Success) { string itemPath = match.Groups[1].Value; itemPath = JadeUtils.IO.PathUtils.CombinePaths(projectPath.Directory, itemPath); project.AddItem(null, new JadeCore.Project.FileItem(fileService.MakeFileHandle(itemPath))); continue; } } return project; }
public NewWorkspace(string name, FilePath path) { Name = name; Path = path; _projects = new Collections.Observable.List<Project.IProject>(); _groups = new Collections.Observable.List<string>(); }
public Workspace(string name, FilePath path) { _name = name; _path = path; _rootFolder = new Folder(_name, this); _allProjects = new Collections.Observable.List<Project.IProject>(); }
public UInt64 GetFileVersion(FilePath path) { ParseFile pf = null; if (_files.TryGetValue(path, out pf)) return pf.Version; return 0; }
private UInt64 _docVersion; //this is the version number at the time of job creation, when the job executes the version number may be greater public ParseJob(FilePath path, UInt64 version, string[] compilerArgs, CppCodeBrowser.IProjectIndex index) { _path = path; _docVersion = version; _compilerArgs = compilerArgs; _index = index; }
public FindAllReferences(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index) : base(vm) { ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged; _path = path; _index = index; }
public InspectCursorCommand(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index) : base(vm) { ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged; _path = path; _index = index; RaiseCanExecuteChangedEvent(); }
public TranslationUnit FindTranslationUnit(FilePath path) { lock (_lock) { if (_parseResults.ContainsKey(path)) return _parseResults[path].TranslationUnit; } return null; }
public Project(string name, FilePath path) { _path = path; _name = name; _items = new Dictionary<string, IItem>(); _folders = new List<IFolder>(); _allSourceFiles = new Collections.Observable.List<IFileItem>(); _index = new CppCodeBrowser.ProjectIndex(); }
private IFileMap GetFileMap(FilePath path) { IFileMap result = null; if(_fileMappings.TryGetValue(path, out result) == false) { result = new FileMap(path); _fileMappings.Add(path, result); } return result; }
public IFileItem FindFileItem(FilePath path) { foreach (IItem item in _items) { if(item is IFileItem && (item as IFileItem).Path == path) { return item as IFileItem; } } return null; }
public IFileHandle MakeFileHandle(FilePath path) { IFileHandle file = _handles.Get(path); if (file == null) { file = new FileHandle(this, path); _handles.Add(file); OnFileCreated(file); } return file; }
public ParseResult(IProjectIndex index, FilePath path, IEnumerable<ParseFile> files, LibClang.TranslationUnit tu) { _index = index; _path = path; _translationUnit = tu; _files = new Dictionary<FilePath, ParseFile>(); foreach(ParseFile pf in files) { _files.Add(pf.Path, pf); } }
//private CppCodeBrowser.IProjectFile _indexItem; public SourceFileJumpToCommand(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index) : base(vm) { ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged; _path = path; _index = index; _jumpToBrowser = new CppCodeBrowser.JumpToBrowser(_index); // _indexItem = _index.FindProjectItem(_path); RaiseCanExecuteChangedEvent(); }
public SearchHighlighter(FilePath path, Highlighting.Highlighter highlighter) { _highlighter = highlighter; _path = path; _searchController = JadeCore.Services.Provider.SearchController; ((INotifyCollectionChanged)_searchController.Searches).CollectionChanged += Searchs_CollectionChanged; _ranges = new HashSet<Highlighting.IHighlightedRange>(); if(_searchController.Current != null) { OnNewSearch(_searchController.Current); } }
public static JadeCore.Project.IProject Read(string name, FilePath path, IFileService fileService) { FilePath filterFilePath = FilePath.Make(path.Str + ".filters"); if(filterFilePath.Exists) { ProjectFiltersFileReader reader = new ProjectFiltersFileReader(name, filterFilePath, path, fileService); return reader.ReadFiltersFile(); } else { using (StreamReader reader = CreateFileReader(path)) { return Read(name, reader, path, fileService); } } }
public static ParseResult Parse(IProjectIndex index, FilePath path, string[] compilerArgs, IUnsavedFileProvider unsavedFiles) { TranslationUnit tu = new TranslationUnit(index.LibClangIndex, path.Str); //Take a snapshot of the source IEnumerable<ParseFile> files = unsavedFiles.UnsavedFiles; List<Tuple<string, string>> unsavedList = new List<Tuple<string, string>>(); foreach (var i in files) { unsavedList.Add(new Tuple<string, string>(i.Path.Str, i.Content)); } if (tu.Parse(compilerArgs, unsavedList) == false) { tu.Dispose(); return null; } return new ParseResult(index, path, files, tu); ; }
private IFileItem FindFileItem(JadeCore.Project.IFolder folder, FilePath path) { foreach(IItem item in folder.Items) { if(item is FileItem) { if ((item as FileItem).Path == path) return item as FileItem; } } foreach(IFolder child in folder.Folders) { IFileItem result = FindFileItem(child, path); if (result != null) return result; } return null; }
public IFileItem FindFileItem(FilePath path) { return FindFileItem(this, path); }
public bool Remove(FilePath path) { return _handles.Remove(path); }
public HeaderFile(FilePath path) { Path = path; _sourceFiles = new HashSet<ISourceFile>(); }
public bool ContainsFile(FilePath path) { return FindProjectForFile(path) != null; }
public FileHandle(IFileService service, FilePath path) { _service = service; _path = path; _observers = new List<IFileObserver>(); }
public JadeCore.Project.IProject FindProjectForFile(FilePath path) { return _rootFolder.FindProjectForFile(path); }
public IFileHandle Get(FilePath path) { IFileHandle handle; return _handles.TryGetValue(path, out handle) ? handle : null; }
public void OpenWorkspace(FilePath path) { if (CloseWorkspace() == false) { return; } try { if(path.Exists == false) { return; } string extention = path.Extention.ToLower(); if (extention == ".sln") { _workspace = JadeCore.Persistence.Workspace.VisualStudioImport.Reader.Read(path, JadeCore.Services.Provider.FileService); } else if (extention == ".jws") { _workspace = JadeCore.Persistence.Workspace.Reader.Read(path, JadeCore.Services.Provider.FileService); } _recentFiles.Add(path.Str); OnWorkspaceChanged(WorkspaceChangeOperation.Opened); } catch(Exception) { _workspace = null; throw; } }
public JadeCore.Project.IProject FindProjectForFile(FilePath path) { JadeCore.Project.IProject result = null; foreach (IItem item in Items) { if (item is Project.IProject) { if((item as Project.IProject).FindFileItem(path) != null) return item as Project.IProject; } } foreach(IFolder folder in Folders) { result = folder.FindProjectForFile(path); if (result != null) return result; } return result; }
public ResultProvider(FilePath sourceFile, CppCodeBrowser.IProjectIndex index, CppCodeBrowser.IUnsavedFileProvider unsavedFiles) { _index = index; _sourceFile = sourceFile; _unsavedFiles = unsavedFiles; }
public bool Contains(FilePath path) { return _handles.ContainsKey(path); }