Adding a dialog for setting the Build Preferences in the target.txt file.
authorlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Aug 2006 00:43:38 +0000 (00:43 +0000)
committerlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 22 Aug 2006 00:43:38 +0000 (00:43 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1342 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java [new file with mode: 0644]

index d97c61a..ec82681 100644 (file)
@@ -99,6 +99,7 @@ import org.tianocore.frameworkwizard.platform.ui.FpdPlatformDefs;
 import org.tianocore.frameworkwizard.workspace.Workspace;\r
 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
 import org.tianocore.frameworkwizard.workspace.ui.SwitchWorkspace;\r
+import org.tianocore.frameworkwizard.toolchain.Preferences;\r
 \r
 /**\r
  The class is used to show main GUI of FrameworkWizard\r
@@ -238,11 +239,11 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
 \r
     private JMenuItem jMenuItemProjectChangeWorkspace = null;\r
 \r
-    private JMenu jMenuProjectBuildTargets = null;\r
+    private JMenuItem jMenuItemToolsBuildPreferences = null;\r
 \r
-    private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null;\r
+//    private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null;\r
 \r
-    private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null;\r
+//    private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null;\r
 \r
     private JMenuItem jMenuItemToolsToolChainConfiguration = null;\r
 \r
@@ -746,11 +747,13 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             //\r
             // Add sub menu items\r
             //\r
-            jMenuTools.add(getJMenuItemToolsToolChainConfiguration());\r
-            jMenuTools.addSeparator();\r
 \r
             jMenuTools.add(getJMenuItemToolsClone());\r
             jMenuTools.add(getJMenuItemToolsCodeScan());\r
+            jMenuTools.addSeparator();\r
+            \r
+            jMenuTools.add(getJMenuItemToolsToolChainConfiguration());\r
+            jMenuTools.add(getJMenuItemToolsBuildPreferences());\r
         }\r
         return jMenuTools;\r
     }\r
@@ -1268,7 +1271,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
             jMenuProject.add(getJMenuItemProjectUpdateFar());\r
             jMenuProject.add(getJMenuItemProjectRemoveFar());\r
 \r
-            jMenuProject.add(getJMenuProjectBuildTargets());\r
         }\r
         return jMenuProject;\r
     }\r
@@ -1309,52 +1311,20 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
     }\r
 \r
     /**\r
-     This method initializes jMenuProjectBuildTargets  \r
+     This method initializes jMenuProjectBuildPreferences      \r
      \r
      @return javax.swing.JMenu \r
      \r
      **/\r
-    private JMenu getJMenuProjectBuildTargets() {\r
-        if (jMenuProjectBuildTargets == null) {\r
-            jMenuProjectBuildTargets = new JMenu();\r
-            jMenuProjectBuildTargets.setText("Build Targets");\r
-            jMenuProjectBuildTargets.setMnemonic('T');\r
-            jMenuProjectBuildTargets.setVisible(false);\r
-\r
-            jMenuProjectBuildTargets.add(getJCheckBoxMenuItemProjectBuildTargetsDebug());\r
-            jMenuProjectBuildTargets.add(getJCheckBoxMenuItemProjectBuildTargetsRelease());\r
+    private JMenuItem getJMenuItemToolsBuildPreferences() {\r
+        if (jMenuItemToolsBuildPreferences == null) {\r
+            jMenuItemToolsBuildPreferences = new JMenuItem();\r
+            jMenuItemToolsBuildPreferences.setText("Build Preferences");\r
+            jMenuItemToolsBuildPreferences.setMnemonic('P');\r
+            jMenuItemToolsBuildPreferences.setEnabled(true);\r
+            jMenuItemToolsBuildPreferences.addActionListener(this);\r
         }\r
-        return jMenuProjectBuildTargets;\r
-    }\r
-\r
-    /**\r
-     This method initializes jCheckBoxMenuItemProjectBuildTargetsDebug \r
-     \r
-     @return javax.swing.JCheckBoxMenuItem     \r
-     \r
-     **/\r
-    private JCheckBoxMenuItem getJCheckBoxMenuItemProjectBuildTargetsDebug() {\r
-        if (jCheckBoxMenuItemProjectBuildTargetsDebug == null) {\r
-            jCheckBoxMenuItemProjectBuildTargetsDebug = new JCheckBoxMenuItem();\r
-            jCheckBoxMenuItemProjectBuildTargetsDebug.setText("Debug");\r
-            jCheckBoxMenuItemProjectBuildTargetsDebug.setEnabled(false);\r
-        }\r
-        return jCheckBoxMenuItemProjectBuildTargetsDebug;\r
-    }\r
-\r
-    /**\r
-     This method initializes jCheckBoxMenuItemProjectBuildTargetsRelease       \r
-     \r
-     @return javax.swing.JCheckBoxMenuItem     \r
-     \r
-     **/\r
-    private JCheckBoxMenuItem getJCheckBoxMenuItemProjectBuildTargetsRelease() {\r
-        if (jCheckBoxMenuItemProjectBuildTargetsRelease == null) {\r
-            jCheckBoxMenuItemProjectBuildTargetsRelease = new JCheckBoxMenuItem();\r
-            jCheckBoxMenuItemProjectBuildTargetsRelease.setText("Release");\r
-            jCheckBoxMenuItemProjectBuildTargetsRelease.setEnabled(false);\r
-        }\r
-        return jCheckBoxMenuItemProjectBuildTargetsRelease;\r
+        return jMenuItemToolsBuildPreferences;\r
     }\r
 \r
     /**\r
@@ -1880,6 +1850,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
         if (arg0.getSource() == this.jMenuItemEditFindPpi) {\r
 //            this.findPpi();\r
         }\r
+        \r
+        if (arg0.getSource() == jMenuItemToolsBuildPreferences) {\r
+            configBuildPreferences();\r
+        }\r
 \r
         if (arg0.getSource() == this.jMenuItemProjectChangeWorkspace) {\r
             this.changeWorkspace();\r
@@ -3200,6 +3174,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
         tcc.showDialog();\r
     }\r
 \r
+    private void configBuildPreferences() {\r
+       Preferences bt = Preferences.getInstance();\r
+       bt.showDialog();\r
+    }\r
     /**\r
      Clone selected item\r
      \r
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java
new file mode 100644 (file)
index 0000000..ded198d
--- /dev/null
@@ -0,0 +1,980 @@
+/** @file\r
+ <<The file is used to update the Build Preferences file, target.txt>>\r
\r
+ <<The program will use target.txt, the tools config file specified in that file,\r
+ or it will use the default tools_def.txt file, and it will also scan the \r
+ FrameworkDatabase.db file for certain parameters. >>\r
\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
+ Package Name: Tools\r
+ Module Name:  FrameworkWizard\r
\r
+ **/\r
+\r
+package org.tianocore.frameworkwizard.toolchain;\r
+\r
+import java.awt.event.ActionEvent;\r
+import java.io.*;\r
+import java.util.Vector;\r
+import java.util.Iterator;\r
+\r
+import javax.swing.*;\r
+// import javax.swing.JScrollPane;\r
+import javax.swing.JTextField;\r
+import javax.swing.JFrame;\r
+\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
+import org.tianocore.frameworkwizard.common.Tools;\r
+import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r
+import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.*;\r
+import org.tianocore.frameworkwizard.common.ui.IFrame;\r
+import org.tianocore.frameworkwizard.workspace.Workspace;\r
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
+import org.tianocore.PlatformSurfaceAreaDocument;\r
+\r
+/**\r
+ * The class is used to update the target.txt file.\r
+ * \r
+ * It extends IDialog\r
+ * \r
+ */\r
+public class Preferences extends IFrame {\r
+\r
+    // /\r
+    // / Define class Serial Version UID\r
+    // /\r
+    private static final long serialVersionUID = -4777906991966638888L;\r
+\r
+    private final boolean Debug = false;\r
+\r
+    //\r
+    // Define class members\r
+    //\r
+    private final int oneRowHeight = 20;\r
+\r
+    private final int twoRowHeight = 40;\r
+\r
+    private final int threeRowHeight = 60;\r
+\r
+    private final int sepHeight = 6;\r
+\r
+    private final int rowOne = 12;\r
+\r
+    private final int rowTwo = rowOne + oneRowHeight + sepHeight;\r
+\r
+    private final int rowThree = rowTwo + oneRowHeight + sepHeight;\r
+\r
+    private final int rowFour = rowThree + threeRowHeight + sepHeight;\r
+\r
+    private final int rowFive = rowFour + threeRowHeight + sepHeight;\r
+\r
+    private final int buttonRow = rowFive + oneRowHeight + sepHeight + sepHeight;\r
+\r
+    private final int dialogHeight = buttonRow + twoRowHeight + twoRowHeight;\r
+\r
+    private final int dialogWidth = 540;\r
+\r
+    private final int lastButtonXLoc = 430;\r
+\r
+    private final int next2LastButtonLoc = 329;\r
+\r
+    /*\r
+     * Define the contents for this dialog box\r
+     */\r
+    private static Preferences bTarget = null;\r
+\r
+    private WorkspaceTools wt = new WorkspaceTools();\r
+\r
+    private JFrame frame;\r
+\r
+    private JPanel jContentPane = null;\r
+\r
+    private JLabel jLabelToolsConfigFile = null;\r
+\r
+    private JTextField jTextFieldToolsConfigFile = null;\r
+\r
+    private final int toolConfigFileRow = rowOne;\r
+\r
+    private final int toolDefFileId = 3;\r
+\r
+    private JLabel jLabelActivePlatform = null;\r
+\r
+    private JComboBox jComboBoxActivePlatform = null;\r
+\r
+    private final int activePlatformId = 0;\r
+\r
+    private final int activePlatformRow = rowTwo;\r
+\r
+    private JLabel jLabelToolChainTagName = null;\r
+\r
+    private JScrollPane jScrollPaneTagName = null;\r
+\r
+    private ICheckBoxList iCheckBoxListTagName = null;\r
+\r
+    private final int toolChainTagNameRow = rowThree;\r
+\r
+    private final int tagNameId = 4;\r
+\r
+    private JLabel jLabelBuildTarget = null;\r
+\r
+    private JScrollPane jScrollPaneBuildTarget = null;\r
+\r
+    private ICheckBoxList iCheckBoxListBuildTarget = null;\r
+\r
+    private final int buildTargetRow = rowFour;\r
+\r
+    private final int buildTargetId = 1;\r
+\r
+    private JLabel jLabelTargetArch = null;\r
+\r
+    private ArchCheckBox jArchCheckBox = null;\r
+\r
+    private final int targetArchRow = rowFive;\r
+\r
+    private final int targetArchId = 2;\r
+\r
+    private JButton jButtonBrowse = null;\r
+\r
+    private JButton jButtonSave = null;\r
+\r
+    private JButton jButtonCancel = null;\r
+\r
+    private final int labelColumn = 12;\r
+\r
+    private final int labelWidth = 155;\r
+\r
+    private final int valueColumn = 168;\r
+\r
+    private final int valueWidth = 352;\r
+\r
+    private final int valueWidthShort = 260;\r
+\r
+    private final int buttonWidth = 90;\r
+\r
+    private String workspaceDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator");\r
+\r
+    private String toolsDir = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + "Tools"\r
+                              + System.getProperty("file.separator") + "Conf";\r
+\r
+    private String defaultToolsConf = toolsDir + System.getProperty("file.separator") + "tools_def.txt";\r
+\r
+    private String targetFile = toolsDir + System.getProperty("file.separator") + "target.txt";\r
+\r
+    private String[] targetFileContents = new String[500];\r
+\r
+    // private String[] toolsConfContents;\r
+\r
+    private String[] targetLines = new String[5];\r
+\r
+    private int targetLineNumber[] = new int[5];\r
+\r
+    private String toolsConfFile;\r
+\r
+    private String toolsDefTargetNames = null;\r
+\r
+    private final int toolsDefTargetNameField = 0;\r
+\r
+    private String toolsDefTagNames = null;\r
+\r
+    private final int toolsDefTagNameField = 1;\r
+\r
+    private String toolsDefArchNames = null;\r
+\r
+    private final int toolsDefArchNameField = 2;\r
+\r
+    private String toolsDefIdentifier = null;\r
+\r
+    private int targetLineNumberMax;\r
+\r
+    private Vector<String> vArchList = null;\r
+\r
+    //\r
+    // Not used by UI\r
+    //\r
+    //    private Preferences id = null;\r
+\r
+    //    private EnumerationData ed = new EnumerationData();\r
+\r
+    /**\r
+     This method initializes jTextFieldToolsConfigFile  \r
+     \r
+     @return javax.swing.JTextField  jTextFieldToolsConfigFile\r
+     **/\r
+    private JTextField getJTextFieldToolsConfigFile() {\r
+        if (jTextFieldToolsConfigFile == null) {\r
+            if (targetLines[toolDefFileId] != null) {\r
+                String sLine[] = targetLines[toolDefFileId].trim().split("=");\r
+                jTextFieldToolsConfigFile = new JTextField(sLine[1].trim());\r
+            } else\r
+                jTextFieldToolsConfigFile = new JTextField();\r
+\r
+            jTextFieldToolsConfigFile.setBounds(new java.awt.Rectangle(valueColumn, toolConfigFileRow, valueWidthShort,\r
+                                                                       oneRowHeight));\r
+            jTextFieldToolsConfigFile.setPreferredSize(new java.awt.Dimension(valueWidthShort, oneRowHeight));\r
+            jTextFieldToolsConfigFile\r
+                                     .setToolTipText("<html>"\r
+                                                     + "Specify the name of the filename to use for specifying"\r
+                                                     + "<br>the tools to use for the build.  If not specified,"\r
+                                                     + "<br>tools_def.txt will be used for the build.  This file"\r
+                                                     + "<br>MUST be located in the WORKSPACE/Tools/Conf directory.</html>");\r
+\r
+        }\r
+        return jTextFieldToolsConfigFile;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jComboBoxActivePlatform\r
+     * \r
+     * @return javax.swing.JComboBox jComboBoxActivePlatform\r
+     * \r
+     */\r
+    private JComboBox getActivePlatform() {\r
+        Vector<PlatformIdentification> vPlatformId = wt.getAllPlatforms();\r
+\r
+        if (jComboBoxActivePlatform == null) {\r
+            jComboBoxActivePlatform = new JComboBox();\r
+            jComboBoxActivePlatform.setBounds(new java.awt.Rectangle(valueColumn, activePlatformRow, valueWidth,\r
+                                                                     oneRowHeight));\r
+            jComboBoxActivePlatform.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));\r
+            jComboBoxActivePlatform.setToolTipText("<html>Select &quot;Do Not Set&quot; if you want to build a platform"\r
+                                                   + "<br>from the directory where the FPD file exists,"\r
+                                                   + "<br>otherwise scroll down to select the platform.</html>");\r
+\r
+            /*\r
+             * Generate the data, selecting what is in target.txt\r
+             */\r
+            jComboBoxActivePlatform.addItem("Do Not Set");\r
+            Iterator<PlatformIdentification> iter = vPlatformId.iterator();\r
+            while (iter.hasNext()) {\r
+                PlatformIdentification item = iter.next();\r
+                String path = item.getPath().trim();\r
+                String str = path.substring(workspaceDir.length(), path.length());\r
+                str.replace(System.getProperty("file.separator"), "/");\r
+                jComboBoxActivePlatform.addItem(str.trim());\r
+            }\r
+            if (targetLines[activePlatformId] == null)\r
+                jComboBoxActivePlatform.setSelectedItem("Do Not Set");\r
+            else\r
+                jComboBoxActivePlatform.setSelectedItem(targetLines[activePlatformId]);\r
+        }\r
+        return jComboBoxActivePlatform;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jScrollPaneTagName\r
+     * \r
+     * @return javax.swing.JScrollPane jScrollPaneTagName\r
+     * \r
+     */\r
+    private JScrollPane getJScrollPaneTagName() {\r
+\r
+        if (jScrollPaneTagName == null) {\r
+            jScrollPaneTagName = new JScrollPane();\r
+            jScrollPaneTagName.setBounds(new java.awt.Rectangle(valueColumn, toolChainTagNameRow, valueWidth,\r
+                                                                threeRowHeight));\r
+            jScrollPaneTagName.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));\r
+            jScrollPaneTagName.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
+            jScrollPaneTagName.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);\r
+            jScrollPaneTagName.setViewportView(getICheckBoxListTagName());\r
+            jScrollPaneTagName.setToolTipText("<html>"\r
+                                              + "Specify the TagName(s) from the tool configuration file to use"\r
+                                              + "<br>for your builds.  If not specified, all applicable TagName"\r
+                                              + " <br>tools will be used for the build.</html>");\r
+            jScrollPaneTagName.setVisible(true);\r
+\r
+        }\r
+        return jScrollPaneTagName;\r
+    }\r
+\r
+    private ICheckBoxList getICheckBoxListTagName() {\r
+        if (iCheckBoxListTagName == null) {\r
+            iCheckBoxListTagName = new ICheckBoxList();\r
+            \r
+            if (toolsDefTagNames != null) {\r
+                toolsDefTagNames.trim();\r
+                String aTagNames[] = toolsDefTagNames.trim().split(" ");\r
+                Vector<String> vTags = new Vector<String>();\r
+                for (int i = 0; i < aTagNames.length; i++) {\r
+                    vTags.add(aTagNames[i]);\r
+                }\r
+                iCheckBoxListTagName.setAllItems(vTags);\r
+            } else {\r
+                Vector<String> defaultTags = stringToVector("MYTOOLS");\r
+                iCheckBoxListTagName.setAllItems(defaultTags);\r
+            }\r
+            \r
+            iCheckBoxListTagName.setAllItemsUnchecked();\r
+            iCheckBoxListTagName.setToolTipText("<html>"\r
+                                                + "Specify the TagName(s) from the tool configuration file to use"\r
+                                                + "<br>for your builds.  If not specified, all applicable TagName"\r
+                                                + " <br>tools will be used for the build.</html>");\r
+            Vector<String> vSelectedTags = new Vector<String>();\r
+            if (targetLines[tagNameId] != null) {\r
+                targetLines[tagNameId].trim();\r
+                String targetTags[] = targetLines[tagNameId].trim().split(" ");\r
+                for (int j = 0; j < targetTags.length; j++)\r
+                    vSelectedTags.add(targetTags[j]);\r
+                iCheckBoxListTagName.initCheckedItem(true, vSelectedTags);\r
+            }\r
+        }\r
+        return iCheckBoxListTagName;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jScrollPaneBuildTarget\r
+     * \r
+     * @return javax.swing.JComboBox jScrollPaneBuildTarget\r
+     * \r
+     */\r
+    private JScrollPane getJScrollPaneBuildTarget() {\r
+        if (jScrollPaneBuildTarget == null) {\r
+            jScrollPaneBuildTarget = new JScrollPane();\r
+            jScrollPaneBuildTarget.setBounds(new java.awt.Rectangle(valueColumn, buildTargetRow, valueWidth,\r
+                                                                    threeRowHeight));\r
+            jScrollPaneBuildTarget.setPreferredSize(new java.awt.Dimension(valueWidth, threeRowHeight));\r
+            jScrollPaneBuildTarget.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
+            jScrollPaneBuildTarget.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);\r
+            jScrollPaneBuildTarget.setViewportView(getICheckBoxListBuildTarget());\r
+            jScrollPaneBuildTarget.setVisible(true);\r
+            jScrollPaneBuildTarget.setToolTipText("<html>"\r
+                                                  + "Select the TARGET Names that you want to build, such as<BR>"\r
+                                                  + "BUILD or BUILD and RELEASE"\r
+                                                  + "<br>If you do not set any of these, all available targets"\r
+                                                  + "<br>will be built.</html>");\r
+\r
+        }\r
+        return jScrollPaneBuildTarget;\r
+    }\r
+\r
+    private ICheckBoxList getICheckBoxListBuildTarget() {\r
+        if (iCheckBoxListBuildTarget == null) {\r
+            \r
+            String aBuildTargets[] = toolsDefTargetNames.trim().split(" ");\r
+            Vector<String> vBuildTargets = new Vector<String>();\r
+            for (int i = 0; i < aBuildTargets.length; i++) {\r
+                vBuildTargets.add(aBuildTargets[i]);\r
+            }\r
+            iCheckBoxListBuildTarget = new ICheckBoxList();\r
+            iCheckBoxListBuildTarget.setAllItems(vBuildTargets);\r
+            iCheckBoxListBuildTarget.setAllItemsUnchecked();\r
+            iCheckBoxListBuildTarget.setToolTipText("<html>"\r
+                                                    + "Select the TARGET Names that you want to build, such as<BR>"\r
+                                                    + "BUILD or BUILD and RELEASE"\r
+                                                    + "<br>If you do not set any of these, all available targets"\r
+                                                    + "<br>will be built.</html>");\r
+\r
+            Vector<String> vSelectedTags = new Vector<String>();\r
+            if (targetLines[buildTargetId] != null) {\r
+                targetLines[buildTargetId].trim();\r
+                String targetTags[] = targetLines[buildTargetId].trim().split(" ");\r
+                for (int j = 0; j < targetTags.length; j++)\r
+                    vSelectedTags.add(targetTags[j]);\r
+                iCheckBoxListBuildTarget.initCheckedItem(true, vSelectedTags);\r
+            }\r
+        }\r
+        return iCheckBoxListBuildTarget;\r
+    }\r
+\r
+    /**\r
+     This method initializes jButtonBrowse   \r
+     \r
+     @return javax.swing.JButton \r
+     **/\r
+    private JButton getJButtonBrowse() {\r
+        if (jButtonBrowse == null) {\r
+            jButtonBrowse = new JButton();\r
+            jButtonBrowse\r
+                         .setBounds(new java.awt.Rectangle(lastButtonXLoc, toolConfigFileRow, buttonWidth, oneRowHeight));\r
+            jButtonBrowse.setText("Browse");\r
+            jButtonBrowse.setPreferredSize(new java.awt.Dimension(buttonWidth, oneRowHeight));\r
+            jButtonBrowse.addActionListener(new AbstractAction() {\r
+                /**\r
+                 * \r
+                 */\r
+                private static final long serialVersionUID = 1L;\r
+\r
+                public void actionPerformed(ActionEvent e) {\r
+                    //\r
+                    // Select files from current workspace\r
+                    //\r
+                    String dirPrefix = toolsDir + System.getProperty("file.separator");\r
+                    JFileChooser chooser = new JFileChooser(dirPrefix);\r
+                    File theFile = null;\r
+                    //                    String headerDest = null;\r
+\r
+                    chooser.setMultiSelectionEnabled(false);\r
+                    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);\r
+                    int retval = chooser.showOpenDialog(frame);\r
+                    if (retval == JFileChooser.APPROVE_OPTION) {\r
+\r
+                        theFile = chooser.getSelectedFile();\r
+                        String file = theFile.getPath();\r
+                        if (!file.startsWith(dirPrefix)) {\r
+                            JOptionPane.showMessageDialog(frame, "You can only select files in the Tools"\r
+                                                                 + System.getProperty("file.separator")\r
+                                                                 + "Conf directory!");\r
+\r
+                            return;\r
+                        }\r
+\r
+                        jTextFieldToolsConfigFile.setText("Tools/Conf/" + theFile.getName());\r
+                    } else {\r
+                        return;\r
+                    }\r
+                }\r
+            });\r
+        }\r
+        return jButtonBrowse;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jButtonOk\r
+     * \r
+     * @return javax.swing.JButton\r
+     * \r
+     */\r
+    private JButton getJButtonSave() {\r
+        if (jButtonSave == null) {\r
+            jButtonSave = new JButton();\r
+            jButtonSave.setBounds(new java.awt.Rectangle(next2LastButtonLoc, buttonRow, buttonWidth, oneRowHeight));\r
+            jButtonSave.setText("Save");\r
+            jButtonSave.addActionListener(this);\r
+        }\r
+        return jButtonSave;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jButtonCancel\r
+     * \r
+     * @return javax.swing.JButton\r
+     * \r
+     */\r
+    private JButton getJButtonCancel() {\r
+        if (jButtonCancel == null) {\r
+            jButtonCancel = new JButton();\r
+            jButtonCancel.setBounds(new java.awt.Rectangle(lastButtonXLoc, buttonRow, buttonWidth, oneRowHeight));\r
+            jButtonCancel.setText("Cancel");\r
+            jButtonCancel.addActionListener(this);\r
+        }\r
+        return jButtonCancel;\r
+    }\r
+\r
+    public static void main(String[] args) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    public static Preferences getInstance() {\r
+        if (bTarget == null) {\r
+            bTarget = new Preferences();\r
+        }\r
+        return bTarget;\r
+    }\r
+\r
+    /**\r
+     * This is the default constructor\r
+     */\r
+    public Preferences() {\r
+        super();\r
+        init();\r
+    }\r
+\r
+    /**\r
+     * This method initializes this\r
+     * \r
+     */\r
+    private void init() {\r
+\r
+        for (int i = 0; i < 5; i++) {\r
+            targetLines[i] = null;\r
+            targetLineNumber[i] = -1;\r
+        }\r
+        initReadFiles();\r
+        this.setSize(dialogWidth, dialogHeight);\r
+        this.setContentPane(getJContentPane());\r
+        this.setTitle("Build Preferences [" + toolsDefIdentifier + "]");\r
+        this.setDefaultCloseOperation(IFrame.EXIT_ON_CLOSE);\r
+        this.centerWindow();\r
+        this.setVisible(true);\r
+    }\r
+\r
+    /**\r
+     * This method initializes this Fill values to all fields if these values are\r
+     * not empty\r
+     * \r
+     * @param initReadFiles\r
+     * \r
+     */\r
+    private void initReadFiles() {\r
+        /*\r
+         * TODO\r
+         * Read Current target.txt file first\r
+         * Read TOOL_CHAIN_CONF file if specified, otherwise use tools_def.txt\r
+         */\r
+\r
+        readTargetTxtFile();\r
+        boolean haveBuildTargets = readToolDefinitionFile();\r
+        if (!haveBuildTargets) {\r
+            // Lookup Build Targets from the platforms\r
+            readPlatformFileBuildTargets();\r
+        }\r
+    }\r
+\r
+    private void readPlatformFileBuildTargets() {\r
+        Vector<PlatformIdentification> vPlatformId = wt.getAllPlatforms();\r
+        String sBuildTargets = "";\r
+\r
+        // foreach platform, build a list of BuildTargets\r
+        Iterator<PlatformIdentification> iter = vPlatformId.iterator();\r
+        while (iter.hasNext()) {\r
+            PlatformIdentification item = iter.next();\r
+            PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd = GlobalData.openingPlatformList\r
+                                                                                                .getOpeningPlatformById(\r
+                                                                                                                        item)\r
+                                                                                                .getXmlFpd();\r
+            sBuildTargets += fpd.getPlatformDefinitions().getBuildTargets().toString() + " ";\r
+        }\r
+        String allTargets[] = sBuildTargets.trim().split(" ");\r
+        for (int i = 0; i < allTargets.length; i++) {\r
+            if (!toolsDefTargetNames.contains(allTargets[i])) {\r
+                toolsDefTargetNames += allTargets[i] + " ";\r
+            }\r
+        }\r
+    }\r
+\r
+    private boolean readToolDefinitionFile() {\r
+\r
+        // Parse the tool definition file looking for targets and architectures\r
+        toolsConfFile = null;\r
+        boolean buildTargetsExist = true;\r
+\r
+        if (targetLines[toolDefFileId] != null) {\r
+            String[] result = new String[2];\r
+            targetLines[toolDefFileId].trim();\r
+            result = (targetLines[toolDefFileId]).split("=");\r
+            String resString = (Tools.convertPathToCurrentOsType(result[1])).trim();\r
+            toolsConfFile = workspaceDir.trim() + resString.trim();\r
+            File toolsDefFile = new File(toolsConfFile);\r
+            if (!toolsDefFile.exists()) {\r
+                JOptionPane.showMessageDialog(this, "<html>" + "Tool Definition file, " + toolsConfFile\r
+                                                    + "<br>specified in the target.txt file does not exist!"\r
+                                                    + "<br>Using the default Tool Definition File:<br>"\r
+                                                    + defaultToolsConf);\r
+                toolsConfFile = defaultToolsConf;\r
+            }\r
+        } else {\r
+            toolsConfFile = defaultToolsConf;\r
+        }\r
+        String[] toolsDefFields = new String[5];\r
+        for (int i = 0; i < 5; i++)\r
+            toolsDefFields[i] = null;\r
+        File toolDefFile = new File(toolsConfFile);\r
+        if (toolDefFile.exists()) {\r
+            try {\r
+                FileReader fileReader = new FileReader(toolDefFile);\r
+                BufferedReader reader = new BufferedReader(fileReader);\r
+                String rLine = null;\r
+                String result[];\r
+                int lineCounter = 0;\r
+                while ((rLine = reader.readLine()) != null) {\r
+\r
+                    if (rLine.startsWith("IDENTIFIER")) {\r
+                        result = rLine.split("=");\r
+                        toolsDefIdentifier = (result[1]).trim();\r
+                    } else if ((!rLine.startsWith("#")) && (rLine.contains("="))) {\r
+                        result = rLine.split("=");\r
+                        toolsDefFields = ((result[0]).trim()).split("_");\r
+                        if (toolsDefTargetNames == null) {\r
+                            toolsDefTargetNames = (toolsDefFields[toolsDefTargetNameField]).trim() + " ";\r
+                        } else if (!toolsDefTargetNames.contains((toolsDefFields[toolsDefTargetNameField]).trim())) {\r
+                            toolsDefTargetNames += (toolsDefFields[toolsDefTargetNameField]).trim() + " ";\r
+                        }\r
+                        if (toolsDefTagNames == null) {\r
+                            toolsDefTagNames = (toolsDefFields[toolsDefTagNameField]).trim() + " ";\r
+                        } else if (!toolsDefTagNames.contains((toolsDefFields[toolsDefTagNameField]).trim())) {\r
+                            toolsDefTagNames += (toolsDefFields[toolsDefTagNameField]).trim() + " ";\r
+                        }\r
+                        if (toolsDefArchNames == null) {\r
+                            toolsDefArchNames = (toolsDefFields[toolsDefArchNameField]).trim() + " ";\r
+                        } else if (!toolsDefArchNames.contains((toolsDefFields[toolsDefArchNameField]).trim())) {\r
+                            toolsDefArchNames += (toolsDefFields[toolsDefArchNameField]).trim() + " ";\r
+                        }\r
+                    }\r
+                    lineCounter++;\r
+                }\r
+                reader.close();\r
+                if (!toolsDefTargetNames.matches("[A-Z]+")) {\r
+                    toolsDefTargetNames = toolsDefTargetNames.replace("* ", "").trim();\r
+                    if (Debug)\r
+                        System.out.println("tools_def file does not define build targets: '" + toolsDefTargetNames\r
+                                           + "'");\r
+                    buildTargetsExist = false;\r
+                }\r
+            } catch (IOException e) {\r
+                Log.log(toolsConfFile + " Read Error ", e.getMessage());\r
+                e.printStackTrace();\r
+            }\r
+        }\r
+        return buildTargetsExist;\r
+    }\r
+\r
+    private void readTargetTxtFile() {\r
+        File tFile = new File(targetFile);\r
+\r
+        if (tFile.exists()) {\r
+            try {\r
+                FileReader fileReader = new FileReader(targetFile);\r
+                BufferedReader reader = new BufferedReader(fileReader);\r
+                targetLineNumberMax = 0;\r
+                String rLine = null;\r
+                while ((rLine = reader.readLine()) != null) {\r
+                    targetFileContents[targetLineNumberMax] = rLine;\r
+                    if (rLine.startsWith("ACTIVE_PLATFORM")) {\r
+                        // Only one active platform is permitted!\r
+                        targetLines[activePlatformId] = rLine;\r
+                        targetLineNumber[activePlatformId] = targetLineNumberMax;\r
+                    }\r
+                    if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t"))\r
+                        || (rLine.startsWith("TARGET="))) {\r
+                        // Handle multiple Target Names\r
+                        if (rLine.contains(","))\r
+                            targetLines[buildTargetId] = rLine.trim().replaceAll(",", " ");\r
+                        else\r
+                            targetLines[buildTargetId] = rLine.trim();\r
+                        targetLineNumber[buildTargetId] = targetLineNumberMax;\r
+                    }\r
+                    if (rLine.startsWith("TARGET_ARCH")) {\r
+                        // Handle multiple Target Architectures\r
+                        if (rLine.contains(","))\r
+                            targetLines[targetArchId] = rLine.trim().replaceAll(",", " ");\r
+                        else\r
+                            targetLines[targetArchId] = rLine.trim();\r
+                        targetLineNumber[targetArchId] = targetLineNumberMax;\r
+                    }\r
+                    if (rLine.startsWith("TOOL_CHAIN_CONF")) {\r
+                        // Only one file is permitted\r
+                        targetLines[toolDefFileId] = rLine.trim();\r
+                        targetLineNumber[toolDefFileId] = targetLineNumberMax;\r
+                    }\r
+\r
+                    if (rLine.startsWith("TOOL_CHAIN_TAG")) {\r
+                        // Handle multiple Tool TagNames\r
+                        if (rLine.contains(","))\r
+                            targetLines[tagNameId] = rLine.trim().replaceAll(",", " ");\r
+                        else\r
+                            targetLines[tagNameId] = rLine.trim();\r
+                        targetLineNumber[tagNameId] = targetLineNumberMax;\r
+                    }\r
+                    targetLineNumberMax++;\r
+                }\r
+                reader.close();\r
+                String archLine[] = new String[2];\r
+                if (targetLines[targetArchId] != null) {\r
+                    if (targetLines[targetArchId].contains("=")) {\r
+                        if (targetLines[targetArchId].contains(","))\r
+                            targetLines[targetArchId] = targetLines[targetArchId].trim().replaceAll(",", " ");\r
+                        if (targetLines[targetArchId].length() > 0)\r
+                            archLine = targetLines[targetArchId].trim().split("=");\r
+                        vArchList = stringToVector(archLine[1]);\r
+                    }\r
+                }\r
+\r
+                if (Debug == true)\r
+                    for (int i = 0; i <= tagNameId; i++)\r
+                        System.out.println("targetLines[" + i + "] contains: " + targetLines[i] + " index is: "\r
+                                           + targetLineNumber[i]);\r
+\r
+            } catch (IOException e) {\r
+                Log.log(this.targetFile + " Read Error ", e.getMessage());\r
+                e.printStackTrace();\r
+            }\r
+        }\r
+\r
+    }\r
+\r
+    /**\r
+     * This method initializes jContentPane\r
+     * \r
+     * @return javax.swing.JPanel jContentPane\r
+     * \r
+     */\r
+    private JPanel getJContentPane() {\r
+        if (jContentPane == null) {\r
+            jLabelToolsConfigFile = new JLabel();\r
+            jLabelToolsConfigFile.setBounds(new java.awt.Rectangle(labelColumn, toolConfigFileRow, labelWidth,\r
+                                                                   oneRowHeight));\r
+            jLabelToolsConfigFile.setText("Tool Chain Definition File");\r
+            jLabelActivePlatform = new JLabel();\r
+            jLabelActivePlatform.setText("Select Active Platform");\r
+            jLabelActivePlatform.setBounds(new java.awt.Rectangle(labelColumn, activePlatformRow, labelWidth,\r
+                                                                  oneRowHeight));\r
+            jLabelToolChainTagName = new JLabel();\r
+            jLabelToolChainTagName.setBounds(new java.awt.Rectangle(labelColumn, toolChainTagNameRow, labelWidth,\r
+                                                                    oneRowHeight));\r
+            jLabelToolChainTagName.setText("Select Tool Tag Name");\r
+            jLabelBuildTarget = new JLabel();\r
+            jLabelBuildTarget.setBounds(new java.awt.Rectangle(labelColumn, buildTargetRow, labelWidth, oneRowHeight));\r
+            jLabelBuildTarget.setText("Select Build Target");\r
+            jLabelTargetArch = new JLabel();\r
+            jLabelTargetArch.setBounds(new java.awt.Rectangle(labelColumn, targetArchRow, labelWidth, oneRowHeight));\r
+            jLabelTargetArch.setText("Build Architectures");\r
+            jArchCheckBox = new ArchCheckBox();\r
+            jArchCheckBox.setBounds(new java.awt.Rectangle(valueColumn, targetArchRow, valueWidth, oneRowHeight));\r
+            jArchCheckBox.setPreferredSize(new java.awt.Dimension(valueWidth, oneRowHeight));\r
+\r
+            jContentPane = new JPanel();\r
+            jContentPane.setLayout(null);\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(dialogWidth - 10, dialogHeight - 10));\r
+\r
+            jContentPane.add(jLabelToolsConfigFile, null);\r
+            jContentPane.add(getJTextFieldToolsConfigFile(), null);\r
+            jContentPane.add(getJButtonBrowse(), null);\r
+\r
+            jContentPane.add(jLabelActivePlatform, null);\r
+            jContentPane.add(getActivePlatform(), null);\r
+\r
+            jContentPane.add(jLabelToolChainTagName, null);\r
+            jContentPane.add(getJScrollPaneTagName(), null);\r
+\r
+            jContentPane.add(jLabelBuildTarget, null);\r
+            jContentPane.add(getJScrollPaneBuildTarget(), null);\r
+\r
+            jContentPane.add(jLabelTargetArch, null);\r
+\r
+            jArchCheckBox.setSelectedItems(vArchList);\r
+            jContentPane.add(jArchCheckBox, null);\r
+\r
+            jContentPane.add(getJButtonSave(), null);\r
+            jContentPane.add(getJButtonCancel(), null);\r
+        }\r
+        return jContentPane;\r
+    }\r
+\r
+    /*\r
+     * (non-Javadoc)\r
+     * \r
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
+     * \r
+     * Override actionPerformed to listen all actions\r
+     * \r
+     */\r
+    public void actionPerformed(ActionEvent arg0) {\r
+\r
+        if (arg0.getSource() == jButtonBrowse) {\r
+            // TODO: Call file browser, starting in $WORKSPACE/Tools/Conf directory\r
+\r
+        }\r
+\r
+        if (arg0.getSource() == jButtonSave) {\r
+            saveTargetFile();\r
+            JOptionPane.showMessageDialog(this, "<html>The target.txt file has been saved!"\r
+                                                + "<br>A copy of the original file, target.txt.bak has"\r
+                                                + "<br>also been created.</html>");\r
+            this.exit();\r
+        }\r
+\r
+        if (arg0.getSource() == jButtonCancel) {\r
+            this.exit();\r
+        }\r
+    }\r
+\r
+    private void updateActivePlatform() {\r
+        int lineAP;\r
+        if (targetLines[activePlatformId] != null) {\r
+            lineAP = targetLineNumber[activePlatformId];\r
+        } else {\r
+            lineAP = targetLineNumberMax;\r
+            targetLineNumber[activePlatformId] = lineAP;\r
+            targetLineNumberMax++;\r
+        }\r
+        if (jComboBoxActivePlatform.getSelectedItem() == "Do Not Set") {\r
+            targetFileContents[lineAP] = "";\r
+            targetLines[activePlatformId] = "";\r
+        } else {\r
+            targetFileContents[lineAP] = "ACTIVE_PLATFORM = " + jComboBoxActivePlatform.getSelectedItem() + "\r\n";\r
+            targetLines[activePlatformId] = targetFileContents[lineAP];\r
+        }\r
+        if (Debug)\r
+            System.out.println("Active Platform: " + targetFileContents[lineAP]);\r
+    }\r
+\r
+    private void updateToolDefFile() {\r
+        int lineTDF;\r
+        if (targetLines[toolDefFileId] != null) {\r
+            lineTDF = targetLineNumber[toolDefFileId];\r
+        } else {\r
+            lineTDF = targetLineNumberMax;\r
+            targetLineNumber[toolDefFileId] = lineTDF;\r
+            targetLineNumberMax++;\r
+        }\r
+        if (Debug)\r
+            System.out.println("Tool Config File: " + jTextFieldToolsConfigFile.getText());\r
+        if (jTextFieldToolsConfigFile.getText() == null) {\r
+            targetFileContents[lineTDF] = "";\r
+            targetLines[toolDefFileId] = "";\r
+        } else {\r
+            targetFileContents[lineTDF] = "TOOL_CHAIN_CONF = " + jTextFieldToolsConfigFile.getText() + "\r\n";\r
+            targetLines[toolDefFileId] = targetFileContents[lineTDF];\r
+        }\r
+    }\r
+\r
+    private void updateToolTagNames() {\r
+        String sTagNames = vectorToString(iCheckBoxListTagName.getAllCheckedItemsString());\r
+        int lineTTN;\r
+\r
+        if (targetLines[tagNameId] != null) {\r
+            lineTTN = targetLineNumber[tagNameId];\r
+        } else {\r
+            lineTTN = targetLineNumberMax;\r
+            targetLineNumber[tagNameId] = lineTTN;\r
+            targetLineNumberMax++;\r
+        }\r
+\r
+        if (Debug)\r
+            System.out.println("Tag Name(s): " + sTagNames);\r
+\r
+        if (sTagNames.length() > 0) {\r
+            targetFileContents[lineTTN] = "TOOL_CHAIN_TAG = " + sTagNames + "\r\n";\r
+            targetLines[tagNameId] = targetFileContents[lineTTN];\r
+        } else {\r
+            targetFileContents[lineTTN] = "";\r
+            targetLines[tagNameId] = "";\r
+        }\r
+    }\r
+\r
+    private void updateBuildTargets() {\r
+        String sBuildTargets = vectorToString(iCheckBoxListBuildTarget.getAllCheckedItemsString());\r
+        int lineBT;\r
+\r
+        if (targetLines[buildTargetId] != null) {\r
+            lineBT = targetLineNumber[buildTargetId];\r
+        } else {\r
+            lineBT = targetLineNumberMax;\r
+            targetLineNumber[buildTargetId] = lineBT;\r
+            targetLineNumberMax++;\r
+        }\r
+        if (Debug)\r
+            System.out.println("Build Target(s): " + sBuildTargets);\r
+        if (sBuildTargets.length() > 0) {\r
+            targetFileContents[lineBT] = "TARGET = " + sBuildTargets + "\r\n";\r
+            targetLines[buildTargetId] = targetFileContents[lineBT];\r
+        } else {\r
+            targetFileContents[lineBT] = "";\r
+            targetLines[buildTargetId] = "";\r
+        }\r
+\r
+    }\r
+\r
+    private void updateArchitectures() {\r
+        String sArchList = jArchCheckBox.getSelectedItemsString().trim();\r
+\r
+        if (Debug)\r
+            System.out.println("Architectures: " + sArchList);\r
+\r
+        int lineSA;\r
+        if (targetLines[targetArchId] != null) {\r
+            lineSA = targetLineNumber[targetArchId];\r
+        } else {\r
+            lineSA = targetLineNumberMax;\r
+            targetLineNumber[targetArchId] = lineSA;\r
+            targetLineNumberMax++;\r
+        }\r
+        if (sArchList == "") {\r
+            targetFileContents[lineSA] = "";\r
+            targetLines[targetArchId] = "";\r
+        } else {\r
+            targetFileContents[lineSA] = "TARGET_ARCH = " + sArchList + "\r\n";\r
+            targetLines[targetArchId] = targetFileContents[lineSA];\r
+        }\r
+\r
+    }\r
+\r
+    private String vectorToString(Vector<String> v) {\r
+        String s = " ";\r
+        for (int i = 0; i < v.size(); ++i) {\r
+            s += v.get(i);\r
+            s += " ";\r
+        }\r
+        return s.trim();\r
+    }\r
+\r
+    protected Vector<String> stringToVector(String s) {\r
+        if (s == null) {\r
+            return null;\r
+        }\r
+        String[] sArray = s.split(" ");\r
+        Vector<String> v = new Vector<String>();\r
+        for (int i = 0; i < sArray.length; ++i) {\r
+            v.add(sArray[i]);\r
+        }\r
+        return v;\r
+    }\r
+\r
+    private void saveTargetFile() {\r
+        updateActivePlatform();\r
+        updateToolDefFile();\r
+        updateToolTagNames();\r
+        updateBuildTargets();\r
+        updateArchitectures();\r
+\r
+        try {\r
+            copy(targetFile, targetFile + ".bak");\r
+            FileWriter fileWriter = new FileWriter(targetFile);\r
+            BufferedWriter writer = new BufferedWriter(fileWriter);\r
+            for (int i = 0; i < targetLineNumberMax; i++) {\r
+                writer.write(targetFileContents[i] + "\r\n");\r
+            }\r
+            writer.close();\r
+        } catch (IOException e) {\r
+            Log.err(toolsConfFile + " Write Error ", e.getMessage());\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    private void copy(String txtFile, String bakFile) throws IOException {\r
+        File fromFile = new File(txtFile);\r
+        File toFile = new File(bakFile);\r
+        FileInputStream fromTxt = null;\r
+        FileOutputStream toBak = null;\r
+        try {\r
+            fromTxt = new FileInputStream(fromFile);\r
+            toBak = new FileOutputStream(toFile);\r
+            byte[] buffer = new byte[4096];\r
+            int bytes_read;\r
+            while ((bytes_read = fromTxt.read(buffer)) != -1) {\r
+                toBak.write(buffer, 0, bytes_read);\r
+            }\r
+        } finally {\r
+            if (fromTxt != null)\r
+                try {\r
+                    fromTxt.close();\r
+                } catch (IOException e) {\r
+                    Log.err(toolsConfFile + " Read Error ", e.getMessage());\r
+\r
+                }\r
+            if (toBak != null)\r
+                try {\r
+                    toBak.close();\r
+                } catch (IOException e) {\r
+                    Log.err(toolsConfFile + ".bak Write Error ", e.getMessage());\r
+                }\r
+        }\r
+    }\r
+\r
+    private void exit() {\r
+        this.setVisible(false);\r
+        if (bTarget != null) {\r
+            bTarget.dispose();\r
+        }\r
+    }\r
+}\r