From 37bd8fbb213065a372745b48ed5003e411decd9b Mon Sep 17 00:00:00 2001 From: hche10x Date: Mon, 16 Oct 2006 08:17:20 +0000 Subject: [PATCH] 1. Fix EDKT408: Clone a library class does not copy the library head 2. Fix EDKT398: Wizard does not refresh work environment when clone a module or a library git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1757 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/frameworkwizard/Clone.java | 52 ++++++++++++++----- .../workspace/WorkspaceTools.java | 52 +++++++++++++++++++ 2 files changed, 91 insertions(+), 13 deletions(-) diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java index 3395434efd..6c9e25a31a 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java @@ -376,7 +376,8 @@ public class Clone extends IDialog { this.jLabelBelong.setEnabled(false); this.jComboBoxExistingPackage.setEnabled(false); this.jButtonBrowse.setVisible(false); - this.jTextFieldFilePath.setToolTipText("Input the package's relative path and file name, for example:
MdePkg\\MdePkg.spd"); + this.jTextFieldFilePath + .setToolTipText("Input the package's relative path and file name, for example:
MdePkg\\MdePkg.spd"); this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height); this.jLabelDestinationFile.setText("New Package Path and Filename"); } @@ -407,7 +408,8 @@ public class Clone extends IDialog { this.jButtonGenerateGuid.setEnabled(false); this.jLabelVersion.setEnabled(false); this.jTextFieldVersion.setEnabled(false); - this.jTextFieldFilePath.setToolTipText("Input the workspace path, for example:
C:\\MyWorkspace"); + this.jTextFieldFilePath + .setToolTipText("Input the workspace path, for example:
C:\\MyWorkspace"); this.jLabelDestinationFile.setText("New Workspace Path"); } } @@ -555,7 +557,9 @@ public class Clone extends IDialog { return false; } if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) { - Log.wrn("Clone", "Incorrect data type for the Name, it must
be a single word, starting with an alpha character."); + Log + .wrn("Clone", + "Incorrect data type for the Name, it must
be a single word, starting with an alpha character."); return false; } @@ -567,7 +571,10 @@ public class Clone extends IDialog { return false; } if (!DataValidation.isGuid(this.jTextFieldGuid.getText())) { - Log.wrn("Clone", "Incorrect data type for Guid, which must
be in registry format (8-4-4-4-12) for example:
d3adb123-eef1-466d-39ac-02febcaf5997"); + Log + .wrn( + "Clone", + "Incorrect data type for Guid, which must
be in registry format (8-4-4-4-12) for example:
d3adb123-eef1-466d-39ac-02febcaf5997"); return false; } @@ -579,7 +586,10 @@ public class Clone extends IDialog { return false; } if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) { - Log.wrn("Clone", "Incorrect data type for Version, which must
be one or more digits, optionally followed by sequence
of one or more dot, one or more digits; examples:
1.0 1.0.1 12.25.256"); + Log + .wrn( + "Clone", + "Incorrect data type for Version, which must
be one or more digits, optionally followed by sequence
of one or more dot, one or more digits; examples:
1.0 1.0.1 12.25.256"); return false; } @@ -726,13 +736,29 @@ public class Clone extends IDialog { newId.setPath(trg); vFiles = wt.getAllFilesPathOfModule(src); + String oldPackagePath = GlobalData.openingModuleList.getIdByPath(src).getPackageId().getPath(); + String newPackagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath(); + // // First copy all files to new directory // FileOperation.copyFile(src, trg); for (int index = 1; index < vFiles.size(); index++) { String oldFile = vFiles.get(index); - String newFile = vFiles.get(index).replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg)); + String newFile = ""; + if (oldFile.indexOf(Tools.getFilePathOnly(src)) > -1) { + // + // The file is not include header + // + newFile = oldFile.replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg)); + } else if (oldFile.indexOf(Tools.getFilePathOnly(oldPackagePath)) > -1) { + // + // The file is include header + // + newFile = oldFile.replace(Tools.getFilePathOnly(oldPackagePath), + Tools.getFilePathOnly(newPackagePath)); + } + FileOperation.copyFile(oldFile, newFile); } @@ -753,7 +779,7 @@ public class Clone extends IDialog { // Update Section // updateModuleClonedId(msa, oldId); - + // // Save to file // @@ -775,7 +801,7 @@ public class Clone extends IDialog { // Update the db file // wt.addModuleToPackage(mid, psa); - + // // Update GlobalData // @@ -838,20 +864,20 @@ public class Clone extends IDialog { // Update the db file // wt.addPackageToDatabase(pid); - + // // Update GlobalData // GlobalData.vPackageList.addElement(pid); GlobalData.openingPackageList.insertToOpeningPackageList(pid, spd); - + // // Add all cloned modules // Vector modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath()); String modulePath = null; ModuleSurfaceArea msa = null; - + for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) { try { modulePath = modulePaths.get(indexJ); @@ -871,7 +897,7 @@ public class Clone extends IDialog { GlobalData.vModuleList.addElement(mid); GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa); } - + this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA; } @@ -908,7 +934,7 @@ public class Clone extends IDialog { // Update the db file // wt.addPlatformToDatabase(fid); - + // // Update GlobalData // diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java index 4e40d59efc..dedbdddf20 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java @@ -23,6 +23,8 @@ import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlException; import org.tianocore.DbPathAndFilename; import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes; +import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations; +import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea; import org.tianocore.MsaFilesDocument.MsaFiles; import org.tianocore.PackageDependenciesDocument.PackageDependencies; @@ -676,6 +678,10 @@ public class WorkspaceTools { msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn); spd.setMsaFiles(msaFile); SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd); + // + // Update GlobalData + // + GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()).setMsaFiles(msaFile); } /** @@ -733,10 +739,18 @@ public class WorkspaceTools { public Vector getAllFilesPathOfModule(String path) { Vector v = new Vector(); path = Tools.convertPathToCurrentOsType(path); + + // + // First add msa file's path + // v.addElement(path); + ModuleSurfaceArea msa = GlobalData.openingModuleList .getModuleSurfaceAreaFromId(GlobalData.openingModuleList .getIdByPath(path)); + // + // Get common defined files of module + // if (msa != null) { // // Get all files' path of a module @@ -751,6 +765,44 @@ public class WorkspaceTools { } } + // + // Get include header files for this module + // + if (msa.getLibraryClassDefinitions() != null) { + LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions(); + for (int index = 0; index < lcd.sizeOfLibraryClassArray(); index++) { + if (lcd.getLibraryClassList().get(index).getUsage().toString() + .equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED) + || lcd.getLibraryClassList().get(index).getUsage().toString() + .equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) { + // + // Get library class name + // + String name = lcd.getLibraryClassList().get(index).getKeyword(); + + // + // Find file path for this class + // + PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId(); + PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid); + if (spd != null) { + if (spd.getLibraryClassDeclarations() != null) { + LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations(); + for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) { + if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) { + v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath()) + + DataType.FILE_SEPARATOR + + lcdl.getLibraryClassList() + .get(indexOfLibOfSpd) + .getIncludeHeader())); + } + } + } + } + } + } + } + return v; } -- 2.39.2