3 The file is used to create, update SourceFile of MSA/MBD file
5 Copyright (c) 2006, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 package org
.tianocore
.frameworkwizard
.module
.ui
;
17 import java
.awt
.event
.ActionEvent
;
18 import java
.awt
.event
.ComponentEvent
;
19 import java
.awt
.event
.ItemEvent
;
20 import java
.util
.Vector
;
22 import javax
.swing
.JButton
;
23 import javax
.swing
.JCheckBox
;
24 import javax
.swing
.JComboBox
;
25 import javax
.swing
.JFileChooser
;
26 import javax
.swing
.JLabel
;
27 import javax
.swing
.JPanel
;
28 import javax
.swing
.JScrollPane
;
29 import javax
.swing
.JTextArea
;
30 import javax
.swing
.JTextField
;
32 import org
.tianocore
.SourceFilesDocument
;
33 import org
.tianocore
.FilenameDocument
.Filename
;
34 import org
.tianocore
.ModuleSurfaceAreaDocument
.ModuleSurfaceArea
;
35 import org
.tianocore
.SourceFilesDocument
.SourceFiles
;
36 import org
.tianocore
.frameworkwizard
.common
.DataType
;
37 import org
.tianocore
.frameworkwizard
.common
.DataValidation
;
38 import org
.tianocore
.frameworkwizard
.common
.EnumerationData
;
39 import org
.tianocore
.frameworkwizard
.common
.Log
;
40 import org
.tianocore
.frameworkwizard
.common
.Tools
;
41 import org
.tianocore
.frameworkwizard
.common
.Identifications
.OpeningModuleType
;
42 import org
.tianocore
.frameworkwizard
.common
.ui
.IInternalFrame
;
43 import org
.tianocore
.frameworkwizard
.common
.ui
.StarLabel
;
44 import org
.tianocore
.frameworkwizard
.common
.ui
.iCheckBoxList
.ICheckBoxList
;
45 import org
.tianocore
.frameworkwizard
.module
.Identifications
.SourceFiles
.SourceFilesIdentification
;
46 import org
.tianocore
.frameworkwizard
.module
.Identifications
.SourceFiles
.SourceFilesVector
;
47 import org
.tianocore
.frameworkwizard
.workspace
.Workspace
;
50 The class is used to create, update SourceFile of MSA/MBD file
51 It extends IInternalFrame
56 public class ModuleSourceFiles
extends IInternalFrame
{
59 /// Define class Serial Version UID
61 private static final long serialVersionUID
= -6765742852142775378L;
64 // Define class members
66 private SourceFilesDocument
.SourceFiles sourceFiles
= null;
68 private int intSelectedItemId
= 0;
70 private JPanel jContentPane
= null;
72 private JLabel jLabelFileName
= null;
74 private JTextField jTextFieldFileName
= null;
76 private JButton jButtonOpenFile
= null;
78 private JLabel jLabelToolChainFamily
= null;
80 private StarLabel jStarLabel1
= null;
82 private JComboBox jComboBoxList
= null;
84 private JButton jButtonAdd
= null;
86 private JButton jButtonRemove
= null;
88 private JButton jButtonUpdate
= null;
90 private JCheckBox jCheckBoxArch
= null;
92 private JScrollPane jScrollPaneList
= null;
94 private JTextArea jTextAreaList
= null;
96 private JLabel jLabelArch
= null;
98 private JScrollPane jScrollPane
= null;
100 private JLabel jLabelTagName
= null;
102 private JTextField jTextFieldTagName
= null;
104 private JLabel jLabelToolCode
= null;
106 private JTextField jTextFieldToolCode
= null;
108 private JTextField jTextFieldToolChainFamily
= null;
110 private JLabel jLabelFeatureFlag
= null;
112 private JTextField jTextFieldFeatureFlag
= null;
114 private ICheckBoxList iCheckBoxListArch
= null;
116 private JScrollPane jScrollPaneArch
= null;
121 private OpeningModuleType omt
= null;
123 private ModuleSurfaceArea msa
= null;
125 private SourceFilesIdentification sfid
= null;
127 private SourceFilesVector vSourceFiles
= new SourceFilesVector();
130 This method initializes jTextFieldFileName
132 @return javax.swing.JTextField jTextFieldFileName
135 private JTextField
getJTextFieldSourceFilesDirectory() {
136 if (jTextFieldFileName
== null) {
137 jTextFieldFileName
= new JTextField();
138 jTextFieldFileName
.setBounds(new java
.awt
.Rectangle(140, 10, 250, 20));
139 jTextFieldFileName
.setPreferredSize(new java
.awt
.Dimension(250, 20));
140 jTextFieldFileName
.setToolTipText("Path is relative to the MSA file and must include the file name");
142 return jTextFieldFileName
;
146 This method initializes jButtonOpenFile
148 @return javax.swing.JButton jButtonOpenFile
151 private JButton
getJButtonOpenFile() {
152 if (jButtonOpenFile
== null) {
153 jButtonOpenFile
= new JButton();
154 jButtonOpenFile
.setText("Browse");
155 jButtonOpenFile
.setBounds(new java
.awt
.Rectangle(395, 10, 85, 20));
156 jButtonOpenFile
.setPreferredSize(new java
.awt
.Dimension(85, 20));
157 jButtonOpenFile
.addActionListener(this);
159 return jButtonOpenFile
;
163 This method initializes jComboBoxFileList
165 @return javax.swing.JComboBox jComboBoxFileList
168 private JComboBox
getJComboBoxList() {
169 if (jComboBoxList
== null) {
170 jComboBoxList
= new JComboBox();
171 jComboBoxList
.setBounds(new java
.awt
.Rectangle(15, 220, 210, 20));
172 jComboBoxList
.addItemListener(this);
173 jComboBoxList
.addActionListener(this);
174 jComboBoxList
.setPreferredSize(new java
.awt
.Dimension(210, 20));
176 return jComboBoxList
;
180 This method initializes jButtonAdd
182 @return javax.swing.JButton jButtonAdd
185 private JButton
getJButtonAdd() {
186 if (jButtonAdd
== null) {
187 jButtonAdd
= new JButton();
188 jButtonAdd
.setBounds(new java
.awt
.Rectangle(230, 220, 80, 20));
189 jButtonAdd
.setText("Add");
190 jButtonAdd
.addActionListener(this);
191 jButtonAdd
.setPreferredSize(new java
.awt
.Dimension(80, 20));
197 This method initializes jButtonRemove
199 @return javax.swing.JButton jButtonRemove
202 private JButton
getJButtonRemove() {
203 if (jButtonRemove
== null) {
204 jButtonRemove
= new JButton();
205 jButtonRemove
.setBounds(new java
.awt
.Rectangle(400, 220, 80, 20));
206 jButtonRemove
.setText("Remove");
207 jButtonRemove
.addActionListener(this);
208 jButtonRemove
.setPreferredSize(new java
.awt
.Dimension(80, 20));
210 return jButtonRemove
;
214 This method initializes jButtonUpdate
216 @return javax.swing.JButton jButtonUpdate
219 private JButton
getJButtonUpdate() {
220 if (jButtonUpdate
== null) {
221 jButtonUpdate
= new JButton();
222 jButtonUpdate
.setBounds(new java
.awt
.Rectangle(315, 220, 80, 20));
223 jButtonUpdate
.setPreferredSize(new java
.awt
.Dimension(80, 20));
224 jButtonUpdate
.setText("Update");
225 jButtonUpdate
.addActionListener(this);
227 return jButtonUpdate
;
231 * This method initializes jScrollPaneFileList
233 * @return javax.swing.JScrollPane
235 private JScrollPane
getJScrollPaneList() {
236 if (jScrollPaneList
== null) {
237 jScrollPaneList
= new JScrollPane();
238 jScrollPaneList
.setBounds(new java
.awt
.Rectangle(15, 245, 465, 240));
239 jScrollPaneList
.setViewportView(getJTextAreaList());
240 jScrollPaneList
.setPreferredSize(new java
.awt
.Dimension(465, 240));
242 return jScrollPaneList
;
246 * This method initializes jTextAreaFileList
248 * @return javax.swing.JTextArea
250 private JTextArea
getJTextAreaList() {
251 if (jTextAreaList
== null) {
252 jTextAreaList
= new JTextArea();
253 jTextAreaList
.setEditable(false);
256 return jTextAreaList
;
260 This method initializes jScrollPane
262 @return javax.swing.JScrollPane
264 private JScrollPane
getJScrollPane() {
265 if (jScrollPane
== null) {
266 jScrollPane
= new JScrollPane();
267 jScrollPane
.setViewportView(getJContentPane());
273 * This method initializes jTextFieldTagName
275 * @return javax.swing.JTextField
277 private JTextField
getJTextFieldTagName() {
278 if (jTextFieldTagName
== null) {
279 jTextFieldTagName
= new JTextField();
280 jTextFieldTagName
.setBounds(new java
.awt
.Rectangle(140, 35, 340, 20));
281 jTextFieldTagName
.setPreferredSize(new java
.awt
.Dimension(340, 20));
282 jTextFieldTagName
.setToolTipText("You may specify a specific tool chain tag name, such as BILL1");
284 return jTextFieldTagName
;
288 * This method initializes jTextFieldToolCode
290 * @return javax.swing.JTextField
292 private JTextField
getJTextFieldToolCode() {
293 if (jTextFieldToolCode
== null) {
294 jTextFieldToolCode
= new JTextField();
295 jTextFieldToolCode
.setBounds(new java
.awt
.Rectangle(140, 60, 340, 20));
296 jTextFieldToolCode
.setPreferredSize(new java
.awt
.Dimension(340, 20));
297 jTextFieldToolCode
.setToolTipText("You may specify a specific tool command, such as ASM");
299 return jTextFieldToolCode
;
303 * This method initializes jTextFieldToolChainFamily
305 * @return javax.swing.JTextField
307 private JTextField
getJTextFieldToolChainFamily() {
308 if (jTextFieldToolChainFamily
== null) {
309 jTextFieldToolChainFamily
= new JTextField();
310 jTextFieldToolChainFamily
.setBounds(new java
.awt
.Rectangle(140, 85, 340, 20));
311 jTextFieldToolChainFamily
.setPreferredSize(new java
.awt
.Dimension(340, 20));
312 jTextFieldToolChainFamily
.setToolTipText("You may specify a specific tool chain family, such as GCC");
314 return jTextFieldToolChainFamily
;
318 * This method initializes jTextFieldFeatureFlag
320 * @return javax.swing.JTextField
322 private JTextField
getJTextFieldFeatureFlag() {
323 if (jTextFieldFeatureFlag
== null) {
324 jTextFieldFeatureFlag
= new JTextField();
325 jTextFieldFeatureFlag
.setBounds(new java
.awt
.Rectangle(140, 110, 340, 20));
326 jTextFieldFeatureFlag
.setPreferredSize(new java
.awt
.Dimension(340, 20));
327 jTextFieldFeatureFlag
.setToolTipText("RESERVED FOR FUTURE USE");
329 return jTextFieldFeatureFlag
;
333 This method initializes iCheckBoxListArch
335 @return ICheckBoxList
337 private ICheckBoxList
getICheckBoxListSupportedArchitectures() {
338 if (iCheckBoxListArch
== null) {
339 iCheckBoxListArch
= new ICheckBoxList();
340 iCheckBoxListArch
.addFocusListener(this);
341 iCheckBoxListArch
.setToolTipText(DataType
.SUP_ARCH_LIST_HELP_TEXT
);
343 return iCheckBoxListArch
;
347 This method initializes jScrollPaneArch
349 @return javax.swing.JScrollPane
352 private JScrollPane
getJScrollPaneArch() {
353 if (jScrollPaneArch
== null) {
354 jScrollPaneArch
= new JScrollPane();
355 jScrollPaneArch
.setBounds(new java
.awt
.Rectangle(140, 135, 340, 80));
356 jScrollPaneArch
.setPreferredSize(new java
.awt
.Dimension(340, 80));
357 jScrollPaneArch
.setViewportView(getICheckBoxListSupportedArchitectures());
359 return jScrollPaneArch
;
362 public static void main(String
[] args
) {
367 This is the default constructor
370 public ModuleSourceFiles() {
373 this.setVisible(true);
377 This is the override edit constructor
382 public ModuleSourceFiles(OpeningModuleType inOmt
) {
385 this.msa
= inOmt
.getXmlMsa();
386 init(msa
.getSourceFiles());
387 this.setVisible(true);
391 This method initializes this
392 Fill values to all fields if these values are not empty
395 @param inSourceFiles The input data of SourceFilesDocument.SourceFiles
398 private void init(SourceFilesDocument
.SourceFiles inSourceFiles
) {
400 this.sourceFiles
= inSourceFiles
;
402 if (this.sourceFiles
!= null) {
403 if (this.sourceFiles
.getFilenameList().size() > 0) {
404 for (int index
= 0; index
< this.sourceFiles
.getFilenameList().size(); index
++) {
405 String name
= sourceFiles
.getFilenameList().get(index
).getStringValue();
406 String tagName
= sourceFiles
.getFilenameList().get(index
).getTagName();
407 String toolCode
= sourceFiles
.getFilenameList().get(index
).getToolCode();
408 String tcf
= sourceFiles
.getFilenameList().get(index
).getToolChainFamily();
409 String featureFlag
= sourceFiles
.getFilenameList().get(index
).getFeatureFlag();
410 Vector
<String
> arch
= Tools
.convertListToVector(sourceFiles
.getFilenameList().get(index
)
412 SourceFilesIdentification sfid
= new SourceFilesIdentification(name
, tagName
, toolCode
, tcf
,
414 vSourceFiles
.addSourceFiles(sfid
);
421 Tools
.generateComboBoxByVector(jComboBoxList
, vSourceFiles
.getSourceFilesName());
426 This method initializes this
429 private void init() {
430 this.setSize(500, 515);
431 this.setContentPane(getJScrollPane());
432 this.setTitle("Source Files");
434 this.setViewMode(false);
438 Disable all components when the mode is view
440 @param isView true - The view mode; false - The non-view mode
443 public void setViewMode(boolean isView
) {
445 this.jTextFieldFileName
.setEnabled(!isView
);
446 this.jButtonOpenFile
.setEnabled(!isView
);
448 this.jButtonAdd
.setEnabled(!isView
);
449 this.jButtonRemove
.setEnabled(!isView
);
450 this.jButtonUpdate
.setEnabled(!isView
);
451 this.jCheckBoxArch
.setEnabled(!isView
);
456 This method initializes jContentPane
458 @return javax.swing.JPanel jContentPane
461 private JPanel
getJContentPane() {
462 if (jContentPane
== null) {
463 jLabelFeatureFlag
= new JLabel();
464 jLabelFeatureFlag
.setBounds(new java
.awt
.Rectangle(15, 110, 120, 20));
465 jLabelFeatureFlag
.setText("Feature Flag");
466 jLabelToolCode
= new JLabel();
467 jLabelToolCode
.setBounds(new java
.awt
.Rectangle(15, 60, 120, 20));
468 jLabelToolCode
.setText("Tool Code");
469 jLabelTagName
= new JLabel();
470 jLabelTagName
.setBounds(new java
.awt
.Rectangle(15, 35, 120, 20));
471 jLabelTagName
.setText("Tag Name");
472 jLabelArch
= new JLabel();
473 jLabelArch
.setBounds(new java
.awt
.Rectangle(15, 135, 120, 20));
474 jLabelArch
.setText("Sup Arch List");
475 jLabelToolChainFamily
= new JLabel();
476 jLabelToolChainFamily
.setBounds(new java
.awt
.Rectangle(15, 85, 120, 20));
477 jLabelToolChainFamily
.setText("Tool Chain Family");
478 jLabelFileName
= new JLabel();
479 jLabelFileName
.setText("File Name");
480 jLabelFileName
.setBounds(new java
.awt
.Rectangle(15, 10, 120, 20));
482 jContentPane
= new JPanel();
483 jContentPane
.setLayout(null);
484 jContentPane
.setPreferredSize(new java
.awt
.Dimension(490, 490));
486 jContentPane
.add(jLabelFileName
, null);
487 jContentPane
.add(getJTextFieldSourceFilesDirectory(), null);
488 jContentPane
.add(getJButtonOpenFile(), null);
489 jContentPane
.add(jLabelToolChainFamily
, null);
490 jStarLabel1
= new StarLabel();
491 jStarLabel1
.setLocation(new java
.awt
.Point(0, 10));
493 jContentPane
.add(jStarLabel1
, null);
494 jContentPane
.add(getJComboBoxList(), null);
495 jContentPane
.add(getJButtonAdd(), null);
496 jContentPane
.add(getJButtonRemove(), null);
497 jContentPane
.add(getJButtonUpdate(), null);
498 jContentPane
.add(getJScrollPaneList(), null);
499 jContentPane
.add(jLabelArch
, null);
500 jContentPane
.add(jLabelTagName
, null);
501 jContentPane
.add(getJTextFieldTagName(), null);
502 jContentPane
.add(jLabelToolCode
, null);
503 jContentPane
.add(getJTextFieldToolCode(), null);
504 jContentPane
.add(getJTextFieldToolChainFamily(), null);
505 jContentPane
.add(jLabelFeatureFlag
, null);
506 jContentPane
.add(getJTextFieldFeatureFlag(), null);
507 jContentPane
.add(getJScrollPaneArch(), null);
513 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
515 * Override actionPerformed to listen all actions
518 public void actionPerformed(ActionEvent arg0
) {
519 if (arg0
.getSource() == jButtonOpenFile
) {
522 if (arg0
.getSource() == jButtonAdd
) {
528 if (arg0
.getSource() == jButtonRemove
) {
531 if (arg0
.getSource() == jButtonUpdate
) {
540 This method initializes Usage type and Arch type
543 private void initFrame() {
544 EnumerationData ed
= new EnumerationData();
546 this.iCheckBoxListArch
.setAllItems(ed
.getVSupportedArchitectures());
549 private SourceFilesIdentification
getCurrentSourceFiles() {
550 String name
= this.jTextFieldFileName
.getText();
551 String tagName
= this.jTextFieldTagName
.getText();
552 String toolCode
= this.jTextFieldToolCode
.getText();
553 String tcf
= this.jTextFieldToolChainFamily
.getText();
554 String featureFlag
= this.jTextFieldFeatureFlag
.getText();
555 Vector
<String
> arch
= this.iCheckBoxListArch
.getAllCheckedItemsString();
556 sfid
= new SourceFilesIdentification(name
, tagName
, toolCode
, tcf
, featureFlag
, arch
);
561 Add current item to Vector
564 private void addToList() {
565 intSelectedItemId
= vSourceFiles
.size();
567 vSourceFiles
.addSourceFiles(getCurrentSourceFiles());
569 jComboBoxList
.addItem(sfid
.getFilename());
570 jComboBoxList
.setSelectedItem(sfid
.getFilename());
573 // Reset select item index
575 intSelectedItemId
= vSourceFiles
.size();
578 // Reload all fields of selected item
589 Remove current item from Vector
592 private void removeFromList() {
594 // Check if exist items
596 if (this.vSourceFiles
.size() < 1) {
600 int intTempIndex
= intSelectedItemId
;
602 jComboBoxList
.removeItemAt(intSelectedItemId
);
604 vSourceFiles
.removeSourceFiles(intTempIndex
);
607 // Reload all fields of selected item
618 Update current item of Vector
621 private void updateForList() {
623 // Check if exist items
625 if (this.vSourceFiles
.size() < 1) {
630 // Backup selected item index
632 int intTempIndex
= intSelectedItemId
;
634 vSourceFiles
.updateSourceFiles(getCurrentSourceFiles(), intTempIndex
);
636 jComboBoxList
.removeAllItems();
637 for (int index
= 0; index
< vSourceFiles
.size(); index
++) {
638 jComboBoxList
.addItem(vSourceFiles
.getSourceFiles(index
).getFilename());
642 // Restore selected item index
644 intSelectedItemId
= intTempIndex
;
647 // Reset select item index
649 jComboBoxList
.setSelectedIndex(intSelectedItemId
);
652 // Reload all fields of selected item
663 Refresh all fields' values of selected item of Vector
666 private void reloadFromList() {
667 if (vSourceFiles
.size() > 0) {
669 // Get selected item index
671 intSelectedItemId
= jComboBoxList
.getSelectedIndex();
673 this.jTextFieldFileName
.setText(vSourceFiles
.getSourceFiles(intSelectedItemId
).getFilename());
674 this.jTextFieldTagName
.setText(vSourceFiles
.getSourceFiles(intSelectedItemId
).getTagName());
675 this.jTextFieldToolCode
.setText(vSourceFiles
.getSourceFiles(intSelectedItemId
).getToolCode());
676 this.jTextFieldToolChainFamily
.setText(vSourceFiles
.getSourceFiles(intSelectedItemId
).getToolChainFamily());
677 jTextFieldFeatureFlag
.setText(vSourceFiles
.getSourceFiles(intSelectedItemId
).getFeatureFlag());
678 iCheckBoxListArch
.setAllItemsUnchecked();
679 iCheckBoxListArch
.initCheckedItem(true, vSourceFiles
.getSourceFiles(intSelectedItemId
).getSupArchList());
688 Update list area pane via the elements of Vector
691 private void reloadListArea() {
692 String strListItem
= "";
693 for (int index
= 0; index
< vSourceFiles
.size(); index
++) {
694 strListItem
= strListItem
+ vSourceFiles
.getSourceFiles(index
).getFilename() + DataType
.UNIX_LINE_SEPARATOR
;
696 this.jTextAreaList
.setText(strListItem
);
700 * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
702 * Reflesh the frame when selected item changed
705 public void itemStateChanged(ItemEvent arg0
) {
706 if (arg0
.getStateChange() == ItemEvent
.SELECTED
) {
712 Data validation for all fields
714 @retval true - All datas are valid
715 @retval false - At least one data is invalid
718 public boolean checkAdd() {
722 if (isEmpty(this.jTextFieldFileName
.getText())) {
723 Log
.err("File Name couldn't be empty");
726 if (!DataValidation
.isFilename(this.jTextFieldFileName
.getText())) {
727 Log
.err("Incorrect data type for File Name");
734 if (!isEmpty(this.jTextFieldTagName
.getText())) {
735 if (!DataValidation
.isTagName(this.jTextFieldTagName
.getText())) {
736 Log
.err("Incorrect data type for Tag Name");
744 if (!isEmpty(this.jTextFieldToolCode
.getText())) {
745 if (!DataValidation
.isToolCode(this.jTextFieldToolCode
.getText())) {
746 Log
.err("Incorrect data type for Tool Code");
752 // Check ToolChainFamily
754 if (!isEmpty(this.jTextFieldToolChainFamily
.getText())) {
755 if (!DataValidation
.isToolChainFamily(this.jTextFieldToolChainFamily
.getText())) {
756 Log
.err("Incorrect data type for Tool Chain Family");
764 if (!isEmpty(this.jTextFieldFeatureFlag
.getText())) {
765 if (!DataValidation
.isFeatureFlag(this.jTextFieldFeatureFlag
.getText())) {
766 Log
.err("Incorrect data type for Feature Flag");
775 Save all components of SourceFiles
776 if exists sourceFiles, set the value directly
777 if not exists sourceFiles, new an instance first
785 int count
= this.vSourceFiles
.size();
787 this.sourceFiles
= SourceFiles
.Factory
.newInstance();
789 for (int index
= 0; index
< count
; index
++) {
790 Filename mFilename
= Filename
.Factory
.newInstance();
791 if (!isEmpty(vSourceFiles
.getSourceFiles(index
).getFilename())) {
792 mFilename
.setStringValue(vSourceFiles
.getSourceFiles(index
).getFilename());
794 if (!isEmpty(vSourceFiles
.getSourceFiles(index
).getTagName())) {
795 mFilename
.setTagName(vSourceFiles
.getSourceFiles(index
).getTagName());
797 if (!isEmpty(vSourceFiles
.getSourceFiles(index
).getToolCode())) {
798 mFilename
.setToolCode(vSourceFiles
.getSourceFiles(index
).getToolCode());
800 if (!isEmpty(vSourceFiles
.getSourceFiles(index
).getToolChainFamily())) {
801 mFilename
.setToolChainFamily(vSourceFiles
.getSourceFiles(index
).getToolChainFamily());
803 if (!isEmpty(vSourceFiles
.getSourceFiles(index
).getFeatureFlag())) {
804 mFilename
.setFeatureFlag(vSourceFiles
.getSourceFiles(index
).getFeatureFlag());
806 if (vSourceFiles
.getSourceFiles(index
).getSupArchList() != null
807 && vSourceFiles
.getSourceFiles(index
).getSupArchList().size() > 0) {
808 mFilename
.setSupArchList(vSourceFiles
.getSourceFiles(index
).getSupArchList());
811 this.sourceFiles
.addNewFilename();
812 this.sourceFiles
.setFilenameArray(index
, mFilename
);
815 this.msa
.setSourceFiles(sourceFiles
);
816 this.omt
.setSaved(false);
817 } catch (Exception e
) {
819 Log
.err("Update Source Files", e
.getMessage());
824 Display a file open browser to let user select file
827 private void selectFile() {
828 JFileChooser fc
= new JFileChooser(Workspace
.getCurrentWorkspace());
830 int result
= fc
.showOpenDialog(new JPanel());
831 if (result
== JFileChooser
.APPROVE_OPTION
) {
832 this.jTextFieldFileName
.setText(fc
.getSelectedFile().getName());
837 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
839 * Override componentResized to resize all components when frame's size is changed
841 public void componentResized(ComponentEvent arg0
) {
842 int intCurrentWidth
= this.getJContentPane().getWidth();
843 int intCurrentHeight
= this.getJContentPane().getHeight();
844 int intPreferredWidth
= this.getJContentPane().getPreferredSize().width
;
845 int intPreferredHeight
= this.getJContentPane().getPreferredSize().height
;
847 resizeComponentWidth(this.jTextFieldFileName
, intCurrentWidth
, intPreferredWidth
);
848 resizeComponentWidth(this.jTextFieldTagName
, intCurrentWidth
, intPreferredWidth
);
849 resizeComponentWidth(this.jTextFieldToolCode
, intCurrentWidth
, intPreferredWidth
);
850 resizeComponentWidth(this.jTextFieldToolChainFamily
, intCurrentWidth
, intPreferredWidth
);
851 resizeComponentWidth(this.jTextFieldFeatureFlag
, intCurrentWidth
, intPreferredWidth
);
852 resizeComponentWidth(this.jScrollPaneArch
, intCurrentWidth
, intPreferredWidth
);
854 resizeComponentWidth(this.jComboBoxList
, intCurrentWidth
, intPreferredWidth
);
855 resizeComponent(this.jScrollPaneList
, intCurrentWidth
, intCurrentHeight
, intPreferredWidth
, intPreferredHeight
);
856 relocateComponentX(this.jButtonAdd
, intCurrentWidth
, intPreferredWidth
, DataType
.SPACE_TO_RIGHT_FOR_ADD_BUTTON
);
857 relocateComponentX(this.jButtonOpenFile
, intCurrentWidth
, intPreferredWidth
,
858 DataType
.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON
);
859 relocateComponentX(this.jButtonRemove
, intCurrentWidth
, intPreferredWidth
,
860 DataType
.SPACE_TO_RIGHT_FOR_REMOVE_BUTTON
);
861 relocateComponentX(this.jButtonUpdate
, intCurrentWidth
, intPreferredWidth
,
862 DataType
.SPACE_TO_RIGHT_FOR_UPDATE_BUTTON
);