Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
 public NewWorkspace(string name, FilePath path)
 {
     Name = name;
     Path = path;
     _projects = new Collections.Observable.List<Project.IProject>();
     _groups = new Collections.Observable.List<string>();
 }
Exemplo n.º 4
0
 public Workspace(string name, FilePath path)
 {
     _name = name;
     _path = path;
     _rootFolder = new Folder(_name, this);
     _allProjects = new Collections.Observable.List<Project.IProject>();
 }
Exemplo n.º 5
0
 public UInt64 GetFileVersion(FilePath path)
 {
     ParseFile pf = null;
     if (_files.TryGetValue(path, out pf))
         return pf.Version;
     return 0;
 }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
0
 public FindAllReferences(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index)
     : base(vm)
 {
     ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged;
     _path = path;
     _index = index;            
 }
Exemplo n.º 8
0
 public InspectCursorCommand(DocumentViewModel vm, FilePath path, CppCodeBrowser.IProjectIndex index)
     : base(vm)
 {
     ViewModel.CaretOffsetChanged += ViewModelCaretOffsetChanged;
     _path = path;
     _index = index;
     RaiseCanExecuteChangedEvent();
 }
Exemplo n.º 9
0
 public TranslationUnit FindTranslationUnit(FilePath path)
 {
     lock (_lock)
     {
         if (_parseResults.ContainsKey(path))
             return _parseResults[path].TranslationUnit;
     }
     return null;
 }
Exemplo n.º 10
0
 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();
 }
Exemplo n.º 11
0
Arquivo: IMap.cs Projeto: JadeHub/Jade
 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;
 }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 13
0
 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;
 }
Exemplo n.º 14
0
 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);
     }
 }
Exemplo n.º 15
0
        //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();
        }
Exemplo n.º 16
0
        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);
            }
        }
Exemplo n.º 17
0
        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);
                }
            }
        }
Exemplo n.º 18
0
        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); ;
        }
Exemplo n.º 19
0
        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;
        }
Exemplo n.º 20
0
 public IFileItem FindFileItem(FilePath path)
 {
     return FindFileItem(this, path);
 }
Exemplo n.º 21
0
 public bool Remove(FilePath path)
 {
     return _handles.Remove(path);
 }
Exemplo n.º 22
0
 public HeaderFile(FilePath path)
 {
     Path = path;
     _sourceFiles = new HashSet<ISourceFile>();
 }
Exemplo n.º 23
0
 public bool ContainsFile(FilePath path)
 {
     return FindProjectForFile(path) != null;
 }
Exemplo n.º 24
0
 public FileHandle(IFileService service, FilePath path)
 {
     _service = service;
     _path = path;
     _observers = new List<IFileObserver>();
 }
Exemplo n.º 25
0
 public JadeCore.Project.IProject FindProjectForFile(FilePath path)
 {
     return _rootFolder.FindProjectForFile(path);
 }
Exemplo n.º 26
0
 public IFileHandle Get(FilePath path)
 {
     IFileHandle handle;
     return _handles.TryGetValue(path, out handle) ? handle : null;
 }
Exemplo n.º 27
0
        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;
            }
        }
Exemplo n.º 28
0
        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;
        }
Exemplo n.º 29
0
 public ResultProvider(FilePath sourceFile, CppCodeBrowser.IProjectIndex index, CppCodeBrowser.IUnsavedFileProvider unsavedFiles)
 {
     _index = index;
     _sourceFile = sourceFile;
     _unsavedFiles = unsavedFiles;
 }
Exemplo n.º 30
0
 public bool Contains(FilePath path)
 {
     return _handles.ContainsKey(path);
 }