<Filename>src/org/tianocore/frameworkwizard/common/DataValidation.java</Filename>\r
<Filename>src/org/tianocore/frameworkwizard/common/EnumerationData.java</Filename>\r
<Filename>src/org/tianocore/frameworkwizard/common/FileOperation.java</Filename>\r
+ <Filename>src/org/tianocore/frameworkwizard/common/GlobalData.java</Filename>\r
<Filename>src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java</Filename>\r
<Filename>src/org/tianocore/frameworkwizard/common/IFileFilter.java</Filename>\r
<Filename>src/org/tianocore/frameworkwizard/common/Log.java</Filename>\r
//\r
trg = getModulePath();\r
newId.setPath(trg);\r
- vFiles = wt.getAllModuleFilesPath(src);\r
+ vFiles = wt.getAllFilesPathOfModule(src);\r
\r
//\r
// First copy all files to new directory\r
//\r
trg = this.getPackagePath();\r
newId.setPath(trg);\r
- vFiles = wt.getAllPakcageFilesPath(src);\r
+ vFiles = wt.getAllFilesPathOfPakcage(src);\r
\r
//\r
// First copy all files to new directory\r
import javax.swing.event.TreeSelectionListener;\r
\r
import org.apache.xmlbeans.XmlException;\r
-import org.tianocore.ModuleSurfaceAreaDocument;\r
import org.tianocore.PackageSurfaceAreaDocument;\r
-import org.tianocore.PlatformSurfaceAreaDocument;\r
import org.tianocore.frameworkwizard.common.DataType;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
import org.tianocore.frameworkwizard.common.IFileFilter;\r
import org.tianocore.frameworkwizard.common.Log;\r
-import org.tianocore.frameworkwizard.common.OpenFile;\r
import org.tianocore.frameworkwizard.common.SaveFile;\r
import org.tianocore.frameworkwizard.common.Tools;\r
import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleList;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageList;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformList;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
import org.tianocore.frameworkwizard.common.ui.IDefaultMutableTreeNode;\r
import org.tianocore.frameworkwizard.common.ui.IDesktopManager;\r
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
import org.tianocore.frameworkwizard.module.ui.ModuleBootModes;\r
import org.tianocore.frameworkwizard.module.ui.ModuleDataHubs;\r
-import org.tianocore.frameworkwizard.module.ui.ModuleDefinitions;\r
import org.tianocore.frameworkwizard.module.ui.ModuleEvents;\r
import org.tianocore.frameworkwizard.module.ui.ModuleExterns;\r
import org.tianocore.frameworkwizard.module.ui.ModuleGuids;\r
private static final long serialVersionUID = -7103240960573031772L;\r
\r
///\r
- /// Used to save information of all files\r
+ /// Used to record current operation target\r
///\r
- private Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();\r
-\r
- private Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();\r
-\r
- private Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();\r
-\r
- private OpeningModuleList openingModuleList = new OpeningModuleList();\r
-\r
- private OpeningPackageList openingPackageList = new OpeningPackageList();\r
-\r
- private OpeningPlatformList openingPlatformList = new OpeningPlatformList();\r
-\r
private int currentOpeningModuleIndex = -1;\r
\r
private int currentOpeningPackageIndex = -1;\r
System.exit(0);\r
}\r
\r
+ //\r
+ // Init Global Data\r
+ //\r
+ GlobalData.init();\r
+\r
+ //\r
+ // Init the frame\r
+ //\r
this.setSize(DataType.MAIN_FRAME_PREFERRED_SIZE_WIDTH, DataType.MAIN_FRAME_PREFERRED_SIZE_HEIGHT);\r
this.setResizable(true);\r
this.setJMenuBar(getjJMenuBar());\r
this.addComponentListener(this);\r
- this.getCompontentsFromFrameworkDatabase();\r
this.setContentPane(getJContentPane());\r
this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["\r
+ Workspace.getCurrentWorkspace() + "]");\r
//\r
// First add package\r
//\r
- if (this.vPackageList.size() > 0) {\r
- for (int index = 0; index < this.vPackageList.size(); index++) {\r
+ if (GlobalData.vPackageList.size() > 0) {\r
+ for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
IDefaultMutableTreeNode dmtnModulePackage = null;\r
IDefaultMutableTreeNode dmtnModulePackageLibrary = null;\r
IDefaultMutableTreeNode dmtnModulePackageModule = null;\r
\r
- dmtnModulePackage = new IDefaultMutableTreeNode(this.vPackageList.elementAt(index).getName(),\r
+ dmtnModulePackage = new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index).getName(),\r
IDefaultMutableTreeNode.MODULE_PACKAGE, false,\r
- this.vPackageList.elementAt(index));\r
+ GlobalData.vPackageList.elementAt(index));\r
dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",\r
IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,\r
- false, this.vPackageList.elementAt(index));\r
+ false, GlobalData.vPackageList.elementAt(index));\r
dmtnModulePackageModule = new IDefaultMutableTreeNode("Module",\r
IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,\r
- false, this.vPackageList.elementAt(index));\r
+ false, GlobalData.vPackageList.elementAt(index));\r
//\r
// And then add each module in its package\r
//\r
- Vector<ModuleIdentification> vModule = wt.getAllModules(this.vPackageList.elementAt(index));\r
+ Vector<ModuleIdentification> vModule = wt.getAllModules(GlobalData.vPackageList.elementAt(index));\r
for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {\r
if (vModule.get(indexJ).isLibrary()) {\r
dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),\r
- IDefaultMutableTreeNode.MODULE,\r
- false, vModule.get(indexJ)));\r
+ IDefaultMutableTreeNode.MODULE, false,\r
+ vModule.get(indexJ)));\r
} else {\r
dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),\r
- IDefaultMutableTreeNode.MODULE,\r
- false, vModule.get(indexJ)));\r
+ IDefaultMutableTreeNode.MODULE, false,\r
+ vModule.get(indexJ)));\r
}\r
}\r
if (dmtnModulePackageModule.getChildCount() > 0) {\r
// Make Package Description\r
//\r
dmtnPackageDescription = new IDefaultMutableTreeNode("PackageDescription", IDefaultMutableTreeNode.PACKAGE, -1);\r
- if (this.vPackageList.size() > 0) {\r
- for (int index = 0; index < this.vPackageList.size(); index++) {\r
- dmtnPackageDescription.add(new IDefaultMutableTreeNode(this.vPackageList.elementAt(index).getName(),\r
+ if (GlobalData.vPackageList.size() > 0) {\r
+ for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+ dmtnPackageDescription.add(new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index)\r
+ .getName(),\r
IDefaultMutableTreeNode.PACKAGE, false,\r
- this.vPackageList.elementAt(index)));\r
+ GlobalData.vPackageList.elementAt(index)));\r
}\r
}\r
\r
//\r
dmtnPlatformDescription = new IDefaultMutableTreeNode("PlatformDescription", IDefaultMutableTreeNode.PLATFORM,\r
-1);\r
- if (this.vPlatformList.size() > 0) {\r
- for (int index = 0; index < this.vPlatformList.size(); index++) {\r
- dmtnPlatformDescription.add(new IDefaultMutableTreeNode(this.vPlatformList.elementAt(index).getName(),\r
- IDefaultMutableTreeNode.PLATFORM,\r
- false, this.vPlatformList.elementAt(index)));\r
+ if (GlobalData.vPlatformList.size() > 0) {\r
+ for (int index = 0; index < GlobalData.vPlatformList.size(); index++) {\r
+ dmtnPlatformDescription.add(new IDefaultMutableTreeNode(GlobalData.vPlatformList.elementAt(index)\r
+ .getName(),\r
+ IDefaultMutableTreeNode.PLATFORM, false,\r
+ GlobalData.vPlatformList.elementAt(index)));\r
}\r
}\r
\r
//\r
// Add new MsaHeader node to the tree\r
//\r
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MSA_HEADER,\r
+ IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MODULE,\r
true, mid);\r
//\r
// First find the module belongs to which package\r
}\r
}\r
\r
- /**\r
- Open Module\r
-\r
- @param path input file path\r
- \r
- **/\r
- private void openModule(String path, ModuleIdentification moduleId) {\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
- try {\r
- msa = OpenFile.openMsaFile(path);\r
- } catch (IOException e) {\r
- Log.wrn("Open Module Surface Area " + path, e.getMessage());\r
- Log.err("Open Module Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.wrn("Open Module Surface Area " + path, e.getMessage());\r
- Log.err("Open Module Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.wrn("Open Module Surface Area " + path, "Invalid file type");\r
- Log.err("Open Module Surface Area " + path, "Invalid file type");\r
- return;\r
- }\r
- Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(),\r
- msa.getMsaHeader().getVersion(), path);\r
- //\r
- // Generate module id\r
- //\r
- PackageIdentification pid = wt.getPackageIdByModuleId(id);\r
- if (pid != null) {\r
- //\r
- // To judge if the module existed in vModuleList\r
- // If not, add it to vModuleList\r
- //\r
- boolean isFind = false;\r
- for (int index = 0; index < vModuleList.size(); index++) {\r
- if (vModuleList.elementAt(index).equals(id)) {\r
- isFind = true;\r
- break;\r
- }\r
- }\r
- if (!isFind) {\r
- ModuleIdentification mid = new ModuleIdentification(id, pid, moduleId.isLibrary());\r
- vModuleList.addElement(mid);\r
- addModuleToTree(mid);\r
- }\r
- } else {\r
- //\r
- // The module is not in existing packages\r
- //\r
- Log.err("The module hasn't been added to any package of current workspace!");\r
- return;\r
- }\r
-\r
- //\r
- // Make the node selected\r
- //\r
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,\r
- IDefaultMutableTreeNode.MODULE)));\r
- //\r
- // Update opening Module list information\r
- //\r
- if (!openingModuleList.existsModule(id)) {\r
- //\r
- // Insert sub node of module\r
- //\r
- insertModuleTreeNode(id);\r
- iTree.getSelectNode().setOpening(true);\r
-\r
- //\r
- // Update opening module list\r
- //\r
- openingModuleList.insertToOpeningModuleList(id, msa);\r
- openingModuleList.setTreePathById(id, iTree.getSelectionPath());\r
- }\r
- //\r
- // Select msa header node and show it in editor panel\r
- //\r
- iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,\r
- IDefaultMutableTreeNode.MSA_HEADER)));\r
- showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id));\r
- this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id);\r
- }\r
-\r
/**\r
Open Module\r
\r
\r
**/\r
private void openModule(String path) {\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
- try {\r
- msa = OpenFile.openMsaFile(path);\r
- } catch (IOException e) {\r
- Log.wrn("Open Module Surface Area " + path, e.getMessage());\r
- Log.err("Open Module Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.wrn("Open Module Surface Area " + path, e.getMessage());\r
- Log.err("Open Module Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.wrn("Open Module Surface Area " + path, "Invalid file type");\r
- Log.err("Open Module Surface Area " + path, "Invalid file type");\r
- return;\r
- }\r
- Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(),\r
- msa.getMsaHeader().getVersion(), path);\r
- //\r
- // Generate module id\r
- //\r
- PackageIdentification pid = wt.getPackageIdByModuleId(id);\r
- if (pid != null) {\r
- //\r
- // To judge if the module existed in vModuleList\r
- // If not, add it to vModuleList\r
- //\r
- boolean isFind = false;\r
- for (int index = 0; index < vModuleList.size(); index++) {\r
- if (vModuleList.elementAt(index).equals(id)) {\r
- isFind = true;\r
- break;\r
- }\r
- }\r
- if (!isFind) {\r
- ModuleIdentification mid = new ModuleIdentification(id, pid);\r
- vModuleList.addElement(mid);\r
- addModuleToTree(mid);\r
- }\r
- } else {\r
+ ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(path);\r
+ if (id == null) {\r
//\r
// The module is not in existing packages\r
//\r
//\r
// Update opening Module list information\r
//\r
- if (!openingModuleList.existsModule(id)) {\r
+ if (!GlobalData.openingModuleList.getModuleOpen(id)) {\r
//\r
// Insert sub node of module\r
//\r
//\r
// Update opening module list\r
//\r
- openingModuleList.insertToOpeningModuleList(id, msa);\r
- openingModuleList.setTreePathById(id, iTree.getSelectionPath());\r
+ GlobalData.openingModuleList.setModuleOpen(id, true);\r
+ GlobalData.openingModuleList.setTreePathById(id, iTree.getSelectionPath());\r
}\r
//\r
// Select msa header node and show it in editor panel\r
//\r
iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,\r
IDefaultMutableTreeNode.MSA_HEADER)));\r
- showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id));\r
- this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id);\r
+ showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, GlobalData.openingModuleList.getOpeningModuleById(id));\r
+ this.currentOpeningModuleIndex = GlobalData.openingModuleList.findIndexOfListById(id);\r
}\r
\r
/**\r
\r
**/\r
private void openPackage(String path) {\r
- PackageSurfaceAreaDocument.PackageSurfaceArea spd = null;\r
- try {\r
- spd = OpenFile.openSpdFile(path);\r
- } catch (IOException e) {\r
- Log.wrn("Open Package Surface Area " + path, e.getMessage());\r
- Log.err("Open Package Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.wrn("Open Package Surface Area " + path, e.getMessage());\r
- Log.err("Open Package Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.wrn("Open Package Surface Area " + path, "Invalid file type");\r
- Log.err("Open Package Surface Area " + path, "Invalid file type");\r
- return;\r
- }\r
- Identification id = new Identification(spd.getSpdHeader().getPackageName(), spd.getSpdHeader().getGuidValue(),\r
- spd.getSpdHeader().getVersion(), path);\r
- //\r
- // To judge if the package existed in vPackageList\r
- // If not, add it to vPackageList\r
- //\r
- boolean isFind = false;\r
- for (int index = 0; index < vPackageList.size(); index++) {\r
- if (vPackageList.elementAt(index).equals(id)) {\r
- isFind = true;\r
- break;\r
- }\r
- }\r
- if (!isFind) {\r
+ PackageIdentification id = GlobalData.openingPackageList.getIdByPath(path);\r
+ if (id == null) {\r
//\r
- // The module is not in existing packages\r
+ // The package is not in current workspace\r
//\r
Log.wrn("Open Package", "The package hasn't been added to current workspace!");\r
return;\r
//\r
// Update opening package list information\r
//\r
- if (!openingPackageList.existsPackage(id)) {\r
+ if (!GlobalData.openingPackageList.getPackageOpen(id)) {\r
//\r
// Insert sub node of module\r
//\r
//\r
// Update opening module list\r
//\r
- openingPackageList.insertToOpeningPackageList(id, spd);\r
- openingPackageList.setTreePathById(id, iTree.getSelectionPath());\r
+ GlobalData.openingPackageList.setPackageOpen(id, true);\r
+ GlobalData.openingPackageList.setTreePathById(id, iTree.getSelectionPath());\r
}\r
//\r
// Show spd header in editor panel\r
//\r
iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id,\r
IDefaultMutableTreeNode.SPD_HEADER)));\r
- showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, openingPackageList.getOpeningPackageById(id));\r
- this.currentOpeningPackageIndex = openingPackageList.findIndexOfListById(id);\r
+ showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, GlobalData.openingPackageList.getOpeningPackageById(id));\r
+ this.currentOpeningPackageIndex = GlobalData.openingPackageList.findIndexOfListById(id);\r
}\r
\r
/**\r
\r
**/\r
private void openPlatform(String path) {\r
- PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd = null;\r
- try {\r
- fpd = OpenFile.openFpdFile(path);\r
- } catch (IOException e) {\r
- Log.wrn("Open Platform Surface Area " + path, e.getMessage());\r
- Log.err("Open Platform Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.wrn("Open Platform Surface Area " + path, e.getMessage());\r
- Log.err("Open Platform Surface Area " + path, e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.wrn("Open Platform Surface Area " + path, "Invalid file type");\r
- Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
- return;\r
- }\r
- Identification id = new Identification(fpd.getPlatformHeader().getPlatformName(), fpd.getPlatformHeader()\r
- .getGuidValue(),\r
- fpd.getPlatformHeader().getVersion(), path);\r
- //\r
- // To judge if the platform existed in vPlatformList\r
- // If not, add it to vPlatformList\r
- //\r
- boolean isFind = false;\r
- for (int index = 0; index < vPlatformList.size(); index++) {\r
- if (vPlatformList.elementAt(index).equals(id)) {\r
- isFind = true;\r
- break;\r
- }\r
- }\r
- if (!isFind) {\r
+ PlatformIdentification id = GlobalData.openingPlatformList.getIdByPath(path);\r
+ if (id == null) {\r
//\r
- // The module is not in existing packages\r
+ // The platform is not in current workspace\r
//\r
Log.wrn("Open Platform", "The platform hasn't been added to current workspace!");\r
return;\r
//\r
// Update opening package list information\r
//\r
- if (!openingPlatformList.existsPlatform(id)) {\r
+ if (!GlobalData.openingPlatformList.getPlatformOpen(id)) {\r
//\r
// Insert sub node of module\r
//\r
//\r
// Update opening module list\r
//\r
- openingPlatformList.insertToOpeningPlatformList(id, fpd);\r
- openingPlatformList.setTreePathById(id, iTree.getSelectionPath());\r
+ GlobalData.openingPlatformList.setPlatformOpen(id, true);\r
+ GlobalData.openingPlatformList.setTreePathById(id, iTree.getSelectionPath());\r
}\r
//\r
// Show fpd header in editor panel\r
//\r
iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id,\r
IDefaultMutableTreeNode.FPD_PLATFORMHEADER)));\r
- showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER, openingPlatformList.getOpeningPlatformById(id));\r
- this.currentOpeningPlatformIndex = openingPlatformList.findIndexOfListById(id);\r
+ showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER,\r
+ GlobalData.openingPlatformList.getOpeningPlatformById(id));\r
+ this.currentOpeningPlatformIndex = GlobalData.openingPlatformList.findIndexOfListById(id);\r
}\r
\r
/**\r
\r
**/\r
private void saveModule(int index) {\r
- OpeningModuleType omt = openingModuleList.getOpeningModuleByIndex(index);\r
+ OpeningModuleType omt = GlobalData.openingModuleList.getOpeningModuleByIndex(index);\r
if (omt.isNew()) {\r
if (getNewFilePath(DataType.MODULE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {\r
return;\r
}\r
try {\r
SaveFile.saveMsaFile(omt.getId().getPath(), omt.getXmlMsa());\r
- openingModuleList.setNew(omt.getId(), false);\r
- openingModuleList.setModuleSaved(omt.getId(), true);\r
+ GlobalData.openingModuleList.setNew(omt.getId(), false);\r
+ GlobalData.openingModuleList.setModuleSaved(omt.getId(), true);\r
} catch (Exception e) {\r
Log.wrn("Save Module", e.getMessage());\r
Log.err("Save Module", e.getMessage());\r
\r
**/\r
private void savePackage(int index) {\r
- OpeningPackageType opt = openingPackageList.getOpeningPackageByIndex(index);\r
+ OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);\r
if (opt.isNew()) {\r
if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {\r
return;\r
}\r
try {\r
SaveFile.saveSpdFile(opt.getId().getPath(), opt.getXmlSpd());\r
- openingPackageList.setNew(opt.getId(), false);\r
- openingPackageList.setPackageSaved(opt.getId(), true);\r
+ GlobalData.openingPackageList.setNew(opt.getId(), false);\r
+ GlobalData.openingPackageList.setPackageSaved(opt.getId(), true);\r
} catch (Exception e) {\r
Log.wrn("Save Package", e.getMessage());\r
Log.err("Save Package", e.getMessage());\r
\r
**/\r
private void savePlatform(int index) {\r
- OpeningPlatformType opt = openingPlatformList.getOpeningPlatformByIndex(index);\r
+ OpeningPlatformType opt = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index);\r
if (opt.isNew()) {\r
if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) {\r
return;\r
}\r
try {\r
SaveFile.saveFpdFile(opt.getId().getPath(), opt.getXmlFpd());\r
- openingPlatformList.setNew(opt.getId(), false);\r
- openingPlatformList.setPlatformSaved(opt.getId(), true);\r
+ GlobalData.openingPlatformList.setNew(opt.getId(), false);\r
+ GlobalData.openingPlatformList.setPlatformSaved(opt.getId(), true);\r
} catch (Exception e) {\r
Log.wrn("Save Package", e.getMessage());\r
Log.err("Save Package", e.getMessage());\r
}\r
}\r
\r
- private void getCompontentsFromFrameworkDatabase() {\r
- this.vModuleList = wt.getAllModules();\r
- this.vPackageList = wt.getAllPackages();\r
- this.vPlatformList = wt.getAllPlatforms();\r
- }\r
-\r
private void insertModuleTreeNode(Identification id) {\r
iTree.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode.MSA_HEADER, true, id));\r
- iTree.addNode(new IDefaultMutableTreeNode("Module Definitions", IDefaultMutableTreeNode.MSA_MODULEDEFINITIONS,\r
- true, id));\r
+ iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id));\r
iTree.addNode(new IDefaultMutableTreeNode("Library Class Definitions",\r
IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS, true, id));\r
- iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id));\r
iTree.addNode(new IDefaultMutableTreeNode("Package Dependencies",\r
IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES, true, id));\r
iTree.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode.MSA_PROTOCOLS, true, id));\r
\r
private void insertPackageTreeNode(Identification id) {\r
iTree.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode.SPD_HEADER, true, id));\r
- iTree.addNode(new IDefaultMutableTreeNode("Package Definitions",\r
- IDefaultMutableTreeNode.SPD_PACKAGEDEFINITIONS, true, id));\r
iTree.addNode(new IDefaultMutableTreeNode("Library Class Declarations",\r
IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS, true, id));\r
iTree.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode.SPD_MSAFILES, false, id));\r
id = iTree.getSelectNode().getId();\r
intCategory = iTree.getSelectCategory();\r
isOpen = iTree.getSelectNode().isOpening();\r
- \r
+\r
if (!isOpen) {\r
// \r
// If the node is not opened yet\r
return;\r
}\r
}\r
- \r
+\r
//\r
// Show editor panel\r
//\r
if (intCategory >= IDefaultMutableTreeNode.MSA_HEADER && intCategory < IDefaultMutableTreeNode.SPD_HEADER) {\r
- showModuleElement(intCategory, openingModuleList.getOpeningModuleById(id));\r
- this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id);\r
+ showModuleElement(intCategory,\r
+ GlobalData.openingModuleList.getOpeningModuleById(new ModuleIdentification(id)));\r
+ this.currentOpeningModuleIndex = GlobalData.openingModuleList\r
+ .findIndexOfListById(new ModuleIdentification(\r
+ id));\r
}\r
if (intCategory >= IDefaultMutableTreeNode.SPD_HEADER\r
&& intCategory < IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {\r
- showPackageElement(intCategory, openingPackageList.getOpeningPackageById(id));\r
- this.currentOpeningPackageIndex = openingPackageList.findIndexOfListById(id);\r
+ showPackageElement(intCategory,\r
+ GlobalData.openingPackageList.getOpeningPackageById(new PackageIdentification(id)));\r
+ this.currentOpeningPackageIndex = GlobalData.openingPackageList\r
+ .findIndexOfListById(new PackageIdentification(\r
+ id));\r
}\r
if (intCategory >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {\r
- showPlatformElement(intCategory, openingPlatformList.getOpeningPlatformById(id));\r
- this.currentOpeningPlatformIndex = openingPlatformList.findIndexOfListById(id);\r
+ showPlatformElement(\r
+ intCategory,\r
+ GlobalData.openingPlatformList\r
+ .getOpeningPlatformById(new PlatformIdentification(id)));\r
+ this.currentOpeningPlatformIndex = GlobalData.openingPlatformList\r
+ .findIndexOfListById(new PlatformIdentification(\r
+ id));\r
}\r
} catch (RuntimeException e) {\r
- Log.log("double click category: " + intCategory);\r
- Log.log("double click id path: " + id);\r
- Log.log("double click exception: " + e.getMessage());\r
+ Log.err("double click category: " + intCategory);\r
+ Log.err("double click id path: " + id);\r
+ Log.err("double click exception: " + e.getMessage());\r
}\r
}\r
\r
MsaHeader frmMsaHeader = new MsaHeader(msa);\r
getJDesktopPaneModule().add(frmMsaHeader, 1);\r
break;\r
- case IDefaultMutableTreeNode.MSA_MODULEDEFINITIONS:\r
- ModuleDefinitions frmMd = new ModuleDefinitions(msa);\r
- getJDesktopPaneModule().add(frmMd, 1);\r
- break;\r
case IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS:\r
ModuleLibraryClassDefinitions frmMlcd = new ModuleLibraryClassDefinitions(msa);\r
getJDesktopPaneModule().add(frmMlcd, 1);\r
smb.dispose();\r
return;\r
} else if (result == DataType.RETURN_TYPE_OK) {\r
- PackageSurfaceAreaDocument.PackageSurfaceArea psa = null;\r
- if (this.openingPackageList.existsPackage(smb.getMid().getPackageId())) {\r
- psa = openingPackageList.getPackageSurfaceAreaFromId(smb.getMid().getPackageId());\r
- }\r
- try {\r
- wt.addModuleToPackage(smb.getMid(), psa);\r
- } catch (IOException e) {\r
- Log.wrn("Upddate MsaFiles of Package", e.getMessage());\r
- Log.err("Upddate MsaFiles of Package", e.getMessage());\r
- return;\r
- } catch (XmlException e) {\r
- Log.wrn("Upddate MsaFiles of Package", e.getMessage());\r
- Log.err("Upddate MsaFiles of Package", e.getMessage());\r
- return;\r
- } catch (Exception e) {\r
- Log.wrn("Upddate MsaFiles of Package", e.getMessage());\r
- Log.err("Upddate MsaFiles of Package", e.getMessage());\r
- return;\r
+ ModuleIdentification mid = smb.getMid();\r
+ if (mid != null) {\r
+ //\r
+ // Update package of workspace first\r
+ //\r
+ PackageSurfaceAreaDocument.PackageSurfaceArea psa = null;\r
+ if (GlobalData.openingPackageList.existsPackage(mid.getPackageId())) {\r
+ psa = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId());\r
+ }\r
+ try {\r
+ wt.addModuleToPackage(mid, psa);\r
+ } catch (IOException e) {\r
+ Log.wrn("Upddate MsaFiles of Package", e.getMessage());\r
+ Log.err("Upddate MsaFiles of Package", e.getMessage());\r
+ return;\r
+ } catch (XmlException e) {\r
+ Log.wrn("Upddate MsaFiles of Package", e.getMessage());\r
+ Log.err("Upddate MsaFiles of Package", e.getMessage());\r
+ return;\r
+ } catch (Exception e) {\r
+ Log.wrn("Upddate MsaFiles of Package", e.getMessage());\r
+ Log.err("Upddate MsaFiles of Package", e.getMessage());\r
+ return;\r
+ }\r
+ \r
+ //\r
+ // Update Global Data\r
+ //\r
+ GlobalData.openingModuleList.insertToOpeningModuleList(mid, smb.getMsa());\r
+ GlobalData.vModuleList.addElement(mid);\r
+ \r
+ //\r
+ // Create new node on the tree\r
+ //\r
+ addModuleToTree(mid);\r
+ \r
+ //\r
+ // Open the node\r
+ //\r
+ this.openModule(mid.getPath());\r
}\r
- this.openModule(smb.getMid().getPath(), smb.getMid());\r
}\r
} else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
//\r
smb.dispose();\r
return;\r
} else if (result == DataType.RETURN_TYPE_OK) {\r
- try {\r
- wt.addPackageToDatabase(smb.getPid());\r
- } catch (Exception e) {\r
- Log.err("addPackageToDatabase", e.getMessage());\r
- }\r
- vPackageList.addElement(smb.getPid());\r
+ PackageIdentification pid = smb.getPid();\r
+ if (pid != null) {\r
+ try {\r
+ wt.addPackageToDatabase(smb.getPid());\r
+ } catch (Exception e) {\r
+ Log.err("addPackageToDatabase", e.getMessage());\r
+ }\r
\r
- //\r
- // Add to Module Description node\r
- //\r
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPackageList.lastElement().getName(),\r
- IDefaultMutableTreeNode.MODULE_PACKAGE,\r
- false, vPackageList.lastElement());\r
+ //\r
+ // Update Global Data\r
+ //\r
+ GlobalData.openingPackageList.insertToOpeningPackageList(pid, smb.getSpd());\r
+ GlobalData.vPackageList.addElement(pid);\r
\r
- iTree.addNode(dmtnModuleDescription, node);\r
+ //\r
+ // Add to Module Description node\r
+ //\r
+ IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(pid.getName(),\r
+ IDefaultMutableTreeNode.MODULE_PACKAGE,\r
+ false, pid);\r
\r
- //\r
- // Add new SpdHeader node to the tree\r
- //\r
- node = new IDefaultMutableTreeNode(vPackageList.lastElement().getName(),\r
- IDefaultMutableTreeNode.SPD_HEADER, true, vPackageList.lastElement());\r
- iTree.addNode(dmtnPackageDescription, node);\r
+ iTree.addNode(dmtnModuleDescription, node);\r
+\r
+ //\r
+ // Add new SpdHeader node to the tree\r
+ //\r
+ node = new IDefaultMutableTreeNode(pid.getName(), IDefaultMutableTreeNode.PACKAGE, true, pid);\r
+ iTree.addNode(dmtnPackageDescription, node);\r
\r
- this.openPackage(smb.getPid().getPath());\r
+ this.openPackage(pid.getPath());\r
+ }\r
}\r
} else if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
//\r
smb.dispose();\r
return;\r
} else if (result == DataType.RETURN_TYPE_OK) {\r
- try {\r
- wt.addPlatformToDatabase(smb.getFid());\r
- } catch (Exception e) {\r
- Log.err("addPlatformToDatabase", e.getMessage());\r
+ PlatformIdentification fid = smb.getFid();\r
+ if (fid != null) {\r
+ try {\r
+ wt.addPlatformToDatabase(fid);\r
+ } catch (Exception e) {\r
+ Log.err("addPlatformToDatabase", e.getMessage());\r
+ }\r
+\r
+ //\r
+ // Update global data\r
+ //\r
+ GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, smb.getFpd());\r
+ GlobalData.vPlatformList.addElement(fid);\r
+ //\r
+ // Add new SpdHeader node to the tree\r
+ //\r
+ IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(fid.getName(),\r
+ IDefaultMutableTreeNode.PLATFORM, true,\r
+ fid);\r
+ iTree.addNode(dmtnPlatformDescription, node);\r
+ this.openPlatform(fid.getPath());\r
}\r
- vPlatformList.addElement(smb.getFid());\r
- //\r
- // Add new SpdHeader node to the tree\r
- //\r
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPlatformList.lastElement().getName(),\r
- IDefaultMutableTreeNode.FPD_PLATFORMHEADER,\r
- true, vPlatformList.lastElement());\r
- iTree.addNode(dmtnPlatformDescription, node);\r
- this.openPlatform(smb.getFid().getPath());\r
}\r
}\r
}\r
//\r
case 0:\r
if (this.currentOpeningModuleIndex > -1) {\r
- if (!openingModuleList.getModuleSaved(currentOpeningModuleIndex)) {\r
+ if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) {\r
int result = showSaveDialog();\r
if (result == JOptionPane.YES_OPTION) {\r
this.saveAll();\r
return;\r
}\r
}\r
- iTree.removeNodeChildrenByPath(openingModuleList.getTreePathByIndex(currentOpeningModuleIndex));\r
- this.openingModuleList.removeFromOpeningModuleListByIndex(this.currentOpeningModuleIndex);\r
+ iTree\r
+ .removeNodeChildrenByPath(GlobalData.openingModuleList\r
+ .getTreePathByIndex(currentOpeningModuleIndex));\r
+ GlobalData.openingModuleList.setModuleOpen(this.currentOpeningModuleIndex, false);\r
this.cleanDesktopPaneModule();\r
this.currentOpeningModuleIndex = -1;\r
}\r
// \r
case 1:\r
if (this.currentOpeningPackageIndex > -1) {\r
- if (!openingPackageList.getPackageSaved(currentOpeningPackageIndex)) {\r
+ if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) {\r
int result = showSaveDialog();\r
if (result == JOptionPane.YES_OPTION) {\r
this.saveAll();\r
return;\r
}\r
}\r
- iTree.removeNodeChildrenByPath(openingPackageList.getTreePathByIndex(currentOpeningPackageIndex));\r
- this.openingPackageList.removeFromOpeningPackageListByIndex(this.currentOpeningPackageIndex);\r
+ iTree\r
+ .removeNodeChildrenByPath(GlobalData.openingPackageList\r
+ .getTreePathByIndex(currentOpeningPackageIndex));\r
+ GlobalData.openingPackageList.setPackageOpen(this.currentOpeningPackageIndex, false);\r
this.cleanDesktopPanePackage();\r
this.currentOpeningPackageIndex = -1;\r
}\r
//\r
case 2:\r
if (this.currentOpeningPlatformIndex > -1) {\r
- if (!openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) {\r
+ if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) {\r
int result = showSaveDialog();\r
if (result == JOptionPane.YES_OPTION) {\r
this.saveAll();\r
return;\r
}\r
}\r
- iTree.removeNodeChildrenByPath(openingPlatformList.getTreePathByIndex(currentOpeningPlatformIndex));\r
- this.openingPlatformList.removeFromOpeningPlatformListByIndex(this.currentOpeningPlatformIndex);\r
+ iTree\r
+ .removeNodeChildrenByPath(GlobalData.openingPlatformList\r
+ .getTreePathByIndex(currentOpeningPlatformIndex));\r
+ GlobalData.openingPlatformList.setPlatformOpen(this.currentOpeningPlatformIndex, false);\r
this.cleanDesktopPanePlatform();\r
this.currentOpeningPlatformIndex = -1;\r
}\r
**/\r
private void closeAll() {\r
int result = -1;\r
- if (!openingModuleList.isSaved() || !openingPackageList.isSaved() || !openingPlatformList.isSaved()) {\r
+ if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()\r
+ || !GlobalData.openingPlatformList.isSaved()) {\r
result = showSaveDialog();\r
}\r
if (result == JOptionPane.YES_OPTION) {\r
return;\r
}\r
this.cleanDesktopPane();\r
- this.getCompontentsFromFrameworkDatabase();\r
- openingModuleList.removeAllFromOpeningModuleList();\r
- openingPackageList.removeAllFromOpeningPackageList();\r
- openingPlatformList.removeAllFromOpeningPlatformList();\r
+ GlobalData.openingModuleList.closeAll();\r
+ GlobalData.openingPackageList.closeAll();\r
+ GlobalData.openingPlatformList.closeAll();\r
this.makeEmptyTree();\r
}\r
\r
//\r
// Save all modules\r
//\r
- for (int index = 0; index < openingModuleList.size(); index++) {\r
- if (!openingModuleList.getModuleSaved(index)) {\r
+ for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {\r
+ if (!GlobalData.openingModuleList.getModuleSaved(index)) {\r
saveModule(index);\r
}\r
}\r
//\r
// Save all packages\r
//\r
- for (int index = 0; index < openingPackageList.size(); index++) {\r
- if (!openingPackageList.getPackageSaved(index)) {\r
+ for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {\r
+ if (!GlobalData.openingPackageList.getPackageSaved(index)) {\r
savePackage(index);\r
}\r
}\r
//\r
// Save all platforms\r
//\r
- for (int index = 0; index < openingPlatformList.size(); index++) {\r
- if (!openingPlatformList.getPlatformSaved(index)) {\r
+ for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {\r
+ if (!GlobalData.openingPlatformList.getPlatformSaved(index)) {\r
savePlatform(index);\r
}\r
}\r
**/\r
private void exit() {\r
int result = -1;\r
- if (!openingModuleList.isSaved() || !openingPackageList.isSaved() || !openingPlatformList.isSaved()) {\r
+ if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved()\r
+ || !GlobalData.openingPlatformList.isSaved()) {\r
result = showSaveDialog();\r
}\r
if (result == JOptionPane.YES_OPTION) {\r
}\r
if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
Tools.showInformationMessage("Module Surface Area Clone Finished");\r
- vModuleList.addElement(c.getMid());\r
+ GlobalData.vModuleList.addElement(c.getMid());\r
addModuleToTree(c.getMid());\r
}\r
if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
Tools.showInformationMessage("Package Surface Area Clone Finished");\r
- vPackageList.addElement(c.getPid());\r
+ GlobalData.vPackageList.addElement(c.getPid());\r
//\r
// Add new SpdHeader node to the tree\r
//\r
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPackageList.lastElement().getName(),\r
+ IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(GlobalData.vPackageList.lastElement().getName(),\r
IDefaultMutableTreeNode.SPD_HEADER, true,\r
- vPackageList.lastElement());\r
+ GlobalData.vPackageList.lastElement());\r
iTree.addNode(dmtnPackageDescription, node);\r
}\r
if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
Tools.showInformationMessage("Platform Surface Area Clone Finished");\r
- vPlatformList.addElement(c.getFid());\r
+ GlobalData.vPlatformList.addElement(c.getFid());\r
//\r
// Add new SpdHeader node to the tree\r
//\r
- IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPlatformList.lastElement().getName(),\r
+ IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(\r
+ GlobalData.vPlatformList.lastElement().getName(),\r
IDefaultMutableTreeNode.FPD_PLATFORMHEADER,\r
- true, vPlatformList.lastElement());\r
+ true, GlobalData.vPlatformList.lastElement());\r
iTree.addNode(dmtnPlatformDescription, node);\r
//this.openPlatform(c.getFid().getPath());\r
}\r
//\r
// Enable close/close all if some files are opened\r
//\r
- jMenuItemFileClose.setEnabled(openingModuleList.isOpend() || openingPackageList.isOpend()\r
- || openingPlatformList.isOpend());\r
- jMenuItemFileCloseAll.setEnabled(openingModuleList.isOpend() || openingPackageList.isOpend()\r
- || openingPlatformList.isOpend());\r
+ jMenuItemFileClose.setEnabled(GlobalData.openingModuleList.isOpen()\r
+ || GlobalData.openingPackageList.isOpen()\r
+ || GlobalData.openingPlatformList.isOpen());\r
+ jMenuItemFileCloseAll.setEnabled(GlobalData.openingModuleList.isOpen()\r
+ || GlobalData.openingPackageList.isOpen()\r
+ || GlobalData.openingPlatformList.isOpen());\r
\r
//\r
// Enable save/save all if some files are changed\r
//\r
- jMenuItemFileSave.setEnabled(!openingModuleList.isSaved() || !openingPackageList.isSaved()\r
- || !openingPlatformList.isSaved());\r
- jMenuItemFileSaveAll.setEnabled(!openingModuleList.isSaved() || !openingPackageList.isSaved()\r
- || !openingPlatformList.isSaved());\r
+ jMenuItemFileSave.setEnabled(!GlobalData.openingModuleList.isSaved()\r
+ || !GlobalData.openingPackageList.isSaved()\r
+ || !GlobalData.openingPlatformList.isSaved());\r
+ jMenuItemFileSaveAll.setEnabled(!GlobalData.openingModuleList.isSaved()\r
+ || !GlobalData.openingPackageList.isSaved()\r
+ || !GlobalData.openingPlatformList.isSaved());\r
}\r
\r
if (arg0.getSource() == jMenuTools) {\r
import javax.swing.JPanel;\r
import javax.swing.JTextField;\r
\r
-import org.tianocore.ModuleSurfaceAreaDocument;\r
import org.tianocore.MsaHeaderDocument;\r
import org.tianocore.SpdHeaderDocument;\r
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
import org.tianocore.PlatformHeaderDocument.PlatformHeader;\r
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
private PackageIdentification pid = null;\r
\r
private PlatformIdentification fid = null;\r
+ \r
+ private ModuleSurfaceArea msa = null;\r
+ \r
+ private PackageSurfaceArea spd = null;\r
+ \r
+ private PlatformSurfaceArea fpd = null;\r
\r
private int mode = -1;\r
\r
\r
**/\r
private void saveModule() {\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
+ msa = null;\r
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());\r
\r
//\r
try {\r
MsaHeaderDocument.MsaHeader msaHeader = null;\r
\r
- msa = ModuleSurfaceAreaDocument.ModuleSurfaceArea.Factory.newInstance();\r
+ msa = ModuleSurfaceArea.Factory.newInstance();\r
msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();\r
\r
msaHeader.setModuleName(this.jTextFieldName.getText());\r
\r
**/\r
private void savePackage() {\r
- PackageSurfaceArea spd = null;\r
+ spd = null;\r
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());\r
\r
//\r
\r
**/\r
private void savePlatform() {\r
- PlatformSurfaceArea fpd = null;\r
+ fpd = null;\r
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());\r
\r
//\r
return mid;\r
}\r
\r
- public void setMid(ModuleIdentification mid) {\r
- this.mid = mid;\r
- }\r
-\r
public PlatformIdentification getFid() {\r
return fid;\r
}\r
\r
- public void setFid(PlatformIdentification fid) {\r
- this.fid = fid;\r
- }\r
-\r
public PackageIdentification getPid() {\r
return pid;\r
}\r
\r
- public void setPid(PackageIdentification pid) {\r
- this.pid = pid;\r
- }\r
-\r
private void upLocation(Component c, int size) {\r
c.setLocation(c.getLocation().x, c.getLocation().y - size);\r
}\r
+\r
+ public PlatformSurfaceArea getFpd() {\r
+ return fpd;\r
+ }\r
+\r
+ public ModuleSurfaceArea getMsa() {\r
+ return msa;\r
+ }\r
+\r
+ public PackageSurfaceArea getSpd() {\r
+ return spd;\r
+ }\r
}\r
// Hex String Header\r
//\r
public static final String HEX_STRING_HEADER = "0x";\r
+ \r
+ //\r
+ // The String of Boolean\r
+ //\r
+ public static final String TRUE = "True";\r
+ \r
+ public static final String FALSE = "False";\r
}\r
\r
private void initBoolean() {\r
vBoolean.removeAllElements();\r
- vBoolean.addElement("False");\r
- vBoolean.addElement("True");\r
+ vBoolean.addElement(DataType.FALSE);\r
+ vBoolean.addElement(DataType.TRUE);\r
}\r
\r
private void initModuleType() {\r
--- /dev/null
+/** @file \r
+ The file is used to provide initializing global data.\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 org.tianocore.frameworkwizard.common;\r
+\r
+import java.io.IOException;\r
+import java.util.Vector;\r
+\r
+import org.apache.xmlbeans.XmlException;\r
+import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;\r
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
+import org.tianocore.MsaFilesDocument.MsaFiles;\r
+import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
+import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
+import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
+import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleList;\r
+import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageList;\r
+import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformList;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
+import org.tianocore.frameworkwizard.workspace.Workspace;\r
+\r
+public class GlobalData {\r
+\r
+ public static FrameworkDatabase fdb = null;\r
+\r
+ public static OpeningModuleList openingModuleList = new OpeningModuleList();\r
+\r
+ public static OpeningPackageList openingPackageList = new OpeningPackageList();\r
+\r
+ public static OpeningPlatformList openingPlatformList = new OpeningPlatformList();\r
+\r
+ public static Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();\r
+\r
+ public static Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();\r
+\r
+ public static Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();\r
+\r
+ public static void init() {\r
+ initDatabase();\r
+ initPackage();\r
+ initPlatform();\r
+ initModule();\r
+ }\r
+\r
+ public static void initDatabase() {\r
+ String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
+ strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
+ try {\r
+ fdb = OpenFile.openFrameworkDb(strFrameworkDbFilePath);\r
+ } catch (XmlException e) {\r
+ Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());\r
+ return;\r
+ } catch (Exception e) {\r
+ Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");\r
+ return;\r
+ }\r
+ }\r
+\r
+ public static void initModule() {\r
+ vModuleList = new Vector<ModuleIdentification>();\r
+ openingModuleList = new OpeningModuleList();\r
+\r
+ ModuleSurfaceArea msa = null;\r
+ Vector<String> modulePaths = new Vector<String>();\r
+ Identification id = null;\r
+ ModuleIdentification mid = null;\r
+ String packagePath = null;\r
+ String modulePath = null;\r
+\r
+ //\r
+ // For each package, get all modules list\r
+ //\r
+ if (vPackageList.size() > 0) {\r
+ for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
+ packagePath = vPackageList.elementAt(indexI).getPath();\r
+ modulePaths = getAllModulesOfPackage(packagePath);\r
+\r
+ for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
+ try {\r
+ modulePath = modulePaths.get(indexJ);\r
+ msa = OpenFile.openMsaFile(modulePath);\r
+\r
+ } catch (IOException e) {\r
+ Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.err("Open Module Surface Area " + modulePath, "Invalid file type");\r
+ }\r
+ id = Tools.getId(modulePath, msa);\r
+ mid = new ModuleIdentification(id, vPackageList.elementAt(indexI));\r
+ vModuleList.addElement(mid);\r
+ openingModuleList.insertToOpeningModuleList(mid, msa);\r
+ }\r
+ }\r
+ Sort.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);\r
+ }\r
+ }\r
+\r
+ public static void initPackage() {\r
+ vPackageList = new Vector<PackageIdentification>();\r
+ openingPackageList = new OpeningPackageList();\r
+ if (fdb != null) {\r
+ for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
+ String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
+ + fdb.getPackageList().getFilenameArray(index).getStringValue();\r
+ path = Tools.convertPathToCurrentOsType(path);\r
+ PackageSurfaceArea spd = null;\r
+ PackageIdentification id = null;\r
+ try {\r
+ spd = OpenFile.openSpdFile(path);\r
+ } catch (IOException e) {\r
+ Log.err("Open Package Surface Area " + path, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.err("Open Package Surface Area " + path, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.err("Open Package Surface Area " + path, "Invalid file type");\r
+ }\r
+ id = Tools.getId(path, spd);\r
+ vPackageList.addElement(id);\r
+ openingPackageList.insertToOpeningPackageList(id, spd);\r
+ }\r
+ Sort.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);\r
+ }\r
+ }\r
+\r
+ public static void initPlatform() {\r
+ vPlatformList = new Vector<PlatformIdentification>();\r
+ openingPlatformList = new OpeningPlatformList();\r
+\r
+ if (fdb != null) {\r
+ for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
+ String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
+ + fdb.getPlatformList().getFilenameArray(index).getStringValue();\r
+ path = Tools.convertPathToCurrentOsType(path);\r
+ PlatformSurfaceArea fpd = null;\r
+ PlatformIdentification id = null;\r
+ try {\r
+ fpd = OpenFile.openFpdFile(path);\r
+ } catch (IOException e) {\r
+ Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
+ }\r
+ id = Tools.getId(path, fpd);\r
+ vPlatformList.addElement(new PlatformIdentification(id));\r
+ openingPlatformList.insertToOpeningPlatformList(id, fpd);\r
+ }\r
+ Sort.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);\r
+ }\r
+ }\r
+\r
+ /**\r
+ Get all modules' paths from one package\r
+ \r
+ @return a Vector with all modules' path\r
+ \r
+ **/\r
+ private static Vector<String> getAllModulesOfPackage(String path) {\r
+ Vector<String> modulePath = new Vector<String>();\r
+ try {\r
+ MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();\r
+ if (files != null) {\r
+ for (int index = 0; index < files.getFilenameList().size(); index++) {\r
+ String msaPath = files.getFilenameList().get(index);\r
+ msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r
+ msaPath = Tools.convertPathToCurrentOsType(msaPath);\r
+ modulePath.addElement(msaPath);\r
+ }\r
+ }\r
+ } catch (IOException e) {\r
+ Log.err("Get all mdoules of a package " + path, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.err("Get all mdoules of a package " + path, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.err("Get all mdoules of a package " + path, e.getMessage());\r
+ }\r
+ return modulePath;\r
+ }\r
+}\r
if (obj instanceof Identification) {\r
Identification id = (Identification) obj;\r
if (path.equals(id.path)) {\r
- //if ( name.equals(id.name) && guid.equals(id.guid) && version.equals(id.version)) {\r
return true;\r
}\r
return false;\r
//\r
// Define class members\r
//\r
- \r
- private Identification id = null;\r
- \r
private boolean isSaved = true;\r
\r
private boolean isNew = false;\r
\r
+ private boolean isOpen = false;\r
+ \r
private TreePath treePath = null;\r
\r
public OpeningFileType() {\r
\r
}\r
\r
- public OpeningFileType(Identification identification) {\r
- this.id = identification;\r
- }\r
- \r
- public OpeningFileType(Identification identification, TreePath treePathValue) {\r
- this.id = identification;\r
+ public OpeningFileType(TreePath treePathValue) {\r
this.treePath = treePathValue;\r
}\r
\r
- public Identification getId() {\r
- return id;\r
- }\r
-\r
- public void setId(Identification id) {\r
- this.id = id;\r
- }\r
-\r
public boolean isNew() {\r
return isNew;\r
}\r
public void setTreePath(TreePath treePath) {\r
this.treePath = treePath;\r
}\r
+\r
+ public boolean isOpen() {\r
+ return isOpen;\r
+ }\r
+\r
+ public void setOpen(boolean isOpen) {\r
+ this.isOpen = isOpen;\r
+ }\r
}\r
import javax.swing.tree.TreePath;\r
\r
import org.tianocore.ModuleSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
\r
public class OpeningModuleList {\r
private Vector<OpeningModuleType> vOpeningModuleList = new Vector<OpeningModuleType>();\r
vOpeningModuleList = openingModuleList;\r
}\r
\r
- public void insertToOpeningModuleList(Identification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {\r
+ public void insertToOpeningModuleList(ModuleIdentification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {\r
vOpeningModuleList.addElement(new OpeningModuleType(id, xmlMsa));\r
}\r
\r
return null;\r
}\r
\r
- public OpeningModuleType getOpeningModuleById(Identification id) {\r
+ public OpeningModuleType getOpeningModuleById(ModuleIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningModuleList.elementAt(index);\r
return null;\r
}\r
\r
- public int findIndexOfListById(Identification id) {\r
+ public int findIndexOfListById(ModuleIdentification id) {\r
for (int index = 0; index < vOpeningModuleList.size(); index++) {\r
if (vOpeningModuleList.elementAt(index).getId().equals(id)) {\r
return index;\r
}\r
}\r
\r
- public void removeFromOpeningModuleListById(Identification id) {\r
+ public void removeFromOpeningModuleListById(ModuleIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningModuleList.removeElementAt(findIndexOfListById(id));\r
vOpeningModuleList.removeAllElements();\r
}\r
\r
- public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(Identification id) {\r
+ public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(ModuleIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningModuleList.elementAt(index).getXmlMsa();\r
return null;\r
}\r
\r
- public boolean existsModule(Identification id) {\r
+ public boolean existsModule(ModuleIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return true;\r
return false;\r
}\r
\r
- public void setModuleSaved(Identification id, boolean isSaved) {\r
+ public void setModuleSaved(ModuleIdentification id, boolean isSaved) {\r
setModuleSaved(findIndexOfListById(id), isSaved);\r
}\r
\r
}\r
}\r
\r
- public boolean getModuleSaved(Identification id) {\r
+ public boolean getModuleSaved(ModuleIdentification id) {\r
return getModuleSaved(findIndexOfListById(id));\r
}\r
\r
return true;\r
}\r
\r
- public void setTreePathById(Identification id, TreePath treePath) {\r
+ public void setModuleOpen(ModuleIdentification id, boolean isOpen) {\r
+ setModuleOpen(findIndexOfListById(id), isOpen);\r
+ }\r
+ \r
+ public void setModuleOpen(int index, boolean isOpen) {\r
+ if (index > -1) {\r
+ vOpeningModuleList.elementAt(index).setOpen(isOpen);\r
+ }\r
+ }\r
+ \r
+ public boolean getModuleOpen(ModuleIdentification id) {\r
+ return getModuleOpen(findIndexOfListById(id));\r
+ }\r
+ \r
+ public boolean getModuleOpen(int index) {\r
+ if (index > -1) {\r
+ return vOpeningModuleList.elementAt(index).isOpen();\r
+ }\r
+ return true;\r
+ }\r
+ \r
+ public void setTreePathById(ModuleIdentification id, TreePath treePath) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningModuleList.elementAt(index).setTreePath(treePath);\r
}\r
}\r
\r
- public TreePath getTreePathById(Identification id) {\r
+ public TreePath getTreePathById(ModuleIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningModuleList.elementAt(index).getTreePath();\r
return null;\r
}\r
\r
- public void setNew(Identification id, boolean isNew) {\r
+ public ModuleIdentification getIdByPath(String path) {\r
+ ModuleIdentification id = new ModuleIdentification(null, null, null, path);\r
+ int index = findIndexOfListById(id);\r
+ if (index > -1) {\r
+ return vOpeningModuleList.elementAt(index).getId();\r
+ }\r
+ return null;\r
+ }\r
+ \r
+ public void setNew(ModuleIdentification id, boolean isNew) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningModuleList.elementAt(index).setNew(isNew);\r
}\r
}\r
\r
+ public void closeAll() {\r
+ for (int index = 0; index < this.size(); index++) {\r
+ this.setModuleOpen(index, false);\r
+ }\r
+ }\r
+ \r
public int size() {\r
return vOpeningModuleList.size();\r
}\r
return true;\r
}\r
\r
- public boolean isOpend() {\r
- if (this.size() > 0 ) {\r
- return true;\r
+ public boolean isOpen() {\r
+ for (int index = 0; index < this.size(); index++) {\r
+ if (this.getModuleOpen(index)) {\r
+ return true;\r
+ }\r
}\r
return false;\r
}\r
import javax.swing.tree.TreePath;\r
\r
import org.tianocore.ModuleSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
\r
public class OpeningModuleType extends OpeningFileType{\r
//\r
//\r
private ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa = null;\r
\r
+ private ModuleIdentification id = null;\r
+ \r
public OpeningModuleType() {\r
\r
}\r
\r
- public OpeningModuleType(Identification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa) {\r
- super(identification);\r
+ public OpeningModuleType(ModuleIdentification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa) {\r
+ this.id = identification;\r
this.xmlMsa = msa;\r
}\r
\r
- public OpeningModuleType(Identification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa, TreePath treePath) {\r
- super(identification, treePath);\r
+ public OpeningModuleType(ModuleIdentification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa, TreePath treePath) {\r
+ super(treePath);\r
+ \r
+ this.id = identification;\r
this.xmlMsa = msa;\r
}\r
\r
public void setXmlMsa(ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {\r
this.xmlMsa = xmlMsa;\r
}\r
+\r
+ public ModuleIdentification getId() {\r
+ return id;\r
+ }\r
+\r
+ public void setId(ModuleIdentification id) {\r
+ this.id = id;\r
+ }\r
}\r
import javax.swing.tree.TreePath;\r
\r
import org.tianocore.PackageSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
public class OpeningPackageList {\r
private Vector<OpeningPackageType> vOpeningPackageList = new Vector<OpeningPackageType>();\r
vOpeningPackageList = openingPackageList;\r
}\r
\r
- public void insertToOpeningPackageList(Identification id, PackageSurfaceAreaDocument.PackageSurfaceArea xmlMsa) {\r
+ public void insertToOpeningPackageList(PackageIdentification id, PackageSurfaceAreaDocument.PackageSurfaceArea xmlMsa) {\r
vOpeningPackageList.addElement(new OpeningPackageType(id, xmlMsa));\r
}\r
\r
return null;\r
}\r
\r
- public OpeningPackageType getOpeningPackageById(Identification id) {\r
+ public OpeningPackageType getOpeningPackageById(PackageIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningPackageList.elementAt(index);\r
return null;\r
}\r
\r
- public int findIndexOfListById(Identification id) {\r
+ public int findIndexOfListById(PackageIdentification id) {\r
for (int index = 0; index < vOpeningPackageList.size(); index++) {\r
if (vOpeningPackageList.elementAt(index).getId().equals(id)) {\r
return index;\r
}\r
}\r
\r
- public void removeFromOpeningPackageListById(Identification id) {\r
+ public void removeFromOpeningPackageListById(PackageIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningPackageList.removeElementAt(findIndexOfListById(id));\r
vOpeningPackageList.removeAllElements();\r
}\r
\r
- public PackageSurfaceAreaDocument.PackageSurfaceArea getPackageSurfaceAreaFromId(Identification id) {\r
+ public PackageSurfaceAreaDocument.PackageSurfaceArea getPackageSurfaceAreaFromId(PackageIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningPackageList.elementAt(index).getXmlSpd();\r
return null;\r
}\r
\r
- public boolean existsPackage(Identification id) {\r
+ public boolean existsPackage(PackageIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return true;\r
return false;\r
}\r
\r
- public void setPackageSaved(Identification id, boolean isSaved) {\r
+ public void setPackageSaved(PackageIdentification id, boolean isSaved) {\r
setPackageSaved(findIndexOfListById(id), isSaved);\r
}\r
\r
}\r
}\r
\r
- public boolean getPackageSaved(Identification id) {\r
+ public boolean getPackageSaved(PackageIdentification id) {\r
return getPackageSaved(findIndexOfListById(id));\r
}\r
\r
return true;\r
}\r
\r
- public void setTreePathById(Identification id, TreePath treePath) {\r
+ public void setPackageOpen(PackageIdentification id, boolean isOpem) {\r
+ setPackageOpen(findIndexOfListById(id), isOpem);\r
+ }\r
+ \r
+ public void setPackageOpen(int index, boolean isOpem) {\r
+ if (index > -1) {\r
+ vOpeningPackageList.elementAt(index).setOpen(isOpem);\r
+ }\r
+ }\r
+ \r
+ public boolean getPackageOpen(PackageIdentification id) {\r
+ return getPackageOpen(findIndexOfListById(id));\r
+ }\r
+ \r
+ public boolean getPackageOpen(int index) {\r
+ if (index > -1) {\r
+ return vOpeningPackageList.elementAt(index).isOpen();\r
+ }\r
+ return true;\r
+ }\r
+ \r
+ public void setTreePathById(PackageIdentification id, TreePath treePath) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningPackageList.elementAt(index).setTreePath(treePath);\r
}\r
}\r
\r
- public TreePath getTreePathById(Identification id) {\r
+ public TreePath getTreePathById(PackageIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningPackageList.elementAt(index).getTreePath();\r
return null;\r
}\r
\r
- public void setNew(Identification id, boolean isNew) {\r
+ public PackageIdentification getIdByPath(String path) {\r
+ PackageIdentification id = new PackageIdentification(null, null, null, path);\r
+ int index = findIndexOfListById(id);\r
+ if (index > -1) {\r
+ return vOpeningPackageList.elementAt(index).getId();\r
+ }\r
+ return null;\r
+ }\r
+ \r
+ public void setNew(PackageIdentification id, boolean isNew) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningPackageList.elementAt(index).setNew(isNew);\r
}\r
}\r
\r
+ public void closeAll() {\r
+ for (int index = 0; index < this.size(); index++) {\r
+ this.setPackageOpen(index, false);\r
+ }\r
+ }\r
+ \r
public int size() {\r
return vOpeningPackageList.size();\r
}\r
return true;\r
}\r
\r
- public boolean isOpend() {\r
- if (this.size() > 0 ) {\r
- return true;\r
+ public boolean isOpen() {\r
+ for (int index = 0; index < this.size(); index++) {\r
+ if (this.getPackageOpen(index)) {\r
+ return true;\r
+ }\r
}\r
return false;\r
}\r
import javax.swing.tree.TreePath;\r
\r
import org.tianocore.PackageSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
public class OpeningPackageType extends OpeningFileType {\r
//\r
//\r
private PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd = null;\r
\r
+ private PackageIdentification id = null;\r
+ \r
public OpeningPackageType() {\r
\r
}\r
\r
- public OpeningPackageType(Identification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd) {\r
- super(identification);\r
+ public OpeningPackageType(PackageIdentification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd) {\r
+ this.id = identification;\r
this.xmlSpd = spd;\r
}\r
\r
- public OpeningPackageType(Identification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd, TreePath treePath) {\r
- super(identification, treePath);\r
+ public OpeningPackageType(PackageIdentification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd, TreePath treePath) {\r
+ super(treePath);\r
+ \r
+ this.id = identification;\r
this.xmlSpd = spd;\r
}\r
\r
public void setXmlSpd(PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd) {\r
this.xmlSpd = xmlSpd;\r
}\r
+\r
+ public PackageIdentification getId() {\r
+ return id;\r
+ }\r
+\r
+ public void setId(PackageIdentification id) {\r
+ this.id = id;\r
+ }\r
}\r
import javax.swing.tree.TreePath;\r
\r
import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
\r
public class OpeningPlatformList {\r
\r
vOpeningPlatformList = openingPlatformList;\r
}\r
\r
- public void insertToOpeningPlatformList(Identification id, PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {\r
+ public void insertToOpeningPlatformList(PlatformIdentification id, PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {\r
vOpeningPlatformList.addElement(new OpeningPlatformType(id, xmlFpd));\r
}\r
\r
return null;\r
}\r
\r
- public OpeningPlatformType getOpeningPlatformById(Identification id) {\r
+ public OpeningPlatformType getOpeningPlatformById(PlatformIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningPlatformList.elementAt(index);\r
return null;\r
}\r
\r
- public int findIndexOfListById(Identification id) {\r
+ public int findIndexOfListById(PlatformIdentification id) {\r
for (int index = 0; index < vOpeningPlatformList.size(); index++) {\r
if (vOpeningPlatformList.elementAt(index).getId().equals(id)) {\r
return index;\r
}\r
}\r
\r
- public void removeFromOpeningPlatformListById(Identification id) {\r
+ public void removeFromOpeningPlatformListById(PlatformIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningPlatformList.removeElementAt(findIndexOfListById(id));\r
vOpeningPlatformList.removeAllElements();\r
}\r
\r
- public PlatformSurfaceAreaDocument.PlatformSurfaceArea getPlatformSurfaceAreaFromId(Identification id) {\r
+ public PlatformSurfaceAreaDocument.PlatformSurfaceArea getPlatformSurfaceAreaFromId(PlatformIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningPlatformList.elementAt(index).getXmlFpd();\r
return null;\r
}\r
\r
- public boolean existsPlatform(Identification id) {\r
+ public boolean existsPlatform(PlatformIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return true;\r
}\r
\r
\r
- public void setPlatformSaved(Identification id, boolean isSaved) {\r
+ public void setPlatformSaved(PlatformIdentification id, boolean isSaved) {\r
setPlatformSaved(findIndexOfListById(id), isSaved);\r
}\r
\r
}\r
}\r
\r
- public boolean getPlatformSaved(Identification id) {\r
+ public boolean getPlatformSaved(PlatformIdentification id) {\r
return getPlatformSaved(findIndexOfListById(id));\r
}\r
\r
return true;\r
}\r
\r
- public void setTreePathById(Identification id, TreePath treePath) {\r
+ public void setPlatformOpen(PlatformIdentification id, boolean isOpen) {\r
+ setPlatformOpen(findIndexOfListById(id), isOpen);\r
+ }\r
+ \r
+ public void setPlatformOpen(int index, boolean isOpen) {\r
+ if (index > -1) {\r
+ vOpeningPlatformList.elementAt(index).setOpen(isOpen);\r
+ }\r
+ }\r
+ \r
+ public boolean getPlatformOpen(PlatformIdentification id) {\r
+ return getPlatformOpen(findIndexOfListById(id));\r
+ }\r
+ \r
+ public boolean getPlatformOpen(int index) {\r
+ if (index > -1) {\r
+ return vOpeningPlatformList.elementAt(index).isOpen();\r
+ }\r
+ return true;\r
+ }\r
+ \r
+ public void setTreePathById(PlatformIdentification id, TreePath treePath) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningPlatformList.elementAt(index).setTreePath(treePath);\r
}\r
}\r
\r
- public TreePath getTreePathById(Identification id) {\r
+ public TreePath getTreePathById(PlatformIdentification id) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
return vOpeningPlatformList.elementAt(index).getTreePath();\r
return null;\r
}\r
\r
- public void setNew(Identification id, boolean isNew) {\r
+ public PlatformIdentification getIdByPath(String path) {\r
+ PlatformIdentification id = new PlatformIdentification(null, null, null, path);\r
+ int index = findIndexOfListById(id);\r
+ if (index > -1) {\r
+ return vOpeningPlatformList.elementAt(index).getId();\r
+ }\r
+ return null;\r
+ }\r
+ \r
+ public void setNew(PlatformIdentification id, boolean isNew) {\r
int index = findIndexOfListById(id);\r
if (index > -1) {\r
vOpeningPlatformList.elementAt(index).setNew(isNew);\r
}\r
}\r
\r
+ public void closeAll() {\r
+ for (int index = 0; index < this.size(); index++) {\r
+ this.setPlatformOpen(index, false);\r
+ }\r
+ }\r
+ \r
public int size() {\r
return vOpeningPlatformList.size();\r
}\r
return true;\r
}\r
\r
- public boolean isOpend() {\r
- if (this.size() > 0 ) {\r
- return true;\r
+ public boolean isOpen() {\r
+ for (int index = 0; index < this.size(); index++) {\r
+ if (this.getPlatformOpen(index)) {\r
+ return true;\r
+ }\r
}\r
return false;\r
}\r
import javax.swing.tree.TreePath;\r
\r
import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
\r
public class OpeningPlatformType extends OpeningFileType {\r
//\r
//\r
private PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd = null;\r
\r
+ private PlatformIdentification id = null;\r
+ \r
public OpeningPlatformType() {\r
\r
}\r
\r
- public OpeningPlatformType(Identification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
- super(identification);\r
+ public OpeningPlatformType(PlatformIdentification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
+ this.id = identification;\r
this.xmlFpd = fpd;\r
}\r
\r
- public OpeningPlatformType(Identification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd, TreePath treePath) {\r
- super(identification, treePath);\r
+ public OpeningPlatformType(PlatformIdentification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd, TreePath treePath) {\r
+ super(treePath);\r
+ this.id = identification;\r
this.xmlFpd = fpd;\r
}\r
\r
public void setXmlFpd(PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {\r
this.xmlFpd = xmlFpd;\r
}\r
+\r
+ public PlatformIdentification getId() {\r
+ return id;\r
+ }\r
+\r
+ public void setId(PlatformIdentification id) {\r
+ this.id = id;\r
+ }\r
}\r
import javax.swing.JList;\r
import javax.swing.JOptionPane;\r
\r
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
+import org.tianocore.MsaHeaderDocument.MsaHeader;\r
+import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
+import org.tianocore.PlatformHeaderDocument.PlatformHeader;\r
+import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
+import org.tianocore.SpdHeaderDocument.SpdHeader;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
+\r
/**\r
The class is used to provides some useful interfaces \r
\r
//\r
return hexString.trim();\r
}\r
+ \r
+ public static ModuleIdentification getId(String path, ModuleSurfaceArea msa) {\r
+ MsaHeader head = msa.getMsaHeader();\r
+ String name = head.getModuleName();\r
+ String guid = head.getGuidValue();\r
+ String version = head.getVersion();\r
+ ModuleIdentification id = new ModuleIdentification(name, guid, version, path);\r
+ return id;\r
+ }\r
+\r
+ public static PackageIdentification getId(String path, PackageSurfaceArea spd) {\r
+ SpdHeader head = spd.getSpdHeader();\r
+ String name = head.getPackageName();\r
+ String guid = head.getGuidValue();\r
+ String version = head.getVersion();\r
+ PackageIdentification id = new PackageIdentification(name, guid, version, path);\r
+ return id;\r
+ }\r
+\r
+ public static PlatformIdentification getId(String path, PlatformSurfaceArea fpd) {\r
+ PlatformHeader head = fpd.getPlatformHeader();\r
+ String name = head.getPlatformName();\r
+ String guid = head.getGuidValue();\r
+ String version = head.getVersion();\r
+ PlatformIdentification id = new PlatformIdentification(name, guid, version, path);\r
+ return id;\r
+ }\r
}\r
\r
import java.util.Vector;\r
\r
-import javax.swing.JPanel;\r
import javax.swing.JCheckBox;\r
+import javax.swing.JPanel;\r
\r
import org.tianocore.frameworkwizard.common.DataType;\r
\r
public class ArchCheckBox extends JPanel {\r
\r
///\r
- ///\r
+ /// Define class members\r
///\r
private static final long serialVersionUID = 4792669775676953990L;\r
\r
private JCheckBox jCheckBoxArm = null;\r
\r
private JCheckBox jCheckBoxPpc = null;\r
-\r
+ \r
/**\r
* This method initializes jCheckBoxIa32 \r
* \r
return jCheckBoxPpc;\r
}\r
\r
- /**\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
/**\r
* This is the default constructor\r
*/\r
import org.tianocore.PackageSurfaceAreaDocument;\r
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
import org.tianocore.frameworkwizard.common.OpenFile;\r
+import org.tianocore.frameworkwizard.common.Tools;\r
import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
\r
PackageIdentification packageId = null;\r
try {\r
String path = spdFile.getPath();\r
- WorkspaceTools wt = new WorkspaceTools();\r
- packageId = new PackageIdentification(wt.getId(path, OpenFile.openSpdFile(path)));\r
+ packageId = Tools.getId(path, OpenFile.openSpdFile(path));\r
} catch (Exception e) {\r
e.printStackTrace();\r
}\r
this.isLibrary = library;\r
}\r
\r
+ public ModuleIdentification(Identification id) {\r
+ super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
+ }\r
+ \r
public ModuleIdentification(Identification id, boolean library) {\r
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
this.isLibrary = library;\r
+++ /dev/null
-/** @file\r
- \r
- The file is used to create, update Module Definitions of MSA file\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
- **/\r
-package org.tianocore.frameworkwizard.module.ui;\r
-\r
-import java.awt.event.ComponentEvent;\r
-import java.awt.event.FocusEvent;\r
-\r
-import javax.swing.JPanel;\r
-import javax.swing.JScrollPane;\r
-import javax.swing.JLabel;\r
-import javax.swing.JTextField;\r
-import javax.swing.JComboBox;\r
-\r
-import org.tianocore.ModuleDefinitionsDocument;\r
-import org.tianocore.ModuleSurfaceAreaDocument;\r
-import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions.ClonedFrom;\r
-import org.tianocore.frameworkwizard.common.DataValidation;\r
-import org.tianocore.frameworkwizard.common.EnumerationData;\r
-import org.tianocore.frameworkwizard.common.Log;\r
-import org.tianocore.frameworkwizard.common.Tools;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;\r
-import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
-import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
-\r
-public class ModuleDefinitions extends IInternalFrame {\r
-\r
- ///\r
- /// Define class Serial Version UID\r
- ///\r
- private static final long serialVersionUID = 5860378543553036323L;\r
-\r
- private JScrollPane jScrollPane = null;\r
-\r
- private JPanel jContentPane = null;\r
-\r
- private JLabel jLabelArch = null;\r
-\r
- private ICheckBoxList iCheckBoxListArch = null;\r
-\r
- private JLabel jLabelBinaryModule = null;\r
-\r
- private JComboBox jComboBoxBinaryModule = null;\r
-\r
- private JLabel jLabelOutputFileBasename = null;\r
-\r
- private JTextField jTextFieldOutputFileBasename = null;\r
-\r
- private JScrollPane jScrollPaneArch = null;\r
-\r
- private StarLabel jStarLabel1 = null;\r
-\r
- private StarLabel jStarLabel2 = null;\r
-\r
- private StarLabel jStarLabel3 = null;\r
-\r
- private OpeningModuleType omt = null;\r
-\r
- private ClonedFrom cf = null;\r
-\r
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
-\r
- private ModuleDefinitionsDocument.ModuleDefinitions md = null;\r
-\r
- /**\r
- * This method initializes jScrollPane \r
- * \r
- * @return javax.swing.JScrollPane \r
- */\r
- private JScrollPane getJScrollPane() {\r
- if (jScrollPane == null) {\r
- jScrollPane = new JScrollPane();\r
- jScrollPane.setViewportView(getJContentPane());\r
- }\r
- return jScrollPane;\r
- }\r
-\r
- /**\r
- * This method initializes jPanel \r
- * \r
- * @return javax.swing.JPanel \r
- */\r
- private JPanel getJContentPane() {\r
- if (jContentPane == null) {\r
- jLabelOutputFileBasename = new JLabel();\r
- jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(15, 10, 140, 20));\r
- jLabelOutputFileBasename.setText("Output File Basename");\r
- jLabelBinaryModule = new JLabel();\r
- jLabelBinaryModule.setBounds(new java.awt.Rectangle(15, 35, 140, 20));\r
- jLabelBinaryModule.setText("Binary Module");\r
- jLabelArch = new JLabel();\r
- jLabelArch.setBounds(new java.awt.Rectangle(15, 60, 140, 20));\r
- jLabelArch.setText("Supported Architectures");\r
- jStarLabel1 = new StarLabel();\r
- jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
- jStarLabel2 = new StarLabel();\r
- jStarLabel2.setLocation(new java.awt.Point(0, 35));\r
- jStarLabel3 = new StarLabel();\r
- jStarLabel3.setLocation(new java.awt.Point(0, 60));\r
-\r
- jContentPane = new JPanel();\r
- jContentPane.setLayout(null);\r
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 150));\r
-\r
- jContentPane.add(jLabelArch, null);\r
- jContentPane.add(getJScrollPaneArch(), null);\r
- jContentPane.add(jLabelBinaryModule, null);\r
- jContentPane.add(getJComboBoxBinaryModule(), null);\r
- jContentPane.add(jLabelOutputFileBasename, null);\r
- jContentPane.add(getJTextFieldOutputFileBasename(), null);\r
- jContentPane.add(jStarLabel1, null);\r
- jContentPane.add(jStarLabel2, null);\r
- jContentPane.add(jStarLabel3, null);\r
- }\r
- return jContentPane;\r
- }\r
-\r
- /**\r
- This method initializes iCheckBoxListArch \r
- \r
- @return ICheckBoxList \r
- **/\r
- private ICheckBoxList getICheckBoxListSupportedArchitectures() {\r
- if (iCheckBoxListArch == null) {\r
- iCheckBoxListArch = new ICheckBoxList();\r
- iCheckBoxListArch.addFocusListener(this);\r
- iCheckBoxListArch.setToolTipText("<html>Deselecting a checkbox will restrict this module<br>"\r
- + "for use with the selected architectures, <br>"\r
- + "based on the list of items that are checked. <br>"\r
- + "If all boxes are checked, <br>"\r
- + "then the module will support all <br>"\r
- + "current AND FUTURE architectures</html>");\r
- }\r
- return iCheckBoxListArch;\r
- }\r
-\r
- /**\r
- * This method initializes jComboBoxBinaryModule \r
- * \r
- * @return javax.swing.JComboBox \r
- */\r
- private JComboBox getJComboBoxBinaryModule() {\r
- if (jComboBoxBinaryModule == null) {\r
- jComboBoxBinaryModule = new JComboBox();\r
- jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 35, 320, 20));\r
- jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20));\r
- jComboBoxBinaryModule.addFocusListener(this);\r
- jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>"\r
- + "which can be compiled or binary <br>"\r
- + "modules which are linked. <br>"\r
- + "A module cannot contain both. <br>"\r
- + "The GUID numbers should be identical <br>"\r
- + "for a binary and source MSA, <br>"\r
- + "but the BINARY MSA should have <br>"\r
- + "a higher version number.</html>");\r
- }\r
- return jComboBoxBinaryModule;\r
- }\r
-\r
- /**\r
- * This method initializes jTextFieldOutputFileBasename \r
- * \r
- * @return javax.swing.JTextField \r
- */\r
- private JTextField getJTextFieldOutputFileBasename() {\r
- if (jTextFieldOutputFileBasename == null) {\r
- jTextFieldOutputFileBasename = new JTextField();\r
- jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(160, 10, 320, 20));\r
- jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(320, 20));\r
- jTextFieldOutputFileBasename.addFocusListener(this);\r
- jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names");\r
- }\r
- return jTextFieldOutputFileBasename;\r
- }\r
-\r
- /**\r
- This method initializes jScrollPaneArch \r
- \r
- @return javax.swing.JScrollPane \r
- \r
- **/\r
- private JScrollPane getJScrollPaneArch() {\r
- if (jScrollPaneArch == null) {\r
- jScrollPaneArch = new JScrollPane();\r
- jScrollPaneArch.setBounds(new java.awt.Rectangle(160, 60, 320, 80));\r
- jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 60));\r
- jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures());\r
- }\r
- return jScrollPaneArch;\r
- }\r
-\r
- /**\r
- \r
- @param args\r
- \r
- **/\r
- public static void main(String[] args) {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- /**\r
- * This is the default constructor\r
- */\r
- public ModuleDefinitions() {\r
- super();\r
- init();\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- This is the override edit constructor\r
- \r
- @param inMsa\r
- \r
- **/\r
- public ModuleDefinitions(OpeningModuleType inOmt) {\r
- super();\r
- this.omt = inOmt;\r
- this.msa = omt.getXmlMsa();\r
- if (msa.getModuleDefinitions() != null) {\r
- this.cf = msa.getModuleDefinitions().getClonedFrom();\r
- }\r
- init(msa.getModuleDefinitions());\r
- this.setVisible(true);\r
- }\r
-\r
- /**\r
- * This method initializes this\r
- * \r
- * @return void\r
- */\r
- private void init() {\r
- this.setContentPane(getJScrollPane());\r
- this.setTitle("Module Definitions");\r
- initFrame();\r
- this.setPreferredSize(new java.awt.Dimension(490, 520));\r
- }\r
-\r
- /**\r
- This method initializes this\r
- Fill values to all fields if these values are not empty\r
- \r
- @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader\r
- \r
- **/\r
- private void init(ModuleDefinitionsDocument.ModuleDefinitions inMd) {\r
- init();\r
- if (inMd != null) {\r
- this.md = inMd;\r
- if (md.getSupportedArchitectures() != null) {\r
- this.iCheckBoxListArch.initCheckedItem(true, Tools.convertListToVector(md.getSupportedArchitectures()));\r
- }\r
- if (md.getBinaryModule()) {\r
- this.jComboBoxBinaryModule.setSelectedIndex(1);\r
- } else {\r
- this.jComboBoxBinaryModule.setSelectedIndex(0);\r
- }\r
- if (md.getOutputFileBasename() != null) {\r
- this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This method initializes Module type and Compontent type\r
- \r
- **/\r
- private void initFrame() {\r
- EnumerationData ed = new EnumerationData();\r
- this.iCheckBoxListArch.setAllItems(ed.getVSupportedArchitectures());\r
- Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());\r
- }\r
-\r
- private boolean check() {\r
- if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {\r
- Log.wrn("Update Definitions", "Output File Basename couldn't be empty!");\r
- return false;\r
- }\r
- if (!DataValidation.isOutputFileBasename(this.jTextFieldOutputFileBasename.getText())) {\r
- Log.wrn("Update Definitions", "Incorrect data type for Output File Basename");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r
- * \r
- * Override componentResized to resize all components when frame's size is changed\r
- */\r
- public void componentResized(ComponentEvent arg0) {\r
- int intCurrentWidth = this.getJContentPane().getWidth();\r
- int intPreferredWidth = this.getJContentPane().getPreferredSize().width;\r
-\r
- resizeComponentWidth(this.jScrollPaneArch, intCurrentWidth, intPreferredWidth);\r
- resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth);\r
- resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);\r
- }\r
-\r
- /**\r
- Save all components of Module Definitions\r
- if exists Module Definitions, set the value directly\r
- if not exists Module Definitions, new an instance first\r
- \r
- **/\r
- public void save() {\r
- check();\r
- try {\r
- if (this.md == null) {\r
- md = ModuleDefinitionsDocument.ModuleDefinitions.Factory.newInstance();\r
- }\r
-\r
- if (!isEmpty(this.jTextFieldOutputFileBasename.getText())) {\r
- md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText());\r
- }\r
-\r
- if (this.jComboBoxBinaryModule.getSelectedIndex() == 0) {\r
- md.setBinaryModule(false);\r
- } else {\r
- md.setBinaryModule(true);\r
- }\r
-\r
- //\r
- // Set ClonedFrom field\r
- //\r
- if (this.cf != null) {\r
- md.setClonedFrom(this.cf);\r
- }\r
-\r
- //\r
- // Save Arch list\r
- //\r
- md.setSupportedArchitectures(this.iCheckBoxListArch.getAllCheckedItemsString());\r
-\r
- msa.setModuleDefinitions(md);\r
-\r
- this.omt.setSaved(false);\r
-\r
- } catch (Exception e) {\r
- Log.err("Save Module Definitions", e.getMessage());\r
- }\r
- }\r
-\r
- public void focusLost(FocusEvent arg0) {\r
- this.save();\r
- if (arg0.getSource() == this.jTextFieldOutputFileBasename) {\r
- }\r
- }\r
-}\r
import java.awt.event.ActionEvent;\r
import java.awt.event.ComponentEvent;\r
import java.awt.event.FocusEvent;\r
+import java.util.Vector;\r
\r
import javax.swing.JButton;\r
+import javax.swing.JCheckBox;\r
import javax.swing.JComboBox;\r
import javax.swing.JLabel;\r
import javax.swing.JPanel;\r
\r
private JComboBox jComboBoxModuleType = null;\r
\r
+ private JLabel jLabelArch = null;\r
+\r
+ private JLabel jLabelBinaryModule = null;\r
+\r
+ private JComboBox jComboBoxBinaryModule = null;\r
+\r
+ private JLabel jLabelOutputFileBasename = null;\r
+\r
+ private JTextField jTextFieldOutputFileBasename = null;\r
+\r
+ private JScrollPane jScrollPaneCopyright = null;\r
+\r
+ private JTextArea jTextAreaCopyright = null;\r
+\r
+ private JLabel jLabelURL = null;\r
+\r
+ private JTextField jTextFieldURL = null;\r
+\r
+ private JScrollPane jScrollPane = null;\r
+\r
private StarLabel jStarLabel1 = null;\r
\r
private StarLabel jStarLabel2 = null;\r
\r
private StarLabel jStarLabel12 = null;\r
\r
- private MsaHeaderDocument.MsaHeader msaHeader = null;\r
+ private StarLabel jStarLabel13 = null;\r
\r
- private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
+ private StarLabel jStarLabel14 = null;\r
\r
- private JTextField jTextFieldCopyright = null;\r
+ private StarLabel jStarLabel15 = null;\r
\r
- private JLabel jLabelURL = null;\r
+ private JCheckBox jCheckBoxIa32 = null;\r
\r
- private JTextField jTextFieldURL = null;\r
+ private JCheckBox jCheckBoxX64 = null;\r
\r
- private JScrollPane jScrollPane = null;\r
+ private JCheckBox jCheckBoxIpf = null;\r
+\r
+ private JCheckBox jCheckBoxEbc = null;\r
+\r
+ private JCheckBox jCheckBoxArm = null;\r
+\r
+ private JCheckBox jCheckBoxPpc = null;\r
+\r
+ //\r
+ // Not used for UI\r
+ //\r
+ private MsaHeaderDocument.MsaHeader msaHeader = null;\r
+\r
+ private ModuleDefinitionsDocument.ModuleDefinitions md = null;\r
+\r
+ private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;\r
\r
private OpeningModuleType omt = null;\r
\r
private EnumerationData ed = new EnumerationData();\r
\r
+ /**\r
+ * This method initializes jCheckBoxIa32 \r
+ * \r
+ * @return javax.swing.JCheckBox \r
+ */\r
+ private JCheckBox getJCheckBoxIa32() {\r
+ if (jCheckBoxIa32 == null) {\r
+ jCheckBoxIa32 = new JCheckBox();\r
+ jCheckBoxIa32.setBounds(new java.awt.Rectangle(160, 505, 55, 20));\r
+ jCheckBoxIa32.setText("IA32");\r
+ jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
+ jCheckBoxIa32.addFocusListener(this);\r
+ }\r
+ return jCheckBoxIa32;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jCheckBoxX64 \r
+ * \r
+ * @return javax.swing.JCheckBox \r
+ */\r
+ private JCheckBox getJCheckBoxX64() {\r
+ if (jCheckBoxX64 == null) {\r
+ jCheckBoxX64 = new JCheckBox();\r
+ jCheckBoxX64.setBounds(new java.awt.Rectangle(215, 505, 53, 20));\r
+ jCheckBoxX64.setText("X64");\r
+ jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
+ jCheckBoxX64.addFocusListener(this);\r
+ }\r
+ return jCheckBoxX64;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jCheckBoxIpf \r
+ * \r
+ * @return javax.swing.JCheckBox \r
+ */\r
+ private JCheckBox getJCheckBoxIpf() {\r
+ if (jCheckBoxIpf == null) {\r
+ jCheckBoxIpf = new JCheckBox();\r
+ jCheckBoxIpf.setBounds(new java.awt.Rectangle(270, 505, 52, 20));\r
+ jCheckBoxIpf.setText("IPF");\r
+ jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
+ jCheckBoxIpf.addFocusListener(this);\r
+ }\r
+ return jCheckBoxIpf;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jCheckBoxEbc \r
+ * \r
+ * @return javax.swing.JCheckBox \r
+ */\r
+ private JCheckBox getJCheckBoxEbc() {\r
+ if (jCheckBoxEbc == null) {\r
+ jCheckBoxEbc = new JCheckBox();\r
+ jCheckBoxEbc.setBounds(new java.awt.Rectangle(325, 505, 53, 20));\r
+ jCheckBoxEbc.setText("EBC");\r
+ jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
+ jCheckBoxEbc.addFocusListener(this);\r
+ }\r
+ return jCheckBoxEbc;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jCheckBoxArm \r
+ * \r
+ * @return javax.swing.JCheckBox \r
+ */\r
+ private JCheckBox getJCheckBoxArm() {\r
+ if (jCheckBoxArm == null) {\r
+ jCheckBoxArm = new JCheckBox();\r
+ jCheckBoxArm.setBounds(new java.awt.Rectangle(380, 505, 54, 20));\r
+ jCheckBoxArm.setText("ARM");\r
+ jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
+ jCheckBoxArm.addFocusListener(this);\r
+ }\r
+ return jCheckBoxArm;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jCheckBoxPpc \r
+ * \r
+ * @return javax.swing.JCheckBox \r
+ */\r
+ private JCheckBox getJCheckBoxPpc() {\r
+ if (jCheckBoxPpc == null) {\r
+ jCheckBoxPpc = new JCheckBox();\r
+ jCheckBoxPpc.setBounds(new java.awt.Rectangle(435, 505, 53, 20));\r
+ jCheckBoxPpc.setText("PPC");\r
+ jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);\r
+ jCheckBoxPpc.addFocusListener(this);\r
+ }\r
+ return jCheckBoxPpc;\r
+ }\r
+\r
/**\r
This method initializes jTextFieldBaseName \r
\r
jTextFieldSpecification.setPreferredSize(new java.awt.Dimension(320, 20));\r
jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");\r
jTextFieldSpecification.setSize(new java.awt.Dimension(320, 20));\r
- jTextFieldSpecification.setLocation(new java.awt.Point(160, 435));\r
+ jTextFieldSpecification.setLocation(new java.awt.Point(160, 530));\r
jTextFieldSpecification.setEditable(false);\r
jTextFieldSpecification.addFocusListener(this);\r
}\r
jScrollPaneLicense = new JScrollPane();\r
jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);\r
jScrollPaneLicense.setSize(new java.awt.Dimension(320, 120));\r
- jScrollPaneLicense.setLocation(new java.awt.Point(160, 285));\r
+ jScrollPaneLicense.setLocation(new java.awt.Point(160, 305));\r
jScrollPaneLicense.setViewportView(getJTextAreaLicense());\r
jScrollPaneLicense.setPreferredSize(new java.awt.Dimension(320, 120));\r
}\r
}\r
\r
/**\r
- This method initializes jTextFieldCopyright \r
+ This method initializes jTextFieldURL \r
\r
- @return javax.swing.JTextField jTextFieldCopyright\r
+ @return javax.swing.JTextField \r
\r
**/\r
- private JTextField getJTextFieldCopyright() {\r
- if (jTextFieldCopyright == null) {\r
- jTextFieldCopyright = new JTextField();\r
- jTextFieldCopyright.setPreferredSize(new java.awt.Dimension(320, 20));\r
- jTextFieldCopyright.setLocation(new java.awt.Point(160, 260));\r
- jTextFieldCopyright.setSize(new java.awt.Dimension(320, 20));\r
- jTextFieldCopyright.addFocusListener(this);\r
- jTextFieldCopyright.setToolTipText("One or more copyright lines");\r
- }\r
- return jTextFieldCopyright;\r
- }\r
-\r
- /**\r
- * This method initializes jTextFieldURL \r
- * \r
- * @return javax.swing.JTextField \r
- */\r
private JTextField getJTextFieldURL() {\r
if (jTextFieldURL == null) {\r
jTextFieldURL = new JTextField();\r
jTextFieldURL.setPreferredSize(new java.awt.Dimension(320, 20));\r
- jTextFieldURL.setLocation(new java.awt.Point(160, 410));\r
+ jTextFieldURL.setLocation(new java.awt.Point(160, 430));\r
jTextFieldURL.setSize(new java.awt.Dimension(320, 20));\r
jTextFieldURL.addFocusListener(this);\r
jTextFieldURL.setToolTipText("A URL for the latest version of the license");\r
}\r
\r
/**\r
- * This method initializes jScrollPane \r
- * \r
- * @return javax.swing.JScrollPane \r
- */\r
+ This method initializes jScrollPane \r
+ \r
+ @return javax.swing.JScrollPane \r
+ \r
+ **/\r
private JScrollPane getJScrollPane() {\r
if (jScrollPane == null) {\r
jScrollPane = new JScrollPane();\r
return jScrollPane;\r
}\r
\r
- public static void main(String[] args) {\r
+ /**\r
+ This method initializes jScrollPaneCopyright \r
+ \r
+ @return javax.swing.JScrollPane \r
+ \r
+ **/\r
+ private JScrollPane getJScrollPaneCopyright() {\r
+ if (jScrollPaneCopyright == null) {\r
+ jScrollPaneCopyright = new JScrollPane();\r
+ jScrollPaneCopyright.setBounds(new java.awt.Rectangle(160, 260, 320, 40));\r
+ jScrollPaneCopyright.setPreferredSize(new java.awt.Dimension(320, 40));\r
+ jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());\r
+ jScrollPaneCopyright.setSize(new java.awt.Dimension(320, 40));\r
+ }\r
+ return jScrollPaneCopyright;\r
+ }\r
\r
+ /**\r
+ This method initializes jTextAreaCopyright \r
+ \r
+ @return javax.swing.JTextArea \r
+ \r
+ **/\r
+ private JTextArea getJTextAreaCopyright() {\r
+ if (jTextAreaCopyright == null) {\r
+ jTextAreaCopyright = new JTextArea();\r
+ jTextAreaCopyright.setLineWrap(true);\r
+ jTextAreaCopyright.addFocusListener(this);\r
+ jTextAreaCopyright.setWrapStyleWord(true);\r
+ jTextAreaCopyright.setSelectionStart(0);\r
+ jTextAreaCopyright.setSelectionEnd(0);\r
+ jTextAreaCopyright.setBounds(new java.awt.Rectangle(0, 0, 320, 40));\r
+ jTextAreaCopyright.setToolTipText("One or more copyright lines");\r
+ }\r
+ return jTextAreaCopyright;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jComboBoxBinaryModule \r
+ * \r
+ * @return javax.swing.JComboBox \r
+ */\r
+ private JComboBox getJComboBoxBinaryModule() {\r
+ if (jComboBoxBinaryModule == null) {\r
+ jComboBoxBinaryModule = new JComboBox();\r
+ jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(160, 480, 320, 20));\r
+ jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(320, 20));\r
+ jComboBoxBinaryModule.addFocusListener(this);\r
+ jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>"\r
+ + "which can be compiled or binary <br>"\r
+ + "modules which are linked. <br>"\r
+ + "A module cannot contain both. <br>"\r
+ + "The GUID numbers should be identical <br>"\r
+ + "for a binary and source MSA, <br>"\r
+ + "but the BINARY MSA should have <br>"\r
+ + "a higher version number.</html>");\r
+ }\r
+ return jComboBoxBinaryModule;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jTextFieldOutputFileBasename \r
+ * \r
+ * @return javax.swing.JTextField \r
+ */\r
+ private JTextField getJTextFieldOutputFileBasename() {\r
+ if (jTextFieldOutputFileBasename == null) {\r
+ jTextFieldOutputFileBasename = new JTextField();\r
+ jTextFieldOutputFileBasename.setBounds(new java.awt.Rectangle(160, 455, 320, 20));\r
+ jTextFieldOutputFileBasename.setPreferredSize(new java.awt.Dimension(320, 20));\r
+ jTextFieldOutputFileBasename.addFocusListener(this);\r
+ jTextFieldOutputFileBasename.setToolTipText("Enter a single word for generated output file names");\r
+ }\r
+ return jTextFieldOutputFileBasename;\r
}\r
\r
/**\r
msa.setModuleDefinitions(md);\r
}\r
init(msa.getMsaHeader());\r
+ init(msa.getModuleDefinitions());\r
this.setVisible(true);\r
this.setViewMode(false);\r
}\r
\r
**/\r
public void setViewMode(boolean isView) {\r
- //this.jButtonOk.setVisible(false);\r
- //this.jButtonCancel.setVisible(false);\r
if (isView) {\r
this.jTextFieldBaseName.setEnabled(!isView);\r
this.jTextFieldGuid.setEnabled(!isView);\r
this.jTextFieldVersion.setEnabled(!isView);\r
this.jTextAreaLicense.setEnabled(!isView);\r
- this.jTextFieldCopyright.setEnabled(!isView);\r
+ this.jTextAreaCopyright.setEnabled(!isView);\r
this.jTextAreaDescription.setEnabled(!isView);\r
this.jTextFieldSpecification.setEnabled(!isView);\r
this.jTextFieldAbstract.setEnabled(!isView);\r
**/\r
private void init() {\r
this.setSize(500, 515);\r
- this.setPreferredSize(new java.awt.Dimension(490, 520));\r
+ this.setPreferredSize(new java.awt.Dimension(490, 615));\r
this.setContentPane(getJScrollPane());\r
this.setTitle("Module Surface Area Header");\r
initFrame();\r
jTextAreaDescription.setSelectionEnd(0);\r
}\r
if (this.msaHeader.getCopyright() != null) {\r
- this.jTextFieldCopyright.setText(this.msaHeader.getCopyright());\r
+ this.jTextAreaCopyright.setText(this.msaHeader.getCopyright());\r
}\r
if (this.msaHeader.getLicense() != null) {\r
this.jTextAreaLicense.setText(this.msaHeader.getLicense().getStringValue());\r
}\r
}\r
\r
+ /**\r
+ This method initializes this\r
+ Fill values to all fields if these values are not empty\r
+ \r
+ @param inMsaHeader The input data of MsaHeaderDocument.MsaHeader\r
+ \r
+ **/\r
+ private void init(ModuleDefinitionsDocument.ModuleDefinitions inMd) {\r
+ init();\r
+ if (inMd != null) {\r
+ this.md = inMd;\r
+ if (md.getSupportedArchitectures() != null) {\r
+ this.setSelectedItems(Tools.convertListToVector(md.getSupportedArchitectures()));\r
+ }\r
+ if (md.getBinaryModule()) {\r
+ this.jComboBoxBinaryModule.setSelectedIndex(1);\r
+ } else {\r
+ this.jComboBoxBinaryModule.setSelectedIndex(0);\r
+ }\r
+ if (md.getOutputFileBasename() != null) {\r
+ this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());\r
+ }\r
+ }\r
+ }\r
+\r
/**\r
This method initializes jContentPane\r
\r
\r
jLabelURL = new JLabel();\r
jLabelURL.setText("License URL");\r
- jLabelURL.setLocation(new java.awt.Point(15, 410));\r
+ jLabelURL.setLocation(new java.awt.Point(15, 430));\r
jLabelURL.setSize(new java.awt.Dimension(140, 20));\r
jLabelBaseName = new JLabel();\r
jLabelBaseName.setText("Module Name");\r
jLabelCopyright.setSize(new java.awt.Dimension(140, 20));\r
jLabelLicense = new JLabel();\r
jLabelLicense.setText("License");\r
- jLabelLicense.setLocation(new java.awt.Point(15, 285));\r
+ jLabelLicense.setLocation(new java.awt.Point(15, 305));\r
jLabelLicense.setSize(new java.awt.Dimension(140, 20));\r
+ jLabelOutputFileBasename = new JLabel();\r
+ jLabelOutputFileBasename.setBounds(new java.awt.Rectangle(15, 455, 140, 20));\r
+ jLabelOutputFileBasename.setText("Output File Basename");\r
+ jLabelBinaryModule = new JLabel();\r
+ jLabelBinaryModule.setBounds(new java.awt.Rectangle(15, 480, 140, 20));\r
+ jLabelBinaryModule.setText("Binary Module");\r
+ jLabelArch = new JLabel();\r
+ jLabelArch.setBounds(new java.awt.Rectangle(15, 505, 140, 20));\r
+ jLabelArch.setText("Supported Architectures");\r
jLabelSpecification = new JLabel();\r
jLabelSpecification.setText("Specification");\r
- jLabelSpecification.setLocation(new java.awt.Point(14, 435));\r
+ jLabelSpecification.setLocation(new java.awt.Point(14, 530));\r
jLabelSpecification.setSize(new java.awt.Dimension(140, 20));\r
\r
jContentPane = new JPanel();\r
jContentPane.setLayout(null);\r
- jContentPane.setPreferredSize(new java.awt.Dimension(490, 470));\r
+ jContentPane.setPreferredSize(new java.awt.Dimension(490, 565));\r
+ jContentPane.addFocusListener(this);\r
\r
jContentPane.add(jLabelBaseName, null);\r
jContentPane.add(getJTextFieldBaseName(), null);\r
jContentPane.add(getJComboBoxModuleType(), null);\r
jContentPane.add(jLabelURL, null);\r
jContentPane.add(getJTextFieldURL(), null);\r
- jContentPane.add(getJTextFieldCopyright(), null);\r
+ jContentPane.add(jLabelOutputFileBasename, null);\r
+ jContentPane.add(getJTextFieldOutputFileBasename(), null);\r
+ jContentPane.add(jLabelBinaryModule, null);\r
+ jContentPane.add(getJComboBoxBinaryModule(), null);\r
+ jContentPane.add(jLabelArch, null);\r
+\r
jStarLabel1 = new StarLabel();\r
jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
jStarLabel2 = new StarLabel();\r
jStarLabel7 = new StarLabel();\r
jStarLabel7.setLocation(new java.awt.Point(0, 260));\r
jStarLabel8 = new StarLabel();\r
- jStarLabel8.setLocation(new java.awt.Point(0, 285));\r
+ jStarLabel8.setLocation(new java.awt.Point(0, 305));\r
jStarLabel10 = new StarLabel();\r
jStarLabel10.setLocation(new java.awt.Point(0, 110));\r
jStarLabel12 = new StarLabel();\r
- jStarLabel12.setLocation(new java.awt.Point(0, 435));\r
+ jStarLabel12.setLocation(new java.awt.Point(0, 455));\r
+ jStarLabel13 = new StarLabel();\r
+ jStarLabel13.setLocation(new java.awt.Point(0, 480));\r
+ jStarLabel14 = new StarLabel();\r
+ jStarLabel14.setLocation(new java.awt.Point(0, 505));\r
+ jStarLabel15 = new StarLabel();\r
+ jStarLabel15.setLocation(new java.awt.Point(0, 530));\r
\r
jContentPane.add(jStarLabel1, null);\r
jContentPane.add(jStarLabel2, null);\r
jContentPane.add(jStarLabel8, null);\r
jContentPane.add(jStarLabel10, null);\r
jContentPane.add(jStarLabel12, null);\r
+ jContentPane.add(jStarLabel13, null);\r
+ jContentPane.add(jStarLabel14, null);\r
+ jContentPane.add(jStarLabel15, null);\r
+ jContentPane.add(getJScrollPaneCopyright(), null);\r
+\r
+ jContentPane.add(getJCheckBoxIa32(), null);\r
+ jContentPane.add(getJCheckBoxX64(), null);\r
+ jContentPane.add(getJCheckBoxIpf(), null);\r
+ jContentPane.add(getJCheckBoxEbc(), null);\r
+ jContentPane.add(getJCheckBoxArm(), null);\r
+ jContentPane.add(getJCheckBoxPpc(), null);\r
}\r
return jContentPane;\r
}\r
//\r
// Check Copyright\r
//\r
- if (isEmpty(this.jTextFieldCopyright.getText())) {\r
+ if (isEmpty(this.jTextAreaCopyright.getText())) {\r
Log.wrn("Update Msa Header", "Copyright couldn't be empty");\r
//this.jTextFieldCopyright.requestFocus();\r
return false;\r
**/\r
public void save() {\r
try {\r
- // this.msaHeader.setModuleName(this.jTextFieldBaseName.getText());\r
- // this.msaHeader.setModuleType(ModuleTypeDef.Enum.forString(this.jComboBoxModuleType.getSelectedItem()\r
- // .toString()));\r
- // this.msaHeader.setGuidValue(this.jTextFieldGuid.getText());\r
- // this.msaHeader.setVersion(this.jTextFieldVersion.getText());\r
- // this.msaHeader.setAbstract(this.jTextFieldAbstract.getText());\r
- // this.msaHeader.setDescription(this.jTextAreaDescription.getText());\r
- // this.msaHeader.setCopyright(this.jTextFieldCopyright.getText());\r
- // if (this.msaHeader.getLicense() != null) {\r
- // this.msaHeader.getLicense().setStringValue(this.jTextAreaLicense.getText());\r
- // } else {\r
- // License mLicense = License.Factory.newInstance();\r
- // mLicense.setStringValue(this.jTextAreaLicense.getText());\r
- // this.msaHeader.setLicense(mLicense);\r
- // }\r
- // if (!isEmpty(this.jTextFieldURL.getText())) {\r
- // this.msaHeader.getLicense().setURL(this.jTextFieldURL.getText());\r
- // }\r
- // this.msaHeader.setSpecification(this.jTextFieldSpecification.getText());\r
-\r
msaHeader.setSpecification(this.jTextFieldSpecification.getText());\r
msa.setMsaHeader(msaHeader);\r
+ msa.setModuleDefinitions(md);\r
this.omt.setSaved(false);\r
} catch (Exception e) {\r
Log.wrn("Save Module", e.getMessage());\r
private void initFrame() {\r
EnumerationData ed = new EnumerationData();\r
Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());\r
+ Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());\r
+ this.setSelectedItems(ed.getVSupportedArchitectures());\r
}\r
\r
/**\r
resizeComponentWidth(this.jTextFieldVersion, intCurrentWidth, intPreferredWidth);\r
resizeComponentWidth(this.jScrollPaneLicense, intCurrentWidth, intPreferredWidth);\r
resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);\r
- resizeComponentWidth(this.jTextFieldCopyright, intCurrentWidth, intPreferredWidth);\r
+ resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth);\r
resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);\r
resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);\r
resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);\r
resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);\r
+ resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth);\r
+ resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);\r
+\r
relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,\r
DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);\r
}\r
//\r
// Check Copyright\r
//\r
- if (arg0.getSource() == this.jTextFieldCopyright) {\r
- if (isEmpty(this.jTextFieldCopyright.getText())) {\r
+ if (arg0.getSource() == this.jTextAreaCopyright) {\r
+ if (isEmpty(this.jTextAreaCopyright.getText())) {\r
Log.wrn("Update Msa Header", "Copyright couldn't be empty");\r
//this.jTextFieldCopyright.requestFocus();\r
return;\r
}\r
- if (!this.jTextFieldCopyright.getText().equals(msaHeader.getCopyright())) {\r
- this.msaHeader.setCopyright(this.jTextFieldCopyright.getText());\r
+ if (!this.jTextAreaCopyright.getText().equals(msaHeader.getCopyright())) {\r
+ this.msaHeader.setCopyright(this.jTextAreaCopyright.getText());\r
} else {\r
return;\r
}\r
}\r
}\r
\r
+ //\r
+ // Check Output File Basename\r
+ //\r
+ if (arg0.getSource() == this.jTextFieldOutputFileBasename) {\r
+ if (isEmpty(this.jTextFieldOutputFileBasename.getText())) {\r
+ Log.wrn("Update Msa Header", "Output File Basename couldn't be empty");\r
+ // jTextFieldOutputFileBasename.removeFocusListener(this);\r
+ // jTextFieldOutputFileBasename.requestFocus();\r
+ // jTextFieldOutputFileBasename.addFocusListener(this);\r
+ return;\r
+ }\r
+ if (!this.jTextFieldOutputFileBasename.getText().equals(md.getOutputFileBasename())) {\r
+ this.md.setOutputFileBasename(this.jTextFieldOutputFileBasename.getText());\r
+ } else {\r
+ return;\r
+ }\r
+ }\r
+\r
+ //\r
+ // Check Binary Module Type\r
+ //\r
+ if (arg0.getSource() == this.jComboBoxBinaryModule) {\r
+ if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.TRUE)) {\r
+ if (md.getBinaryModule()) {\r
+ return;\r
+ } else {\r
+ md.setBinaryModule(true);\r
+ }\r
+ } else if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.FALSE)) {\r
+ if (md.getBinaryModule()) {\r
+ md.setBinaryModule(false);\r
+ } else {\r
+ return;\r
+ }\r
+ }\r
+ }\r
+\r
+ //\r
+ // Check Supported Arch\r
+ //\r
+ if (arg0.getSource() == this.jCheckBoxArm || arg0.getSource() == this.jCheckBoxEbc\r
+ || arg0.getSource() == this.jCheckBoxIa32 || arg0.getSource() == this.jCheckBoxIpf\r
+ || arg0.getSource() == this.jCheckBoxPpc || arg0.getSource() == this.jCheckBoxX64) {\r
+ if (!this.getSelectedItemsString().equals(md.getSupportedArchitectures().toString())) {\r
+ md.setSupportedArchitectures(this.getSelectedItemsVector());\r
+ } else {\r
+ return;\r
+ }\r
+ }\r
+\r
this.save();\r
}\r
+\r
+ private Vector<String> getSelectedItemsVector() {\r
+ Vector<String> v = new Vector<String>();\r
+ if (this.jCheckBoxIa32.isSelected()) {\r
+ v.addElement(jCheckBoxIa32.getText());\r
+ }\r
+ if (this.jCheckBoxX64.isSelected()) {\r
+ v.addElement(jCheckBoxX64.getText());\r
+ }\r
+ if (this.jCheckBoxIpf.isSelected()) {\r
+ v.addElement(jCheckBoxIpf.getText());\r
+ }\r
+ if (this.jCheckBoxEbc.isSelected()) {\r
+ v.addElement(jCheckBoxEbc.getText());\r
+ }\r
+ if (this.jCheckBoxArm.isSelected()) {\r
+ v.addElement(jCheckBoxArm.getText());\r
+ }\r
+ if (this.jCheckBoxPpc.isSelected()) {\r
+ v.addElement(jCheckBoxPpc.getText());\r
+ }\r
+ return v;\r
+ }\r
+\r
+ private String getSelectedItemsString() {\r
+ String s = "";\r
+ if (this.jCheckBoxIa32.isSelected()) {\r
+ s = s + jCheckBoxIa32.getText() + " ";\r
+ }\r
+ if (this.jCheckBoxX64.isSelected()) {\r
+ s = s + jCheckBoxX64.getText() + " ";\r
+ }\r
+ if (this.jCheckBoxIpf.isSelected()) {\r
+ s = s + jCheckBoxIpf.getText() + " ";\r
+ }\r
+ if (this.jCheckBoxEbc.isSelected()) {\r
+ s = s + jCheckBoxEbc.getText() + " ";\r
+ }\r
+ if (this.jCheckBoxArm.isSelected()) {\r
+ s = s + jCheckBoxArm.getText() + " ";\r
+ }\r
+ if (this.jCheckBoxPpc.isSelected()) {\r
+ s = s + jCheckBoxPpc.getText() + " ";\r
+ }\r
+ return s.trim();\r
+ }\r
+\r
+ private void setAllItemsSelected(boolean isSelected) {\r
+ this.jCheckBoxIa32.setSelected(isSelected);\r
+ this.jCheckBoxX64.setSelected(isSelected);\r
+ this.jCheckBoxIpf.setSelected(isSelected);\r
+ this.jCheckBoxEbc.setSelected(isSelected);\r
+ this.jCheckBoxArm.setSelected(isSelected);\r
+ this.jCheckBoxPpc.setSelected(isSelected);\r
+ }\r
+\r
+ private void setSelectedItems(Vector<String> v) {\r
+ setAllItemsSelected(false);\r
+ if (v != null) {\r
+ for (int index = 0; index < v.size(); index++) {\r
+ if (v.get(index).equals(this.jCheckBoxIa32.getText())) {\r
+ this.jCheckBoxIa32.setSelected(true);\r
+ continue;\r
+ }\r
+ if (v.get(index).equals(this.jCheckBoxIpf.getText())) {\r
+ this.jCheckBoxIpf.setSelected(true);\r
+ continue;\r
+ }\r
+ if (v.get(index).equals(this.jCheckBoxX64.getText())) {\r
+ this.jCheckBoxX64.setSelected(true);\r
+ continue;\r
+ }\r
+ if (v.get(index).equals(this.jCheckBoxEbc.getText())) {\r
+ this.jCheckBoxEbc.setSelected(true);\r
+ continue;\r
+ }\r
+ if (v.get(index).equals(this.jCheckBoxArm.getText())) {\r
+ this.jCheckBoxArm.setSelected(true);\r
+ continue;\r
+ }\r
+ if (v.get(index).equals(this.jCheckBoxPpc.getText())) {\r
+ this.jCheckBoxPpc.setSelected(true);\r
+ continue;\r
+ }\r
+ }\r
+ }\r
+ }\r
}\r
import org.apache.xmlbeans.XmlCursor;\r
import org.apache.xmlbeans.XmlException;\r
import org.tianocore.DbPathAndFilename;\r
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;\r
import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;\r
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
import org.tianocore.MsaFilesDocument.MsaFiles;\r
-import org.tianocore.MsaHeaderDocument.MsaHeader;\r
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
-import org.tianocore.PlatformHeaderDocument.PlatformHeader;\r
-import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
import org.tianocore.SourceFilesDocument.SourceFiles;\r
-import org.tianocore.SpdHeaderDocument.SpdHeader;\r
import org.tianocore.frameworkwizard.common.DataType;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
import org.tianocore.frameworkwizard.common.Log;\r
import org.tianocore.frameworkwizard.common.OpenFile;\r
import org.tianocore.frameworkwizard.common.SaveFile;\r
import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
\r
public class WorkspaceTools {\r
- //\r
- // Define class members\r
- //\r
- private FrameworkDatabase fdb = null;\r
-\r
- private Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();\r
-\r
- private Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();\r
-\r
- private Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();\r
-\r
- /**\r
- \r
- Open Framework Database file\r
- \r
- */\r
- private FrameworkDatabase openFrameworkDb() {\r
- String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
- strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
- try {\r
- fdb = OpenFile.openFrameworkDb(strFrameworkDbFilePath);\r
- } catch (XmlException e) {\r
- Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());\r
- return null;\r
- } catch (Exception e) {\r
- Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");\r
- return null;\r
- }\r
- return fdb;\r
- }\r
\r
public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {\r
- FrameworkDatabase fdb = openFrameworkDb();\r
+ //FrameworkDatabase fdb = openFrameworkDb();\r
\r
for (int i = 0; i < packageList.size(); i++) {\r
DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
item.setFarGuid(far.getGuidValue());\r
item.setStringValue(packageList.get(i));\r
- fdb.getPackageList().getFilenameList().add(item);\r
+ GlobalData.fdb.getPackageList().getFilenameList().add(item);\r
}\r
\r
for (int i = 0; i < platformList.size(); i++) {\r
DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
item.setFarGuid(far.getGuidValue());\r
item.setStringValue(platformList.get(i));\r
- fdb.getPlatformList().getFilenameList().add(item);\r
+ GlobalData.fdb.getPlatformList().getFilenameList().add(item);\r
}\r
\r
DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();\r
farItem.setFarGuid(far.getGuidValue());\r
farItem.setStringValue(far.getFarName());\r
- fdb.getFarList().getFilenameList().add(farItem);\r
+ GlobalData.fdb.getFarList().getFilenameList().add(farItem);\r
\r
String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
\r
try {\r
- SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+ SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
} catch (Exception e) {\r
Log.err("Save Database File", e.getMessage());\r
}\r
}\r
\r
public void removeFarFromDb(FarIdentification far) {\r
- FrameworkDatabase fdb = openFrameworkDb();\r
//\r
// Remove Packages\r
//\r
- XmlCursor cursor = fdb.getPackageList().newCursor();\r
+ XmlCursor cursor = GlobalData.fdb.getPackageList().newCursor();\r
cursor.toFirstChild();\r
do {\r
DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
//\r
// Remove Platforms\r
//\r
- cursor = fdb.getPlatformList().newCursor();\r
+ cursor = GlobalData.fdb.getPlatformList().newCursor();\r
cursor.toFirstChild();\r
do {\r
DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
//\r
// Remove Far\r
//\r
- cursor = fdb.getFarList().newCursor();\r
+ cursor = GlobalData.fdb.getFarList().newCursor();\r
cursor.toFirstChild();\r
do {\r
DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
try {\r
- SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+ SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
} catch (Exception e) {\r
Log.err("Save Database File", e.getMessage());\r
}\r
}\r
\r
public String getPackageFarGuid(Identification packageId) {\r
- openFrameworkDb();\r
-\r
- for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
- DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
+ for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {\r
+ DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);\r
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
File tempFile = new File(path);\r
if (tempFile.getPath().equalsIgnoreCase(packageId.getPath())) {\r
- return fdb.getPackageList().getFilenameArray(index).getFarGuid();\r
+ return GlobalData.fdb.getPackageList().getFilenameArray(index).getFarGuid();\r
}\r
}\r
\r
}\r
\r
public String getPlatformFarGuid(Identification platformId) {\r
- openFrameworkDb();\r
-\r
- for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
- DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
+ for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {\r
+ DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);\r
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
File tempFile = new File(path);\r
if (tempFile.getPath().equalsIgnoreCase(platformId.getPath())) {\r
- return fdb.getPlatformList().getFilenameArray(index).getFarGuid();\r
+ return GlobalData.fdb.getPlatformList().getFilenameArray(index).getFarGuid();\r
}\r
}\r
\r
**/\r
public Vector<String> getAllModulesOfPackage(String path) {\r
Vector<String> modulePath = new Vector<String>();\r
- try {\r
- MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();\r
- if (files != null) {\r
- for (int index = 0; index < files.getFilenameList().size(); index++) {\r
- String msaPath = files.getFilenameList().get(index);\r
- msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r
- msaPath = Tools.convertPathToCurrentOsType(msaPath);\r
- modulePath.addElement(msaPath);\r
- }\r
+ PackageIdentification id = new PackageIdentification(null, null, null, path);\r
+ MsaFiles files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id).getMsaFiles();\r
+ if (files != null) {\r
+ for (int index = 0; index < files.getFilenameList().size(); index++) {\r
+ String msaPath = files.getFilenameList().get(index);\r
+ msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r
+ msaPath = Tools.convertPathToCurrentOsType(msaPath);\r
+ modulePath.addElement(msaPath);\r
}\r
- } catch (IOException e) {\r
- Log.err("Get all mdoules of a package " + path, e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("Get all mdoules of a package " + path, e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("Get all mdoules of a package " + path, e.getMessage());\r
}\r
+\r
return modulePath;\r
}\r
\r
**/\r
public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {\r
Vector<String> includePath = new Vector<String>();\r
- try {\r
- IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes();\r
- if (files != null) {\r
- for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r
- String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();\r
- temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
- temp = Tools.convertPathToCurrentOsType(temp);\r
- includePath.addElement(temp);\r
- }\r
+ PackageIdentification id = new PackageIdentification(null, null, null, path);\r
+ IndustryStdIncludes files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id)\r
+ .getIndustryStdIncludes();\r
+ if (files != null) {\r
+ for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r
+ String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();\r
+ temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
+ temp = Tools.convertPathToCurrentOsType(temp);\r
+ includePath.addElement(temp);\r
}\r
- } catch (IOException e) {\r
- Log.err("Get all Industry Std Includes of a package " + path, e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("Get all Industry Std Includes of a package " + path, e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("Get all Industry Std Includes of a package " + path, e.getMessage());\r
}\r
return includePath;\r
}\r
\r
*/\r
public Vector<PackageIdentification> getAllPackages() {\r
- Identification id = null;\r
- vPackageList.removeAllElements();\r
-\r
- openFrameworkDb();\r
-\r
- for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
- + fdb.getPackageList().getFilenameArray(index).getStringValue();\r
- path = Tools.convertPathToCurrentOsType(path);\r
- try {\r
- id = getId(path, OpenFile.openSpdFile(path));\r
- vPackageList.addElement(new PackageIdentification(id));\r
- } catch (IOException e) {\r
- Log.err("Open Package Surface Area " + path, e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("Open Package Surface Area " + path, e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("Open Package Surface Area " + path, "Invalid file type");\r
- }\r
- }\r
- Sort.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);\r
- return vPackageList;\r
+ return GlobalData.vPackageList;\r
}\r
\r
public Vector<FarIdentification> getAllFars() {\r
- openFrameworkDb();\r
+\r
Vector<FarIdentification> v = new Vector<FarIdentification>();\r
- for (int index = 0; index < fdb.getFarList().getFilenameList().size(); index++) {\r
- DbPathAndFilename item = fdb.getFarList().getFilenameList().get(index);\r
+ for (int index = 0; index < GlobalData.fdb.getFarList().getFilenameList().size(); index++) {\r
+ DbPathAndFilename item = GlobalData.fdb.getFarList().getFilenameList().get(index);\r
FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());\r
v.addElement(far);\r
}\r
\r
public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {\r
Identification id = null;\r
- openFrameworkDb();\r
+\r
Vector<PackageIdentification> v = new Vector<PackageIdentification>();\r
\r
- for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
- DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
+ for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {\r
+ DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);\r
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
path = Tools.convertPathToCurrentOsType(path);\r
\r
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
\r
try {\r
- id = getId(path, OpenFile.openSpdFile(path));\r
+ id = Tools.getId(path, OpenFile.openSpdFile(path));\r
v.addElement(new PackageIdentification(id));\r
} catch (IOException e) {\r
Log.err("Open Package Surface Area " + path, e.getMessage());\r
\r
public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) {\r
Identification id = null;\r
- openFrameworkDb();\r
+\r
Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();\r
\r
- for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
- DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
+ for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {\r
+ DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);\r
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
path = Tools.convertPathToCurrentOsType(path);\r
\r
if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
try {\r
- id = getId(path, OpenFile.openFpdFile(path));\r
+ id = Tools.getId(path, OpenFile.openFpdFile(path));\r
v.addElement(new PlatformIdentification(id));\r
} catch (IOException e) {\r
Log.err("Open Platform Surface Area " + path, e.getMessage());\r
public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {\r
Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r
Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());\r
- Identification id = null;\r
String modulePath = null;\r
\r
for (int index = 0; index < modulePaths.size(); index++) {\r
- try {\r
- modulePath = modulePaths.get(index);\r
- id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
- } catch (IOException e) {\r
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("Open Module Surface Area " + modulePath, "Invalid file type " + e.getMessage());\r
- }\r
- v.addElement(new ModuleIdentification(id, pid));\r
+ modulePath = modulePaths.get(index);\r
+ ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(modulePath);\r
+\r
+ v.addElement(id);\r
}\r
Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
return v;\r
-\r
}\r
\r
/**\r
\r
*/\r
public Vector<ModuleIdentification> getAllModules() {\r
- vModuleList.removeAllElements();\r
- //\r
- // First get all packages\r
- //\r
- getAllPackages();\r
- Vector<String> modulePaths = new Vector<String>();\r
- Identification id = null;\r
- String packagePath = null;\r
- String modulePath = null;\r
-\r
- //\r
- // For each package, get all modules list\r
- //\r
- for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
- packagePath = vPackageList.elementAt(indexI).getPath();\r
- modulePaths = this.getAllModulesOfPackage(packagePath);\r
-\r
- for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
- try {\r
- modulePath = modulePaths.get(indexJ);\r
- id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
- vModuleList.addElement(new ModuleIdentification(id, vPackageList.elementAt(indexI)));\r
- } catch (IOException e) {\r
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("Open Module Surface Area " + modulePath, "Invalid file type");\r
- }\r
- }\r
- }\r
- Sort.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);\r
- return vModuleList;\r
+ return GlobalData.vModuleList;\r
}\r
\r
/**\r
\r
*/\r
public Vector<PlatformIdentification> getAllPlatforms() {\r
- Identification id = null;\r
- vPlatformList.removeAllElements();\r
-\r
- openFrameworkDb();\r
-\r
- for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
- String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
- + fdb.getPlatformList().getFilenameArray(index).getStringValue();\r
- path = Tools.convertPathToCurrentOsType(path);\r
- try {\r
- id = getId(path, OpenFile.openFpdFile(path));\r
- vPlatformList.addElement(new PlatformIdentification(id));\r
- } catch (IOException e) {\r
- Log.err("Open Platform Surface Area " + path, e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("Open Platform Surface Area " + path, e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
- }\r
- }\r
- Sort.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);\r
- return vPlatformList;\r
+ return GlobalData.vPlatformList;\r
}\r
\r
/**\r
}\r
\r
public Vector<String> getAllLibraryClassDefinitionsFromWorkspace() {\r
- //\r
- // First get all packages\r
- //\r
- this.getAllPackages();\r
-\r
Vector<String> vector = new Vector<String>();\r
- for (int index = 0; index < this.vPackageList.size(); index++) {\r
- try {\r
- Vector<String> v = getAllLibraryClassDefinitionsFromPackage(OpenFile\r
- .openSpdFile(vPackageList\r
- .get(index)\r
- .getPath()));\r
- if (v != null && v.size() > 0) {\r
- vector.addAll(v);\r
- }\r
- } catch (IOException e) {\r
- Log.err("getAllLibraryClassDefinitionsFromWorkspace ", e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("getAllLibraryClassDefinitionsFromWorkspace ", e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("getAllLibraryClassDefinitionsFromWorkspace ", e.getMessage());\r
+ for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+ Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList\r
+ .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+ .get(index)));\r
+ if (v != null && v.size() > 0) {\r
+ vector.addAll(v);\r
}\r
+\r
}\r
Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
public Vector<String> getAllProtocolDeclarationsFromWorkspace() {\r
- //\r
- // First get all packages\r
- //\r
- this.getAllPackages();\r
-\r
Vector<String> vector = new Vector<String>();\r
- for (int index = 0; index < this.vPackageList.size(); index++) {\r
- try {\r
- Vector<String> v = getAllProtocolDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
- .getPath()));\r
- if (v != null && v.size() > 0) {\r
- vector.addAll(v);\r
- }\r
- } catch (IOException e) {\r
- Log.err("getAllProtocolDeclarationsFromPackage", e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("getAllProtocolDeclarationsFromPackage", e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("getAllProtocolDeclarationsFromPackage", e.getMessage());\r
+ for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+ Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList\r
+ .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+ .get(index)));\r
+ if (v != null && v.size() > 0) {\r
+ vector.addAll(v);\r
}\r
}\r
Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
}\r
\r
public Vector<String> getAllPpiDeclarationsFromWorkspace() {\r
- //\r
- // First get all packages\r
- //\r
- this.getAllPackages();\r
-\r
Vector<String> vector = new Vector<String>();\r
- for (int index = 0; index < this.vPackageList.size(); index++) {\r
- try {\r
- Vector<String> v = getAllPpiDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
- .getPath()));\r
- if (v != null && v.size() > 0) {\r
- vector.addAll(v);\r
- }\r
- } catch (IOException e) {\r
- Log.err("getAllPpiDeclarationsFromWorkspace", e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("getAllPpiDeclarationsFromWorkspace", e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("getAllPpiDeclarationsFromWorkspace", e.getMessage());\r
+ for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+ Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList\r
+ .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+ .get(index)));\r
+ if (v != null && v.size() > 0) {\r
+ vector.addAll(v);\r
}\r
}\r
Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
}\r
\r
public Vector<String> getAllGuidDeclarationsFromWorkspace() {\r
- //\r
- // First get all packages\r
- //\r
- this.getAllPackages();\r
-\r
Vector<String> vector = new Vector<String>();\r
- for (int index = 0; index < this.vPackageList.size(); index++) {\r
- try {\r
- Vector<String> v = getAllGuidDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
- .getPath()));\r
- if (v != null && v.size() > 0) {\r
- vector.addAll(v);\r
- }\r
- } catch (IOException e) {\r
- Log.err("getAllGuidDeclarationsFromWorkspace", e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("getAllGuidDeclarationsFromWorkspace", e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("getAllGuidDeclarationsFromWorkspace", e.getMessage());\r
+ for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+ Vector<String> v = getAllGuidDeclarationsFromPackage(GlobalData.openingPackageList\r
+ .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+ .get(index)));\r
+ if (v != null && v.size() > 0) {\r
+ vector.addAll(v);\r
}\r
+\r
}\r
Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
public PcdVector getAllPcdDeclarationsFromWorkspace() {\r
- //\r
- // First get all packages\r
- //\r
- this.getAllPackages();\r
-\r
PcdVector vector = new PcdVector();\r
- for (int index = 0; index < this.vPackageList.size(); index++) {\r
- try {\r
- PcdVector v = getAllPcdDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index).getPath()));\r
- if (v != null && v.size() > 0) {\r
- vector.addAll(v);\r
- }\r
- } catch (IOException e) {\r
- Log.err("getAllPcdDeclarationsFromWorkspace", e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("getAllPcdDeclarationsFromWorkspace", e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("getAllPcdDeclarationsFromWorkspace", e.getMessage());\r
+ for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {\r
+ PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList\r
+ .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+ .get(index)));\r
+ if (v != null && v.size() > 0) {\r
+ vector.addAll(v);\r
}\r
+\r
}\r
Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
\r
**/\r
public PackageIdentification getPackageIdByModuleId(Identification id) {\r
- getAllPackages();\r
Vector<String> modulePaths = new Vector<String>();\r
Identification mid = null;\r
String packagePath = null;\r
//\r
// For each package, get all modules list\r
//\r
- for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
- packagePath = vPackageList.elementAt(indexI).getPath();\r
+ for (int indexI = 0; indexI < GlobalData.vPackageList.size(); indexI++) {\r
+ packagePath = GlobalData.vPackageList.elementAt(indexI).getPath();\r
modulePaths = this.getAllModulesOfPackage(packagePath);\r
for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
modulePath = modulePaths.get(indexJ);\r
- try {\r
- mid = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
- //\r
- // Check id\r
- //\r
- if (mid.equals(id)) {\r
- return vPackageList.elementAt(indexI);\r
- }\r
- } catch (IOException e) {\r
- Log.err("getPackageIdByModuleId " + id.getPath(), e.getMessage());\r
- } catch (XmlException e) {\r
- Log.err("getPackageIdByModuleId " + id.getPath(), e.getMessage());\r
- } catch (Exception e) {\r
- Log.err("getPackageIdByModuleId " + id.getPath(), e.getMessage());\r
+ mid = GlobalData.openingModuleList.getIdByPath(modulePath);\r
+ //\r
+ // Check id\r
+ //\r
+ if (mid.equals(id)) {\r
+ return GlobalData.vPackageList.elementAt(indexI);\r
}\r
+\r
}\r
}\r
\r
return null;\r
}\r
\r
- public Identification getId(String path, ModuleSurfaceArea msa) {\r
- MsaHeader head = msa.getMsaHeader();\r
- String name = head.getModuleName();\r
- String guid = head.getGuidValue();\r
- String version = head.getVersion();\r
- Identification id = new Identification(name, guid, version, path);\r
- return id;\r
- }\r
-\r
- public Identification getId(String path, PackageSurfaceArea spd) {\r
- SpdHeader head = spd.getSpdHeader();\r
- String name = head.getPackageName();\r
- String guid = head.getGuidValue();\r
- String version = head.getVersion();\r
- Identification id = new Identification(name, guid, version, path);\r
- return id;\r
- }\r
-\r
- public Identification getId(String path, PlatformSurfaceArea fpd) {\r
- PlatformHeader head = fpd.getPlatformHeader();\r
- String name = head.getPlatformName();\r
- String guid = head.getGuidValue();\r
- String version = head.getVersion();\r
- Identification id = new Identification(name, guid, version, path);\r
- return id;\r
- }\r
-\r
/**\r
Add module information to package surface area\r
\r
public void addPackageToDatabase(PackageIdentification id) throws Exception {\r
String path = id.getPath();\r
path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r
- this.openFrameworkDb();\r
+\r
DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r
filename.setStringValue(path);\r
- fdb.getPackageList().addNewFilename();\r
- fdb.getPackageList().setFilenameArray(fdb.getPackageList().sizeOfFilenameArray() - 1, filename);\r
+ GlobalData.fdb.getPackageList().addNewFilename();\r
+ GlobalData.fdb.getPackageList().setFilenameArray(GlobalData.fdb.getPackageList().sizeOfFilenameArray() - 1,\r
+ filename);\r
String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
- SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+ SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
}\r
\r
/**\r
public void addPlatformToDatabase(PlatformIdentification id) throws Exception {\r
String path = id.getPath();\r
path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r
- this.openFrameworkDb();\r
+\r
DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r
filename.setStringValue(path);\r
- fdb.getPlatformList().addNewFilename();\r
- fdb.getPlatformList().setFilenameArray(fdb.getPlatformList().sizeOfFilenameArray() - 1, filename);\r
+ GlobalData.fdb.getPlatformList().addNewFilename();\r
+ GlobalData.fdb.getPlatformList().setFilenameArray(GlobalData.fdb.getPlatformList().sizeOfFilenameArray() - 1,\r
+ filename);\r
String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
- SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+ SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
}\r
\r
/**\r
@throws Exception\r
\r
**/\r
- public Vector<String> getAllModuleFilesPath(String path) throws IOException, XmlException, Exception {\r
+ public Vector<String> getAllFilesPathOfModule(String path) {\r
Vector<String> v = new Vector<String>();\r
path = Tools.convertPathToCurrentOsType(path);\r
v.addElement(path);\r
- ModuleSurfaceArea msa = OpenFile.openMsaFile(path);\r
+ ModuleSurfaceArea msa = GlobalData.openingModuleList\r
+ .getModuleSurfaceAreaFromId(GlobalData.openingModuleList\r
+ .getIdByPath(path));\r
if (msa != null) {\r
//\r
// Get all files' path of a module\r
@throws Exception\r
\r
**/\r
- public Vector<String> getAllPakcageFilesPath(String path) throws IOException, XmlException, Exception {\r
+ public Vector<String> getAllFilesPathOfPakcage(String path) {\r
Vector<String> v = new Vector<String>();\r
path = Tools.convertPathToCurrentOsType(path);\r
//\r
f1 = new Vector<String>();\r
f1 = getAllModulesOfPackage(path);\r
for (int indexI = 0; indexI < f1.size(); indexI++) {\r
- Vector<String> f2 = getAllModuleFilesPath(f1.get(indexI));\r
+ Vector<String> f2 = getAllFilesPathOfModule(f1.get(indexI));\r
for (int indexJ = 0; indexJ < f2.size(); indexJ++) {\r
v.addElement(f2.get(indexJ));\r
}\r