annotate src/share/tools/ProjectCreator/FileTreeCreator.java @ 11981:530fe88b3b2c hs25-b44

Merge
author amurillo
date Fri, 02 Aug 2013 02:54:47 -0700
parents 1a9b9cfcef41
children bd0e82136b03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6801
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
1 import java.nio.file.FileSystems;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
2 import java.nio.file.Path;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
3 import java.nio.file.SimpleFileVisitor;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
4 import java.util.HashSet;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
5 import java.util.Stack;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
6 import java.util.Vector;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
7
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
8 public class FileTreeCreator extends SimpleFileVisitor<Path>
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
9 {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
10 Path vcProjLocation;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
11 Path startDir;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
12 final int startDirLength;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
13 Stack<DirAttributes> attributes = new Stack<DirAttributes>();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
14 Vector<BuildConfig> allConfigs;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
15 WinGammaPlatformVC10 wg;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
16
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
17 public FileTreeCreator(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatformVC10 wg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
18 super();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
19 this.wg = wg;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
20 this.allConfigs = allConfigs;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
21 this.startDir = startDir;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
22 startDirLength = startDir.toAbsolutePath().toString().length();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
23 vcProjLocation = FileSystems.getDefault().getPath(allConfigs.firstElement().get("BuildSpace"));
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
24 attributes.push(new DirAttributes());
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
25 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
26
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
27 public class DirAttributes {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
28
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
29 private HashSet<BuildConfig> ignores;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
30 private HashSet<BuildConfig> disablePch;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
31
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
32 public DirAttributes() {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
33 ignores = new HashSet<BuildConfig>();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
34 disablePch = new HashSet<BuildConfig>();
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
35 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
36
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
37 public DirAttributes(HashSet<BuildConfig> excludes2, HashSet<BuildConfig> disablePch2) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
38 ignores = excludes2;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
39 disablePch = disablePch2;
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
40 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
41
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
42 @SuppressWarnings("unchecked")
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
43 public DirAttributes clone() {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
44 return new DirAttributes((HashSet<BuildConfig>)this.ignores.clone(), (HashSet<BuildConfig>)this.disablePch.clone());
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
45 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
46
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
47 public void setIgnore(BuildConfig conf) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
48 ignores.add(conf);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
49 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
50
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
51 public boolean hasIgnore(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
52 return ignores.contains(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
53 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
54
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
55 public void removeFromIgnored(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
56 ignores.remove(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
57 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
58
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
59 public void setDisablePch(BuildConfig conf) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
60 disablePch.add(conf);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
61 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
62
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
63 public boolean hasDisablePch(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
64 return disablePch.contains(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
65 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
66
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
67 public void removeFromDisablePch(BuildConfig cfg) {
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
68 disablePch.remove(cfg);
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
69 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
70
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
71 }
1a9b9cfcef41 7163863: Updated projectcreator
neliasso
parents:
diff changeset
72 }