Add check before adding msa file to spd file.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / packaging / ui / SpdMsaFiles.java
index b4ed73a3a55868961c133f373795efcc6c4ed4e2..efaf0ef53fcff072776094b3a0519974a29262c4 100644 (file)
@@ -333,7 +333,6 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
      */\r
     public void actionPerformed(ActionEvent arg0) {\r
         \r
-        docConsole.setSaved(false);\r
         if (arg0.getSource() == jButtonOk) {\r
             this.save();\r
             this.dispose();\r
@@ -350,9 +349,16 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
                 JOptionPane.showMessageDialog(this, "Msa File is NOT PathAndFilename type.");\r
                 return;\r
             }\r
+            \r
+            String dirPrefix = Tools.dirForNewSpd.substring(0, Tools.dirForNewSpd.lastIndexOf(File.separator));\r
+            if (!new File(dirPrefix + File.separator + jTextField.getText()).exists()) {\r
+                JOptionPane.showMessageDialog(this, "File NOT Exists in Current Package.");\r
+                return;\r
+            }\r
             model.addRow(row);\r
             jTable.changeSelection(model.getRowCount()-1, 0, false, false);\r
             sfc.genSpdMsaFiles(row[0], null, null, null);\r
+            docConsole.setSaved(false);\r
         }\r
         //\r
         // remove selected line\r
@@ -365,6 +371,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
             if (rowSelected >= 0) {\r
                 model.removeRow(rowSelected);\r
                 sfc.removeSpdMsaFile(rowSelected);\r
+                docConsole.setSaved(false);\r
             }\r
         }\r
 \r
@@ -374,6 +381,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{
             }\r
             model.setRowCount(0);\r
             sfc.removeSpdMsaFile();\r
+            docConsole.setSaved(false);\r
         }\r
 \r
     }\r