summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-15 09:13:04 +0000
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-15 09:13:04 +0000
commitac66fadf6fae5f54b17fb50728a82ffb32b829fa (patch)
tree2151b95e7f2bc12c453cb67c0febe5049075207a /Tools
parent78388089937561fb1478467c39a20fecd326f015 (diff)
downloadedk2-ac66fadf6fae5f54b17fb50728a82ffb32b829fa.zip
edk2-ac66fadf6fae5f54b17fb50728a82ffb32b829fa.tar.gz
edk2-ac66fadf6fae5f54b17fb50728a82ffb32b829fa.tar.bz2
remove comments before ModuleSA and library instance , if any, in xml file when deleting a module or instance from FPD file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1545 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java32
-rw-r--r--Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java31
2 files changed, 52 insertions, 11 deletions
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
index 946a6b6..b89f967 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
@@ -70,6 +70,7 @@ import org.tianocore.frameworkwizard.packaging.PackageIdentification;
public class FpdFileContents {
static final String xmlNs = "http://www.TianoCore.org/2006/Edk2.0";
+ static final String regNewLineAndSpaces = "((\n)|(\r\n)|(\r)|(\u0085)|(\u2028)|(\u2029))(\\s)*";
private PlatformSurfaceAreaDocument fpdd = null;
@@ -345,10 +346,21 @@ public class FpdFileContents {
}
cursor.push();
- cursor.toPrevToken();
+ while (cursor.hasPrevToken()) {
+ cursor.toPrevToken();
+ if (!cursor.isText()) {
+ break;
+ }
+ String s = cursor.getTextValue();
+ if (s.matches(regNewLineAndSpaces)) {
+ continue;
+ }
+ }
+
if (cursor.isComment()) {
cursor.removeXml();
}
+
cursor.pop();
cursor.removeXml();
if (getFrameworkModulesCount() == 0) {
@@ -655,6 +667,7 @@ public class FpdFileContents {
ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);
if (moduleSA.getPcdBuildDefinition() != null) {
XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
+ cursor.push();
if (cursor.toFirstChild()) {
do {
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor
@@ -669,6 +682,11 @@ public class FpdFileContents {
}
} while (cursor.toNextSibling());
}
+
+ cursor.pop();
+ if (moduleSA.getPcdBuildDefinition().getPcdDataList().size() == 0) {
+ cursor.removeXml();
+ }
cursor.dispose();
}
}
@@ -718,7 +736,17 @@ public class FpdFileContents {
cursor.toNextSibling();
}
cursor.push();
- cursor.toPrevToken();
+ while (cursor.hasPrevToken()) {
+ cursor.toPrevToken();
+ if (!cursor.isText()) {
+ break;
+ }
+ String s = cursor.getTextValue();
+ if (s.matches(regNewLineAndSpaces)) {
+ continue;
+ }
+ }
+
if (cursor.isComment()) {
cursor.removeXml();
}
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
index b831703..57af40e 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
@@ -614,7 +614,7 @@ public class FpdFrameworkModules extends IInternalFrame {
if (selectedRow < 0) {
return;
}
- docConsole.setSaved(false);
+
TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
selectedRow = sorter.getModelRowIndex(selectedRow);
@@ -627,22 +627,35 @@ public class FpdFrameworkModules extends IInternalFrame {
String pv = sa[ffcPkgVer];
String arch = sa[ffcModArch];
ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);
- mv = mi.getVersion();
- pv = mi.getPackageId().getVersion();
- modelFpdModules.removeRow(selectedRow);
+ if (mi != null) {
+ mv = mi.getVersion();
+ pv = mi.getPackageId().getVersion();
+ }
+
+ try {
+ ffc.removeModuleSA(selectedRow);
+ }
+ catch (Exception exp) {
+ JOptionPane.showMessageDialog(frame, exp.getCause() + exp.getMessage());
+ return;
+ }
+
if (arch == null) {
// if no arch specified in ModuleSA
fpdMsa.remove(mg + mv + pg + pv);
} else {
ArrayList<String> al = fpdMsa.get(mg + mv + pg + pv);
- al.remove(arch);
- if (al.size() == 0) {
- fpdMsa.remove(mg + mv + pg + pv);
+ if (al != null) {
+ al.remove(arch);
+ if (al.size() == 0) {
+ fpdMsa.remove(mg + mv + pg + pv);
+ }
}
}
-
- ffc.removeModuleSA(selectedRow);
+
+ modelFpdModules.removeRow(selectedRow);
+ docConsole.setSaved(false);
}
});
}