]>
Commit | Line | Data |
---|---|---|
06a19cee | 1 | /** @file\r |
2 | \r | |
a19466ad | 3 | The file is used to create, update SourceFiles section of the MSA file\r |
06a19cee | 4 | \r |
5 | Copyright (c) 2006, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | package org.tianocore.frameworkwizard.module.ui.dialog;\r | |
16 | \r | |
17 | import java.awt.event.ActionEvent;\r | |
55a2762d | 18 | import java.io.File;\r |
06a19cee | 19 | import java.util.Vector;\r |
20 | \r | |
21 | import javax.swing.JButton;\r | |
22 | import javax.swing.JFileChooser;\r | |
23 | import javax.swing.JLabel;\r | |
24 | import javax.swing.JPanel;\r | |
25 | import javax.swing.JScrollPane;\r | |
26 | import javax.swing.JTextField;\r | |
27 | \r | |
28 | import org.tianocore.frameworkwizard.common.DataType;\r | |
29 | import org.tianocore.frameworkwizard.common.DataValidation;\r | |
a929458e | 30 | import org.tianocore.frameworkwizard.common.EnumerationData;\r |
06a19cee | 31 | import org.tianocore.frameworkwizard.common.Log;\r |
55a2762d | 32 | import org.tianocore.frameworkwizard.common.Tools;\r |
06a19cee | 33 | import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r |
a929458e | 34 | import org.tianocore.frameworkwizard.common.ui.IComboBox;\r |
06a19cee | 35 | import org.tianocore.frameworkwizard.common.ui.IDialog;\r |
36 | import org.tianocore.frameworkwizard.common.ui.IFrame;\r | |
37 | import org.tianocore.frameworkwizard.common.ui.StarLabel;\r | |
e08433ef | 38 | import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r |
06a19cee | 39 | import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;\r |
e08433ef | 40 | import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r |
06a19cee | 41 | \r |
42 | /**\r | |
a19466ad | 43 | * The class is used to create, update SourceFiles section of the MSA file\r |
44 | *\r | |
45 | * It extends IDialog\r | |
46 | * \r | |
06a19cee | 47 | **/\r |
48 | public class SourceFilesDlg extends IDialog {\r | |
49 | \r | |
50 | ///\r | |
51 | /// Define class Serial Version UID\r | |
52 | ///\r | |
53 | private static final long serialVersionUID = -6765742852142775378L;\r | |
54 | \r | |
55 | //\r | |
56 | // Define class members\r | |
57 | //\r | |
58 | private JPanel jContentPane = null;\r | |
59 | \r | |
60 | private JLabel jLabelFileName = null;\r | |
61 | \r | |
62 | private JTextField jTextFieldFileName = null;\r | |
63 | \r | |
64 | private JButton jButtonOpenFile = null;\r | |
65 | \r | |
66 | private JLabel jLabelToolChainFamily = null;\r | |
67 | \r | |
68 | private StarLabel jStarLabel1 = null;\r | |
69 | \r | |
70 | private JLabel jLabelArch = null;\r | |
71 | \r | |
72 | private JScrollPane jScrollPane = null;\r | |
73 | \r | |
74 | private JLabel jLabelTagName = null;\r | |
75 | \r | |
76 | private JTextField jTextFieldTagName = null;\r | |
77 | \r | |
78 | private JLabel jLabelToolCode = null;\r | |
79 | \r | |
80 | private JTextField jTextFieldToolCode = null;\r | |
81 | \r | |
a929458e | 82 | private IComboBox iComboBoxToolCode = null;\r |
83 | \r | |
06a19cee | 84 | private JTextField jTextFieldToolChainFamily = null;\r |
85 | \r | |
86 | private JLabel jLabelFeatureFlag = null;\r | |
87 | \r | |
88 | private JTextField jTextFieldFeatureFlag = null;\r | |
89 | \r | |
90 | private ArchCheckBox jArchCheckBox = null;\r | |
a929458e | 91 | \r |
55a2762d | 92 | private JButton jButtonOk = null;\r |
93 | \r | |
94 | private JButton jButtonCancel = null;\r | |
06a19cee | 95 | \r |
96 | //\r | |
97 | // Not used by UI\r | |
98 | //\r | |
2003a22e | 99 | private SourceFilesIdentification sfid[] = null;\r |
06a19cee | 100 | \r |
55a2762d | 101 | private String msaFileName = "";\r |
06a19cee | 102 | \r |
a929458e | 103 | private EnumerationData ed = new EnumerationData();\r |
e08433ef | 104 | \r |
105 | private WorkspaceTools wt = new WorkspaceTools();\r | |
a929458e | 106 | \r |
06a19cee | 107 | /**\r |
108 | This method initializes jTextFieldFileName \r | |
109 | \r | |
110 | @return javax.swing.JTextField jTextFieldFileName\r | |
111 | \r | |
112 | **/\r | |
113 | private JTextField getJTextFieldSourceFilesDirectory() {\r | |
114 | if (jTextFieldFileName == null) {\r | |
115 | jTextFieldFileName = new JTextField();\r | |
a19466ad | 116 | jTextFieldFileName.setBounds(new java.awt.Rectangle(168, 12, 250, 20));\r |
06a19cee | 117 | jTextFieldFileName.setPreferredSize(new java.awt.Dimension(250, 20));\r |
118 | jTextFieldFileName.setToolTipText("Path is relative to the MSA file and must include the file name");\r | |
119 | }\r | |
120 | return jTextFieldFileName;\r | |
121 | }\r | |
122 | \r | |
123 | /**\r | |
124 | This method initializes jButtonOpenFile \r | |
125 | \r | |
126 | @return javax.swing.JButton jButtonOpenFile\r | |
127 | \r | |
128 | **/\r | |
129 | private JButton getJButtonOpenFile() {\r | |
130 | if (jButtonOpenFile == null) {\r | |
131 | jButtonOpenFile = new JButton();\r | |
132 | jButtonOpenFile.setText("Browse");\r | |
a19466ad | 133 | jButtonOpenFile.setBounds(new java.awt.Rectangle(422, 12, 85, 20));\r |
06a19cee | 134 | jButtonOpenFile.setPreferredSize(new java.awt.Dimension(85, 20));\r |
135 | jButtonOpenFile.addActionListener(this);\r | |
136 | }\r | |
137 | return jButtonOpenFile;\r | |
138 | }\r | |
139 | \r | |
140 | /**\r | |
141 | This method initializes jScrollPane \r | |
142 | \r | |
143 | @return javax.swing.JScrollPane \r | |
144 | */\r | |
145 | private JScrollPane getJScrollPane() {\r | |
146 | if (jScrollPane == null) {\r | |
147 | jScrollPane = new JScrollPane();\r | |
148 | jScrollPane.setViewportView(getJContentPane());\r | |
149 | }\r | |
150 | return jScrollPane;\r | |
151 | }\r | |
152 | \r | |
153 | /**\r | |
154 | * This method initializes jTextFieldTagName \r | |
155 | * \r | |
156 | * @return javax.swing.JTextField \r | |
157 | */\r | |
158 | private JTextField getJTextFieldTagName() {\r | |
159 | if (jTextFieldTagName == null) {\r | |
160 | jTextFieldTagName = new JTextField();\r | |
a19466ad | 161 | jTextFieldTagName.setBounds(new java.awt.Rectangle(168, 37, 340, 20));\r |
06a19cee | 162 | jTextFieldTagName.setPreferredSize(new java.awt.Dimension(340, 20));\r |
163 | jTextFieldTagName.setToolTipText("You may specify a specific tool chain tag name, such as BILL1");\r | |
164 | }\r | |
165 | return jTextFieldTagName;\r | |
166 | }\r | |
167 | \r | |
a929458e | 168 | private IComboBox getIComboBoxToolCode() {\r |
169 | if (iComboBoxToolCode == null) {\r | |
170 | iComboBoxToolCode = new IComboBox();\r | |
a19466ad | 171 | iComboBoxToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));\r |
a929458e | 172 | iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20));\r |
2ee91a39 | 173 | iComboBoxToolCode.setToolTipText("<html>You may select a specific tool command from drop down list,<br>"\r |
b63cc1b6 | 174 | + "or you can DOUBLE-CLICK this field to enter your customized<br>"\r |
a929458e | 175 | + "tool command.<br>"\r |
176 | + "Press ENTER to save your input or press ESCAPE to quit</html>");\r | |
177 | }\r | |
178 | return iComboBoxToolCode;\r | |
179 | }\r | |
180 | \r | |
06a19cee | 181 | /**\r |
182 | * This method initializes jTextFieldToolCode \r | |
183 | * \r | |
184 | * @return javax.swing.JTextField \r | |
185 | */\r | |
186 | private JTextField getJTextFieldToolCode() {\r | |
187 | if (jTextFieldToolCode == null) {\r | |
188 | jTextFieldToolCode = new JTextField();\r | |
a19466ad | 189 | jTextFieldToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));\r |
06a19cee | 190 | jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20));\r |
191 | jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM");\r | |
a929458e | 192 | jTextFieldToolCode.setVisible(false);\r |
06a19cee | 193 | }\r |
194 | return jTextFieldToolCode;\r | |
195 | }\r | |
196 | \r | |
197 | /**\r | |
198 | * This method initializes jTextFieldToolChainFamily \r | |
199 | * \r | |
200 | * @return javax.swing.JTextField \r | |
201 | */\r | |
202 | private JTextField getJTextFieldToolChainFamily() {\r | |
203 | if (jTextFieldToolChainFamily == null) {\r | |
204 | jTextFieldToolChainFamily = new JTextField();\r | |
a19466ad | 205 | jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(168, 87, 340, 20));\r |
06a19cee | 206 | jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(340, 20));\r |
207 | jTextFieldToolChainFamily.setToolTipText("You may specify a specific tool chain family, such as GCC");\r | |
208 | }\r | |
209 | return jTextFieldToolChainFamily;\r | |
210 | }\r | |
211 | \r | |
212 | /**\r | |
213 | * This method initializes jTextFieldFeatureFlag \r | |
214 | * \r | |
215 | * @return javax.swing.JTextField \r | |
216 | */\r | |
217 | private JTextField getJTextFieldFeatureFlag() {\r | |
218 | if (jTextFieldFeatureFlag == null) {\r | |
219 | jTextFieldFeatureFlag = new JTextField();\r | |
21b42c66 | 220 | jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 137, 340, 20));\r |
06a19cee | 221 | jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(340, 20));\r |
222 | jTextFieldFeatureFlag.setToolTipText("RESERVED FOR FUTURE USE");\r | |
21b42c66 | 223 | jTextFieldFeatureFlag.setEnabled(false);\r |
06a19cee | 224 | }\r |
225 | return jTextFieldFeatureFlag;\r | |
226 | }\r | |
227 | \r | |
228 | /**\r | |
229 | This method initializes jButtonOk \r | |
230 | \r | |
231 | @return javax.swing.JButton \r | |
232 | \r | |
233 | **/\r | |
234 | private JButton getJButtonOk() {\r | |
235 | if (jButtonOk == null) {\r | |
236 | jButtonOk = new JButton();\r | |
a19466ad | 237 | jButtonOk.setBounds(new java.awt.Rectangle(317, 172, 90, 20));\r |
06a19cee | 238 | jButtonOk.setText("Ok");\r |
239 | jButtonOk.addActionListener(this);\r | |
240 | }\r | |
241 | return jButtonOk;\r | |
242 | }\r | |
243 | \r | |
244 | /**\r | |
245 | This method initializes jButtonCancel \r | |
246 | \r | |
247 | @return javax.swing.JButton \r | |
248 | \r | |
249 | **/\r | |
250 | private JButton getJButtonCancel() {\r | |
251 | if (jButtonCancel == null) {\r | |
252 | jButtonCancel = new JButton();\r | |
a19466ad | 253 | jButtonCancel.setBounds(new java.awt.Rectangle(412, 172, 90, 20));\r |
06a19cee | 254 | jButtonCancel.setText("Cancel");\r |
255 | jButtonCancel.addActionListener(this);\r | |
256 | }\r | |
257 | return jButtonCancel;\r | |
258 | }\r | |
259 | \r | |
260 | public static void main(String[] args) {\r | |
261 | \r | |
262 | }\r | |
263 | \r | |
264 | /**\r | |
265 | This is the default constructor\r | |
266 | \r | |
267 | **/\r | |
e08433ef | 268 | public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, ModuleIdentification mid) {\r |
06a19cee | 269 | super(iFrame, true);\r |
e08433ef | 270 | init(inSourceFilesIdentification, mid);\r |
06a19cee | 271 | }\r |
272 | \r | |
273 | /**\r | |
274 | This method initializes this\r | |
275 | \r | |
276 | **/\r | |
277 | private void init() {\r | |
a19466ad | 278 | this.setSize(525, 240);\r |
06a19cee | 279 | this.setContentPane(getJScrollPane());\r |
280 | this.setTitle("Source Files");\r | |
281 | this.setViewMode(false);\r | |
282 | this.centerWindow();\r | |
0c235b66 | 283 | Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode());\r |
06a19cee | 284 | }\r |
285 | \r | |
286 | /** \r | |
287 | This method initializes this\r | |
288 | Fill values to all fields if these values are not empty\r | |
289 | \r | |
290 | \r | |
291 | @param inSourceFiles The input data of SourceFilesDocument.SourceFiles\r | |
292 | \r | |
293 | **/\r | |
e08433ef | 294 | private void init(SourceFilesIdentification inSourceFilesIdentifications, ModuleIdentification mid) {\r |
06a19cee | 295 | init();\r |
e08433ef | 296 | this.msaFileName = mid.getPath();\r |
297 | \r | |
298 | //\r | |
299 | // Init arch with module's arch\r | |
300 | //\r | |
301 | this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));\r | |
06a19cee | 302 | \r |
2003a22e | 303 | if (inSourceFilesIdentifications != null) {\r |
304 | this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename());\r | |
305 | this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName());\r | |
a929458e | 306 | \r |
307 | //\r | |
308 | // Generate Tool Code selection list\r | |
309 | //\r | |
310 | Vector<String> v = ed.getVToolCode();\r | |
311 | boolean isFind = false;\r | |
312 | String strToolCode = inSourceFilesIdentifications.getToolCode();\r | |
313 | \r | |
314 | //\r | |
315 | // If the input value is not in the default list, add it to the list\r | |
316 | //\r | |
317 | if (strToolCode != null) {\r | |
318 | for (int index = 0; index < v.size(); index++) {\r | |
319 | if (v.elementAt(index).equals(strToolCode)) {\r | |
320 | isFind = true;\r | |
321 | break;\r | |
322 | }\r | |
323 | }\r | |
324 | if (!isFind && !isEmpty(strToolCode)) {\r | |
325 | v.addElement(strToolCode);\r | |
326 | }\r | |
327 | }\r | |
328 | \r | |
329 | Tools.generateComboBoxByVector(iComboBoxToolCode, v);\r | |
330 | this.iComboBoxToolCode.setSelectedItem(strToolCode);\r | |
331 | \r | |
2003a22e | 332 | this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily());\r |
333 | jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag());\r | |
334 | this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList());\r | |
06a19cee | 335 | }\r |
336 | }\r | |
337 | \r | |
338 | /**\r | |
339 | Disable all components when the mode is view\r | |
340 | \r | |
341 | @param isView true - The view mode; false - The non-view mode\r | |
342 | \r | |
343 | **/\r | |
344 | public void setViewMode(boolean isView) {\r | |
345 | if (isView) {\r | |
346 | this.jTextFieldFileName.setEnabled(!isView);\r | |
347 | this.jButtonOpenFile.setEnabled(!isView);\r | |
348 | }\r | |
349 | }\r | |
350 | \r | |
351 | /**\r | |
352 | This method initializes jContentPane\r | |
353 | \r | |
354 | @return javax.swing.JPanel jContentPane\r | |
355 | \r | |
356 | **/\r | |
357 | private JPanel getJContentPane() {\r | |
358 | if (jContentPane == null) {\r | |
359 | jArchCheckBox = new ArchCheckBox();\r | |
21b42c66 | 360 | jArchCheckBox.setBounds(new java.awt.Rectangle(168, 112, 340, 20));\r |
06a19cee | 361 | jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20));\r |
362 | jLabelFeatureFlag = new JLabel();\r | |
21b42c66 | 363 | jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 137, 155, 20));\r |
ccb063b1 | 364 | jLabelFeatureFlag.setText("Feature Flag Expression");\r |
21b42c66 | 365 | jLabelFeatureFlag.setEnabled(false);\r |
06a19cee | 366 | jLabelToolCode = new JLabel();\r |
a19466ad | 367 | jLabelToolCode.setBounds(new java.awt.Rectangle(12, 62, 155, 20));\r |
06a19cee | 368 | jLabelToolCode.setText("Tool Code");\r |
369 | jLabelTagName = new JLabel();\r | |
a19466ad | 370 | jLabelTagName.setBounds(new java.awt.Rectangle(12, 37, 155, 20));\r |
06a19cee | 371 | jLabelTagName.setText("Tag Name");\r |
372 | jLabelArch = new JLabel();\r | |
21b42c66 | 373 | jLabelArch.setBounds(new java.awt.Rectangle(12, 112, 155, 20));\r |
ccb063b1 | 374 | jLabelArch.setText("Supported Architectures");\r |
06a19cee | 375 | jLabelToolChainFamily = new JLabel();\r |
a19466ad | 376 | jLabelToolChainFamily.setBounds(new java.awt.Rectangle(12, 87, 155, 20));\r |
06a19cee | 377 | jLabelToolChainFamily.setText("Tool Chain Family");\r |
378 | jLabelFileName = new JLabel();\r | |
379 | jLabelFileName.setText("File Name");\r | |
a19466ad | 380 | jLabelFileName.setBounds(new java.awt.Rectangle(12, 12, 155, 20));\r |
06a19cee | 381 | \r |
382 | jContentPane = new JPanel();\r | |
383 | jContentPane.setLayout(null);\r | |
a19466ad | 384 | jContentPane.setPreferredSize(new java.awt.Dimension(505, 192));\r |
06a19cee | 385 | \r |
386 | jContentPane.add(jLabelFileName, null);\r | |
387 | jContentPane.add(getJTextFieldSourceFilesDirectory(), null);\r | |
388 | jContentPane.add(getJButtonOpenFile(), null);\r | |
389 | jContentPane.add(jLabelToolChainFamily, null);\r | |
390 | jStarLabel1 = new StarLabel();\r | |
391 | jStarLabel1.setLocation(new java.awt.Point(0, 10));\r | |
392 | \r | |
393 | jContentPane.add(jStarLabel1, null);\r | |
394 | jContentPane.add(jLabelArch, null);\r | |
395 | jContentPane.add(jLabelTagName, null);\r | |
396 | jContentPane.add(getJTextFieldTagName(), null);\r | |
397 | jContentPane.add(jLabelToolCode, null);\r | |
398 | jContentPane.add(getJTextFieldToolCode(), null);\r | |
a929458e | 399 | jContentPane.add(getIComboBoxToolCode(), null);\r |
06a19cee | 400 | jContentPane.add(getJTextFieldToolChainFamily(), null);\r |
401 | jContentPane.add(jLabelFeatureFlag, null);\r | |
402 | jContentPane.add(getJTextFieldFeatureFlag(), null);\r | |
403 | jContentPane.add(jArchCheckBox, null);\r | |
404 | jContentPane.add(getJButtonOk(), null);\r | |
405 | jContentPane.add(getJButtonCancel(), null);\r | |
406 | }\r | |
407 | return jContentPane;\r | |
408 | }\r | |
409 | \r | |
410 | /* (non-Javadoc)\r | |
411 | * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r | |
412 | *\r | |
413 | * Override actionPerformed to listen all actions\r | |
414 | * \r | |
415 | */\r | |
416 | public void actionPerformed(ActionEvent arg0) {\r | |
417 | if (arg0.getSource() == jButtonOpenFile) {\r | |
418 | selectFile();\r | |
419 | }\r | |
420 | \r | |
421 | if (arg0.getSource() == jButtonOk) {\r | |
422 | if (checkAdd()) {\r | |
423 | getCurrentSourceFiles();\r | |
424 | this.returnType = DataType.RETURN_TYPE_OK;\r | |
425 | this.setVisible(false);\r | |
426 | }\r | |
427 | }\r | |
428 | \r | |
429 | if (arg0.getSource() == jButtonCancel) {\r | |
430 | this.returnType = DataType.RETURN_TYPE_CANCEL;\r | |
431 | this.setVisible(false);\r | |
432 | }\r | |
433 | }\r | |
434 | \r | |
2003a22e | 435 | private SourceFilesIdentification[] getCurrentSourceFiles() {\r |
06a19cee | 436 | String name = this.jTextFieldFileName.getText();\r |
2003a22e | 437 | String s[] = name.split(";");\r |
06a19cee | 438 | String tagName = this.jTextFieldTagName.getText();\r |
a929458e | 439 | String toolCode = this.iComboBoxToolCode.getSelectedItem().toString();\r |
440 | if (toolCode.equals(DataType.EMPTY_SELECT_ITEM)) {\r | |
441 | toolCode = "";\r | |
442 | }\r | |
06a19cee | 443 | String tcf = this.jTextFieldToolChainFamily.getText();\r |
444 | String featureFlag = this.jTextFieldFeatureFlag.getText();\r | |
445 | Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();\r | |
2003a22e | 446 | sfid = new SourceFilesIdentification[s.length];\r |
447 | for (int index = 0; index < s.length; index++) {\r | |
a929458e | 448 | sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch);\r |
2003a22e | 449 | }\r |
06a19cee | 450 | return sfid;\r |
451 | }\r | |
452 | \r | |
453 | /**\r | |
454 | Data validation for all fields\r | |
455 | \r | |
456 | @retval true - All datas are valid\r | |
457 | @retval false - At least one data is invalid\r | |
458 | \r | |
459 | **/\r | |
460 | public boolean checkAdd() {\r | |
461 | //\r | |
462 | // Check Filename\r | |
463 | //\r | |
464 | if (isEmpty(this.jTextFieldFileName.getText())) {\r | |
623db5ca | 465 | Log.wrn("Update Source Files", "File Name must be entered!");\r |
06a19cee | 466 | return false;\r |
467 | }\r | |
468 | if (!DataValidation.isFilename(this.jTextFieldFileName.getText())) {\r | |
ed1665f2 | 469 | Log.wrn("Update Source Files", "Incorrect data type for File Name");\r |
06a19cee | 470 | return false;\r |
471 | }\r | |
472 | \r | |
473 | //\r | |
474 | // Check TagName \r | |
475 | //\r | |
476 | if (!isEmpty(this.jTextFieldTagName.getText())) {\r | |
477 | if (!DataValidation.isTagName(this.jTextFieldTagName.getText())) {\r | |
ed1665f2 | 478 | Log.wrn("Update Source Files", "Incorrect data type for Tag Name");\r |
06a19cee | 479 | return false;\r |
480 | }\r | |
481 | }\r | |
482 | \r | |
483 | //\r | |
484 | // Check ToolCode \r | |
485 | //\r | |
486 | if (!isEmpty(this.jTextFieldToolCode.getText())) {\r | |
487 | if (!DataValidation.isToolCode(this.jTextFieldToolCode.getText())) {\r | |
ed1665f2 | 488 | Log.wrn("Update Source Files", "Incorrect data type for Tool Code");\r |
06a19cee | 489 | return false;\r |
490 | }\r | |
491 | }\r | |
492 | \r | |
493 | //\r | |
494 | // Check ToolChainFamily \r | |
495 | //\r | |
496 | if (!isEmpty(this.jTextFieldToolChainFamily.getText())) {\r | |
497 | if (!DataValidation.isToolChainFamily(this.jTextFieldToolChainFamily.getText())) {\r | |
ed1665f2 | 498 | Log.wrn("Update Source Files", "Incorrect data type for Tool Chain Family");\r |
06a19cee | 499 | return false;\r |
500 | }\r | |
501 | }\r | |
502 | \r | |
503 | //\r | |
504 | // Check FeatureFlag\r | |
505 | //\r | |
506 | if (!isEmpty(this.jTextFieldFeatureFlag.getText())) {\r | |
507 | if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) {\r | |
ed1665f2 | 508 | Log.wrn("Update Source Files", "Incorrect data type for Feature Flag");\r |
06a19cee | 509 | return false;\r |
510 | }\r | |
511 | }\r | |
512 | \r | |
513 | return true;\r | |
514 | }\r | |
515 | \r | |
516 | /**\r | |
517 | Display a file open browser to let user select file\r | |
518 | \r | |
519 | **/\r | |
520 | private void selectFile() {\r | |
55a2762d | 521 | JFileChooser fc = new JFileChooser();\r |
522 | fc.setCurrentDirectory(new File(Tools.getFilePathOnly(msaFileName)));\r | |
2003a22e | 523 | fc.setMultiSelectionEnabled(true);\r |
06a19cee | 524 | int result = fc.showOpenDialog(new JPanel());\r |
525 | if (result == JFileChooser.APPROVE_OPTION) {\r | |
2003a22e | 526 | File f[] = fc.getSelectedFiles();\r |
527 | String s = "";\r | |
528 | for (int index = 0; index < f.length; index++) {\r | |
0915a2ce | 529 | String relativePath = "";\r |
530 | relativePath = Tools.getRelativePath(Tools.getFilePathOnly(f[index].getPath()), Tools.getFilePathOnly(msaFileName));\r | |
531 | if (!Tools.isEmpty(relativePath)) {\r | |
532 | relativePath = relativePath + DataType.UNIX_FILE_SEPARATOR;\r | |
533 | }\r | |
534 | s = s + relativePath + f[index].getName() + ";";\r | |
2003a22e | 535 | }\r |
536 | this.jTextFieldFileName.setText(s);\r | |
06a19cee | 537 | }\r |
538 | }\r | |
539 | \r | |
2003a22e | 540 | public SourceFilesIdentification[] getSfid() {\r |
06a19cee | 541 | return sfid;\r |
542 | }\r | |
543 | \r | |
2003a22e | 544 | public void setSfid(SourceFilesIdentification[] sfid) {\r |
06a19cee | 545 | this.sfid = sfid;\r |
546 | }\r | |
547 | }\r |