// get the FolderComposite object representing the the project's folder 'targetFolder'. Build the needed FolderComposite(s) for a complete path
        private CsharpFolderComposite GetOrBuildFolderComposite(IDictionary <string, CsharpFolderComposite> cache, string targetFolder, string projectUnderTestDir, ProjectComponent <SyntaxTree> inputFiles)
        {
            if (cache.ContainsKey(targetFolder))
            {
                return(cache[targetFolder]);
            }

            var folder = targetFolder;
            CsharpFolderComposite subDir = null;

            while (!string.IsNullOrEmpty(folder))
            {
                if (!cache.ContainsKey(folder))
                {
                    // we have not scanned this folder yet
                    var fullPath     = FileSystem.Path.Combine(projectUnderTestDir, folder);
                    var newComposite = new CsharpFolderComposite
                    {
                        FullPath     = fullPath,
                        RelativePath = Path.GetRelativePath(projectUnderTestDir, fullPath),
                    };
                    if (subDir != null)
                    {
                        newComposite.Add(subDir);
                    }

                    cache.Add(folder, newComposite);
                    subDir = newComposite;
                    folder = Path.GetDirectoryName(folder);
                    if (string.IsNullOrEmpty(folder))
                    {
                        // we are at root
                        var root = inputFiles as IReadOnlyFolderComposite;
                        root.Add(subDir);
                    }
                }
                else
                {
                    cache[folder].Add(subDir);
                    break;
                }
            }

            return(cache[targetFolder]);
        }
예제 #2
0
 /// <summary>
 /// The panel refreshes everytime it was reloaded, to call the method CheckBeforeClick.
 /// </summary>
 public void RefreshDisplay()
 {
     localProject = orchestrator.GetComponent <Orchestrator.Orchestrator>().GetLocalProject();
     CheckBeforeClick();
 }
예제 #3
0
 /// <summary>
 /// Sets the tree to null
 /// </summary>
 public void DeleteTree()
 {
     project = null;
 }
예제 #4
0
 /// <summary>
 /// Sets the root of the project tree e.g. if a tree is read from disk
 /// </summary>
 /// <param name="tree">Root of the project tree</param>
 public void SetTree(ProjectComponent tree)
 {
     project = tree;
 }
예제 #5
0
 public void RemoveProjectComponent(ProjectComponent model)
 {
     Context.ProjectComponents.Remove(model);
 }
예제 #6
0
 public ProjectController(ProjectComponent component)
 {
     this.component = component;
 }
예제 #7
0
 public ProjectController()
 {
     component = new ProjectComponent(new DataContext());
 }