.. | .. |
---|
14 | 14 | //DragSourceListener, |
---|
15 | 15 | DropTargetListener |
---|
16 | 16 | { |
---|
17 | | - cTree jTree = new cTree(null); |
---|
| 17 | + cTree jTree = new cTree(); |
---|
18 | 18 | iCallBack owner; |
---|
19 | 19 | |
---|
20 | 20 | JButton refreshButton; |
---|
| 21 | + JButton rootButton; |
---|
21 | 22 | JButton loadButton; |
---|
22 | 23 | JButton printButton; |
---|
23 | 24 | JButton replaceButton; |
---|
.. | .. |
---|
32 | 33 | { |
---|
33 | 34 | owner = o; |
---|
34 | 35 | |
---|
35 | | - setName("File system"); |
---|
| 36 | + setName("Files"); |
---|
36 | 37 | //System.out.println("layout : " + getLayout()); |
---|
37 | 38 | //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
---|
38 | 39 | //setLayout(new GridBagLayout()); |
---|
39 | 40 | //ToolTipManager.sharedInstance().registerComponent(jTree); |
---|
40 | 41 | jTree.setCellRenderer(new cFileSystemModel.Renderer()); |
---|
41 | 42 | |
---|
42 | | - ResetModel(); |
---|
| 43 | + ResetModel(true); |
---|
43 | 44 | |
---|
44 | 45 | JScrollPane tree = new JScrollPane(jTree); |
---|
45 | 46 | //jTree.addTreeSelectionListener(this); |
---|
.. | .. |
---|
60 | 61 | GridBagConstraints aConstraints = new GridBagConstraints(0,0,1,1, 1.0,1.0, |
---|
61 | 62 | GridBagConstraints.EAST,GridBagConstraints.HORIZONTAL,new Insets(1,1,1,1), 0,0); |
---|
62 | 63 | |
---|
63 | | - cGridBag fileCommsnds = new cGridBag(); |
---|
| 64 | + cGridBag fileCommands = new cGridBag(); |
---|
64 | 65 | |
---|
65 | | - fileCommsnds.add(loadButton = new JButton("Load")); //, aConstraints); |
---|
| 66 | + fileCommands.add(loadButton = new JButton("Load")); //, aConstraints); |
---|
66 | 67 | loadButton.setToolTipText("Load selected file(s)"); |
---|
67 | | - fileCommsnds.add(refreshButton = new JButton("Refresh")); //, aConstraints); |
---|
68 | | - refreshButton.setToolTipText("Refresh entire tree"); |
---|
69 | | - |
---|
70 | | - refreshButton.addActionListener(this); |
---|
71 | | - loadButton.addActionListener(this); |
---|
| 68 | + loadButton.addActionListener(this); |
---|
| 69 | + fileCommands.add(refreshButton = new JButton("User")); //, aConstraints); |
---|
| 70 | + refreshButton.setToolTipText("Refresh user tree"); |
---|
| 71 | + refreshButton.addActionListener(this); |
---|
| 72 | + fileCommands.add(rootButton = new JButton("Root")); //, aConstraints); |
---|
| 73 | + rootButton.setToolTipText("Refresh root tree"); |
---|
| 74 | + rootButton.addActionListener(this); |
---|
72 | 75 | |
---|
73 | 76 | if (Globals.ADVANCED) |
---|
74 | 77 | { |
---|
75 | | - fileCommsnds.add(printButton = new JButton("Print")); //, aConstraints); |
---|
| 78 | + fileCommands.add(printButton = new JButton("Print")); //, aConstraints); |
---|
76 | 79 | printButton.setToolTipText("Print file path in terminal"); |
---|
77 | 80 | printButton.addActionListener(this); |
---|
78 | | - fileCommsnds.add(mergeAttributesCB = new cCheckBox("Merge", cJME.mergeAttributes)); //, aConstraints); |
---|
| 81 | + fileCommands.add(mergeAttributesCB = new cCheckBox("Merge", cJME.mergeAttributes)); //, aConstraints); |
---|
79 | 82 | mergeAttributesCB.setToolTipText("Merge common attributes (recommended)"); |
---|
80 | 83 | mergeAttributesCB.addItemListener(this); |
---|
81 | 84 | // replaceButton.addActionListener(this); |
---|
.. | .. |
---|
95 | 98 | // add(genUVCB = new cCheckBox("UV", cJME.genUV), aConstraints); |
---|
96 | 99 | // genUVCB.addItemListener(this); |
---|
97 | 100 | |
---|
98 | | - add(fileCommsnds); |
---|
99 | | - fileCommsnds.preferredHeight = 1; |
---|
| 101 | + add(fileCommands); |
---|
| 102 | + fileCommands.preferredHeight = 1; |
---|
100 | 103 | |
---|
101 | 104 | Return(); |
---|
102 | 105 | |
---|
.. | .. |
---|
114 | 117 | // /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this); |
---|
115 | 118 | } |
---|
116 | 119 | |
---|
117 | | - void ResetModel() |
---|
| 120 | + void ResetModel(boolean user) |
---|
118 | 121 | { |
---|
119 | 122 | cFilter filter = new cFilter(); |
---|
120 | 123 | |
---|
.. | .. |
---|
134 | 137 | filter.add("tga"); |
---|
135 | 138 | filter.add("bmp"); // not supported |
---|
136 | 139 | |
---|
| 140 | + File root = java.io.File.listRoots()[0]; |
---|
| 141 | + File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(); |
---|
| 142 | + |
---|
137 | 143 | jTree.setModel(new cFileSystemModel( |
---|
138 | | - //java.io.File.listRoots()[1]) |
---|
139 | | - javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory(), |
---|
| 144 | + user?defaultDirectory:root, |
---|
140 | 145 | filter |
---|
141 | 146 | )); |
---|
142 | 147 | } |
---|
.. | .. |
---|
167 | 172 | { |
---|
168 | 173 | if(event.getSource() == refreshButton) |
---|
169 | 174 | { |
---|
170 | | - ResetModel(); |
---|
| 175 | + ResetModel(true); |
---|
| 176 | + return; |
---|
| 177 | + } |
---|
| 178 | + |
---|
| 179 | + if(event.getSource() == rootButton) |
---|
| 180 | + { |
---|
| 181 | + ResetModel(false); |
---|
171 | 182 | return; |
---|
172 | 183 | } |
---|
173 | 184 | |
---|