mirror of https://github.com/acidanthera/audk.git
1. Restructure module description on main UI
2. Make alphabetized list for all module, package, platform names and guid_c_names git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@875 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
73b4e31adc
commit
92e2937805
|
@ -114,7 +114,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -7103240960573031772L;
|
||||
|
||||
|
||||
//
|
||||
// To save information of all files
|
||||
//
|
||||
|
@ -282,20 +282,22 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
|
||||
private JMenuItem jMenuItemHelpSearch = null;
|
||||
|
||||
private JMenuItem jMenuItemProjectInstallPackage = null;
|
||||
private JMenuItem jMenuItemProjectInstallFar = null;
|
||||
|
||||
private JMenuItem jMenuItemProjectUpdatePackage = null;
|
||||
private JMenuItem jMenuItemProjectUpdateFar = null;
|
||||
|
||||
private JMenuItem jMenuItemProjectRemovePackage = null;
|
||||
private JMenuItem jMenuItemProjectRemoveFar = null;
|
||||
|
||||
//private JToolBar jToolBarFile = null;
|
||||
|
||||
//private JToolBar jToolBarEdit = null;
|
||||
|
||||
//private JToolBar jToolBarWindow = null;
|
||||
|
||||
|
||||
private static FrameworkWizardUI fwui = null;
|
||||
|
||||
|
||||
private JMenuItem jMenuItemProjectCreateFar = null;
|
||||
|
||||
public static FrameworkWizardUI getInstance() {
|
||||
if (fwui == null) {
|
||||
fwui = new FrameworkWizardUI();
|
||||
|
@ -1262,9 +1264,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
//jMenuProject.addSeparator();
|
||||
jMenuProject.add(getJMenuItemProjectChangeWorkspace());
|
||||
jMenuProject.addSeparator();
|
||||
jMenuProject.add(getJMenuItemProjectInstallPackage());
|
||||
jMenuProject.add(getJMenuItemProjectUpdatePackage());
|
||||
jMenuProject.add(getJMenuItemProjectRemovePackage());
|
||||
jMenuProject.add(getJMenuItemProjectCreateFar());
|
||||
jMenuProject.add(getJMenuItemProjectInstallFar());
|
||||
jMenuProject.add(getJMenuItemProjectUpdateFar());
|
||||
jMenuProject.add(getJMenuItemProjectRemoveFar());
|
||||
//jMenuProject.addSeparator();
|
||||
jMenuProject.add(getJMenuProjectBuildTargets());
|
||||
}
|
||||
|
@ -1607,15 +1610,15 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
*
|
||||
* @return javax.swing.JMenuItem
|
||||
*/
|
||||
private JMenuItem getJMenuItemProjectInstallPackage() {
|
||||
if (jMenuItemProjectInstallPackage == null) {
|
||||
jMenuItemProjectInstallPackage = new JMenuItem();
|
||||
jMenuItemProjectInstallPackage.setText("Install Distribution Package");
|
||||
jMenuItemProjectInstallPackage.setMnemonic('I');
|
||||
jMenuItemProjectInstallPackage.setEnabled(false);
|
||||
jMenuItemProjectInstallPackage.addActionListener(this);
|
||||
private JMenuItem getJMenuItemProjectInstallFar() {
|
||||
if (jMenuItemProjectInstallFar == null) {
|
||||
jMenuItemProjectInstallFar = new JMenuItem();
|
||||
jMenuItemProjectInstallFar.setText("Install FAR");
|
||||
jMenuItemProjectInstallFar.setMnemonic('I');
|
||||
jMenuItemProjectInstallFar.setEnabled(true);
|
||||
jMenuItemProjectInstallFar.addActionListener(this);
|
||||
}
|
||||
return jMenuItemProjectInstallPackage;
|
||||
return jMenuItemProjectInstallFar;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1623,15 +1626,15 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
*
|
||||
* @return javax.swing.JMenuItem
|
||||
*/
|
||||
private JMenuItem getJMenuItemProjectUpdatePackage() {
|
||||
if (jMenuItemProjectUpdatePackage == null) {
|
||||
jMenuItemProjectUpdatePackage = new JMenuItem();
|
||||
jMenuItemProjectUpdatePackage.setText("Update Disstribution Package");
|
||||
jMenuItemProjectUpdatePackage.setMnemonic('U');
|
||||
jMenuItemProjectUpdatePackage.setEnabled(false);
|
||||
jMenuItemProjectUpdatePackage.addActionListener(this);
|
||||
private JMenuItem getJMenuItemProjectUpdateFar() {
|
||||
if (jMenuItemProjectUpdateFar == null) {
|
||||
jMenuItemProjectUpdateFar = new JMenuItem();
|
||||
jMenuItemProjectUpdateFar.setText("Update FAR");
|
||||
jMenuItemProjectUpdateFar.setMnemonic('U');
|
||||
jMenuItemProjectUpdateFar.setEnabled(true);
|
||||
jMenuItemProjectUpdateFar.addActionListener(this);
|
||||
}
|
||||
return jMenuItemProjectUpdatePackage;
|
||||
return jMenuItemProjectUpdateFar;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1639,15 +1642,30 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
*
|
||||
* @return javax.swing.JMenuItem
|
||||
*/
|
||||
private JMenuItem getJMenuItemProjectRemovePackage() {
|
||||
if (jMenuItemProjectRemovePackage == null) {
|
||||
jMenuItemProjectRemovePackage = new JMenuItem();
|
||||
jMenuItemProjectRemovePackage.setText("Remove Distribution Package");
|
||||
jMenuItemProjectRemovePackage.setMnemonic('R');
|
||||
jMenuItemProjectRemovePackage.setEnabled(false);
|
||||
jMenuItemProjectRemovePackage.addActionListener(this);
|
||||
private JMenuItem getJMenuItemProjectRemoveFar() {
|
||||
if (jMenuItemProjectRemoveFar == null) {
|
||||
jMenuItemProjectRemoveFar = new JMenuItem();
|
||||
jMenuItemProjectRemoveFar.setText("Remove FAR");
|
||||
jMenuItemProjectRemoveFar.setMnemonic('R');
|
||||
jMenuItemProjectRemoveFar.setEnabled(true);
|
||||
jMenuItemProjectRemoveFar.addActionListener(this);
|
||||
}
|
||||
return jMenuItemProjectRemovePackage;
|
||||
return jMenuItemProjectRemoveFar;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jMenuItemProjectCreateFar
|
||||
*
|
||||
* @return javax.swing.JMenuItem
|
||||
*/
|
||||
private JMenuItem getJMenuItemProjectCreateFar() {
|
||||
if (jMenuItemProjectCreateFar == null) {
|
||||
jMenuItemProjectCreateFar = new JMenuItem();
|
||||
jMenuItemProjectCreateFar.setText("Create FAR");
|
||||
jMenuItemProjectCreateFar.setMnemonic('C');
|
||||
jMenuItemProjectCreateFar.addActionListener(this);
|
||||
}
|
||||
return jMenuItemProjectCreateFar;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1695,7 +1713,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
this.addComponentListener(this);
|
||||
this.getCompontentsFromFrameworkDatabase();
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]");
|
||||
this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
|
||||
+ Workspace.getCurrentWorkspace() + "]");
|
||||
this.setExitType(1);
|
||||
|
||||
//
|
||||
|
@ -1766,10 +1785,26 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
changeWorkspace();
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jMenuItemProjectCreateFar) {
|
||||
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jMenuItemProjectInstallFar) {
|
||||
this.closeAll();
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jMenuItemProjectRemoveFar) {
|
||||
this.closeAll();
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jMenuItemProjectUpdateFar) {
|
||||
this.closeAll();
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jMenuItemToolsClone) {
|
||||
cloneItem();
|
||||
}
|
||||
|
||||
|
||||
if (arg0.getSource() == jMenuItemToolsToolChainConfiguration) {
|
||||
setupToolChainConfiguration();
|
||||
}
|
||||
|
@ -1794,14 +1829,56 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
// Make Module Description
|
||||
dmtnModuleDescription = new IDefaultMutableTreeNode("ModuleDescription", IDefaultMutableTreeNode.MODULE, -1);
|
||||
|
||||
if (this.vModuleList.size() > 0) {
|
||||
for (int index = 0; index < this.vModuleList.size(); index++) {
|
||||
dmtnModuleDescription.add(new IDefaultMutableTreeNode(this.vModuleList.elementAt(index).getName(),
|
||||
IDefaultMutableTreeNode.MSA_HEADER, false,
|
||||
this.vModuleList.elementAt(index)));
|
||||
//
|
||||
// First add package
|
||||
//
|
||||
if (this.vPackageList.size() > 0) {
|
||||
for (int index = 0; index < this.vPackageList.size(); index++) {
|
||||
IDefaultMutableTreeNode dmtnModulePackage = null;
|
||||
IDefaultMutableTreeNode dmtnModulePackageLibrary = null;
|
||||
IDefaultMutableTreeNode dmtnModulePackageModule = null;
|
||||
|
||||
dmtnModulePackage = new IDefaultMutableTreeNode(this.vPackageList.elementAt(index).getName(),
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE, false,
|
||||
this.vPackageList.elementAt(index));
|
||||
dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library",
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
|
||||
false, this.vPackageList.elementAt(index));
|
||||
dmtnModulePackageModule = new IDefaultMutableTreeNode("Module",
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
|
||||
false, this.vPackageList.elementAt(index));
|
||||
|
||||
Vector<ModuleIdentification> vModule = wt.getAllModules(this.vPackageList.elementAt(index));
|
||||
for (int indexJ = 0; indexJ < vModule.size(); indexJ++) {
|
||||
if (vModule.get(indexJ).isLibrary()) {
|
||||
dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
|
||||
IDefaultMutableTreeNode.MSA_HEADER,
|
||||
false, vModule.get(indexJ)));
|
||||
} else {
|
||||
dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(),
|
||||
IDefaultMutableTreeNode.MSA_HEADER,
|
||||
false, vModule.get(indexJ)));
|
||||
}
|
||||
}
|
||||
if (dmtnModulePackageModule.getChildCount() > 0) {
|
||||
dmtnModulePackage.add(dmtnModulePackageModule);
|
||||
}
|
||||
if (dmtnModulePackageLibrary.getChildCount() > 0) {
|
||||
dmtnModulePackage.add(dmtnModulePackageLibrary);
|
||||
}
|
||||
|
||||
dmtnModuleDescription.add(dmtnModulePackage);
|
||||
}
|
||||
}
|
||||
|
||||
// if (this.vModuleList.size() > 0) {
|
||||
// for (int index = 0; index < this.vModuleList.size(); index++) {
|
||||
// dmtnModuleDescription.add(new IDefaultMutableTreeNode(this.vModuleList.elementAt(index).getName(),
|
||||
// IDefaultMutableTreeNode.MSA_HEADER, false,
|
||||
// this.vModuleList.elementAt(index)));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Make Package Description
|
||||
dmtnPackageDescription = new IDefaultMutableTreeNode("PackageDescription", IDefaultMutableTreeNode.PACKAGE, -1);
|
||||
if (this.vPackageList.size() > 0) {
|
||||
|
@ -1938,6 +2015,147 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
fc.addChoosableFileFilter(new IFileFilter(ext));
|
||||
return fc.showSaveDialog(new JPanel());
|
||||
}
|
||||
|
||||
/**
|
||||
Open Module
|
||||
|
||||
@param path input file path
|
||||
|
||||
**/
|
||||
private void openModule(String path, ModuleIdentification moduleId) {
|
||||
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
|
||||
try {
|
||||
msa = OpenFile.openMsaFile(path);
|
||||
} catch (IOException e) {
|
||||
Log.err("Open Module Surface Area " + path, e.getMessage());
|
||||
return;
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Module Surface Area " + path, e.getMessage());
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Module Surface Area " + path, "Invalid file type");
|
||||
return;
|
||||
}
|
||||
Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(),
|
||||
msa.getMsaHeader().getVersion(), path);
|
||||
//
|
||||
// Generate module id
|
||||
//
|
||||
PackageIdentification pid = wt.getPackageIdByModuleId(id);
|
||||
if (pid != null) {
|
||||
//
|
||||
// To judge if the module existed in vModuleList
|
||||
// If not, add it to vModuleList
|
||||
//
|
||||
boolean isFind = false;
|
||||
for (int index = 0; index < vModuleList.size(); index++) {
|
||||
if (vModuleList.elementAt(index).equals(id)) {
|
||||
isFind = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isFind) {
|
||||
ModuleIdentification mid = new ModuleIdentification(id, pid, moduleId.isLibrary());
|
||||
vModuleList.addElement(mid);
|
||||
//
|
||||
// Add new MsaHeader node to the tree
|
||||
//
|
||||
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(),
|
||||
IDefaultMutableTreeNode.MSA_HEADER, true,
|
||||
mid);
|
||||
//
|
||||
// First find the module belongs to which package
|
||||
//
|
||||
IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE);
|
||||
//
|
||||
// To check if has module node or library node
|
||||
//
|
||||
IDefaultMutableTreeNode parentModuleNode = null;
|
||||
IDefaultMutableTreeNode parentLibraryNode = null;
|
||||
boolean hasModule = false;
|
||||
boolean hasLibrary = false;
|
||||
for (int index = 0; index < packageNode.getChildCount(); index++) {
|
||||
IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
|
||||
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
|
||||
hasLibrary = true;
|
||||
parentLibraryNode = iNode;
|
||||
}
|
||||
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
|
||||
hasModule = true;
|
||||
parentModuleNode = iNode;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If is a module
|
||||
//
|
||||
if (!mid.isLibrary()) {
|
||||
//
|
||||
// Create parent node first if has no parent node
|
||||
//
|
||||
if (!hasModule) {
|
||||
parentModuleNode = new IDefaultMutableTreeNode("Module",
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
|
||||
false, mid.getPackageId());
|
||||
iTree.addNode(packageNode, parentModuleNode);
|
||||
}
|
||||
|
||||
iTree.addNode(parentModuleNode, node);
|
||||
}
|
||||
|
||||
//
|
||||
// If is a Library
|
||||
//
|
||||
if (mid.isLibrary()) {
|
||||
//
|
||||
// Create parent node first if has no parent node
|
||||
//
|
||||
if (!hasLibrary) {
|
||||
parentLibraryNode = new IDefaultMutableTreeNode("Library",
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
|
||||
false, mid.getPackageId());
|
||||
iTree.addNode(packageNode, parentLibraryNode);
|
||||
}
|
||||
|
||||
iTree.addNode(parentLibraryNode, node);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
// The module is not in existing packages
|
||||
//
|
||||
Log.err("The module hasn't been added to any package of current workspace!");
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Make the node selected
|
||||
//
|
||||
iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,
|
||||
IDefaultMutableTreeNode.MSA_HEADER)));
|
||||
//
|
||||
// Update opening Module list information
|
||||
//
|
||||
if (!openingModuleList.existsModule(id)) {
|
||||
//
|
||||
// Insert sub node of module
|
||||
//
|
||||
insertModuleTreeNode(id);
|
||||
iTree.getSelectNode().setOpening(true);
|
||||
|
||||
//
|
||||
// Update opening module list
|
||||
//
|
||||
openingModuleList.insertToOpeningModuleList(id, msa);
|
||||
openingModuleList.setTreePathById(id, iTree.getSelectionPath());
|
||||
}
|
||||
//
|
||||
// Show msa header in editor panel
|
||||
//
|
||||
showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id));
|
||||
this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
Open Module
|
||||
|
@ -1978,14 +2196,71 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
}
|
||||
}
|
||||
if (!isFind) {
|
||||
vModuleList.addElement(new ModuleIdentification(id, pid));
|
||||
ModuleIdentification mid = new ModuleIdentification(id, pid);
|
||||
vModuleList.addElement(mid);
|
||||
//
|
||||
// Add new MsaHeader node to the tree
|
||||
//
|
||||
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vModuleList.lastElement().getName(),
|
||||
IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(),
|
||||
IDefaultMutableTreeNode.MSA_HEADER, true,
|
||||
vModuleList.lastElement());
|
||||
iTree.addNode(dmtnModuleDescription, node);
|
||||
mid);
|
||||
//
|
||||
// First find the module belongs to which package
|
||||
//
|
||||
IDefaultMutableTreeNode packageNode = iTree.getNodeById(dmtnModuleDescription, mid.getPackageId(),
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE);
|
||||
//
|
||||
// To check if has module node or library node
|
||||
//
|
||||
IDefaultMutableTreeNode parentModuleNode = null;
|
||||
IDefaultMutableTreeNode parentLibraryNode = null;
|
||||
boolean hasModule = false;
|
||||
boolean hasLibrary = false;
|
||||
for (int index = 0; index < packageNode.getChildCount(); index++) {
|
||||
IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) packageNode.getChildAt(index);
|
||||
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY) {
|
||||
hasLibrary = true;
|
||||
parentLibraryNode = iNode;
|
||||
}
|
||||
if (iNode.getCategory() == IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE) {
|
||||
hasModule = true;
|
||||
parentModuleNode = iNode;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If is a module
|
||||
//
|
||||
if (!mid.isLibrary()) {
|
||||
//
|
||||
// Create parent node first if has no parent node
|
||||
//
|
||||
if (!hasModule) {
|
||||
parentModuleNode = new IDefaultMutableTreeNode("Module",
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE,
|
||||
false, mid.getPackageId());
|
||||
iTree.addNode(packageNode, parentModuleNode);
|
||||
}
|
||||
|
||||
iTree.addNode(parentModuleNode, node);
|
||||
}
|
||||
|
||||
//
|
||||
// If is a Library
|
||||
//
|
||||
if (mid.isLibrary()) {
|
||||
//
|
||||
// Create parent node first if has no parent node
|
||||
//
|
||||
if (!hasLibrary) {
|
||||
parentLibraryNode = new IDefaultMutableTreeNode("Library",
|
||||
IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY,
|
||||
false, mid.getPackageId());
|
||||
iTree.addNode(packageNode, parentLibraryNode);
|
||||
}
|
||||
|
||||
iTree.addNode(parentLibraryNode, node);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//
|
||||
|
@ -1994,7 +2269,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
Log.err("The module hasn't been added to any package of current workspace!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Make the node selected
|
||||
//
|
||||
iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id,
|
||||
|
@ -2311,7 +2587,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
}
|
||||
|
||||
private void insertPlatformTreeNode(Identification id) {
|
||||
iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions", IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id));
|
||||
iTree.addNode(new IDefaultMutableTreeNode("Platform Definitions",
|
||||
IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS, true, id));
|
||||
iTree.addNode(new IDefaultMutableTreeNode("Flash", IDefaultMutableTreeNode.FPD_FLASH, true, id));
|
||||
iTree.addNode(new IDefaultMutableTreeNode("Framework Modules", IDefaultMutableTreeNode.FPD_FRAMEWORKMODULES,
|
||||
true, id));
|
||||
|
@ -2378,10 +2655,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
@param elementType
|
||||
@param fpd
|
||||
|
||||
**/
|
||||
**/
|
||||
private void showPlatformElement(int elementType, OpeningPlatformType fpd) {
|
||||
this.cleanDesktopPanePlatform();
|
||||
|
||||
|
||||
switch (elementType) {
|
||||
case IDefaultMutableTreeNode.FPD_PLATFORMDEFINITIONS:
|
||||
FpdPlatformDefs frmFpdPlatformDefs = new FpdPlatformDefs(fpd);
|
||||
|
@ -2596,7 +2873,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
this.openModule(smb.getMid().getPath());
|
||||
this.openModule(smb.getMid().getPath(), smb.getMid());
|
||||
}
|
||||
} else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
|
||||
//
|
||||
|
@ -2884,27 +3161,28 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
// Reinit whole window
|
||||
//
|
||||
closeAll();
|
||||
this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]");
|
||||
this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- ["
|
||||
+ Workspace.getCurrentWorkspace() + "]");
|
||||
}
|
||||
sw.dispose();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Show Tool Chain Configuration Dialog to setup Tool Chain
|
||||
|
||||
**/
|
||||
Show Tool Chain Configuration Dialog to setup Tool Chain
|
||||
|
||||
**/
|
||||
private void setupToolChainConfiguration() {
|
||||
ToolChainConfig tcc = ToolChainConfig.getInstance();
|
||||
tcc.showDialog();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clone selected item
|
||||
|
||||
**/
|
||||
private void cloneItem() {
|
||||
int mode = -1;
|
||||
|
||||
|
||||
//
|
||||
// Check if there is any item can be cloned
|
||||
//
|
||||
|
@ -2919,7 +3197,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
Log.err("Please select a target to clone!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (category == IDefaultMutableTreeNode.WORKSPACE) {
|
||||
mode = DataType.RETURN_TYPE_WORKSPACE;
|
||||
id = null;
|
||||
|
@ -2933,10 +3211,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele
|
|||
if (category >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) {
|
||||
mode = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
|
||||
}
|
||||
|
||||
|
||||
Clone c = new Clone(this, true, mode, id);
|
||||
int result = c.showDialog();
|
||||
|
||||
|
||||
if (result == DataType.RETURN_TYPE_CANCEL) {
|
||||
c.dispose();
|
||||
}
|
||||
|
|
|
@ -15,10 +15,12 @@
|
|||
**/
|
||||
package org.tianocore.frameworkwizard;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
|
@ -46,6 +48,7 @@ import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
|||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
import org.tianocore.frameworkwizard.workspace.Workspace;
|
||||
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
import javax.swing.JRadioButton;
|
||||
|
||||
public class SelectModuleBelong extends IDialog {
|
||||
|
||||
|
@ -55,7 +58,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
**/
|
||||
private static final long serialVersionUID = 4171355136991448972L;
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,54"
|
||||
|
||||
private JComboBox jComboBoxExistingPackage = null;
|
||||
|
||||
|
@ -96,6 +99,8 @@ public class SelectModuleBelong extends IDialog {
|
|||
private StarLabel jStarLabel4 = null;
|
||||
|
||||
private StarLabel jStarLabel5 = null;
|
||||
|
||||
private ButtonGroup bg = new ButtonGroup();
|
||||
|
||||
private WorkspaceTools wt = new WorkspaceTools();
|
||||
|
||||
|
@ -107,6 +112,12 @@ public class SelectModuleBelong extends IDialog {
|
|||
|
||||
private int mode = -1;
|
||||
|
||||
private JLabel jLabelIsLibrary = null;
|
||||
|
||||
private JRadioButton jRadioButtonYes = null;
|
||||
|
||||
private JRadioButton jRadioButtonNo = null;
|
||||
|
||||
/**
|
||||
* This method initializes jComboBoxExistingPackage
|
||||
*
|
||||
|
@ -128,7 +139,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JButton getJButtonOk() {
|
||||
if (jButtonOk == null) {
|
||||
jButtonOk = new JButton();
|
||||
jButtonOk.setBounds(new java.awt.Rectangle(310, 140, 80, 20));
|
||||
jButtonOk.setBounds(new java.awt.Rectangle(310, 165, 80, 20));
|
||||
jButtonOk.setText("Ok");
|
||||
jButtonOk.addActionListener(this);
|
||||
}
|
||||
|
@ -143,7 +154,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JButton getJButtonCancel() {
|
||||
if (jButtonCancel == null) {
|
||||
jButtonCancel = new JButton();
|
||||
jButtonCancel.setBounds(new java.awt.Rectangle(395, 140, 80, 20));
|
||||
jButtonCancel.setBounds(new java.awt.Rectangle(395, 165, 80, 20));
|
||||
jButtonCancel.setText("Cancel");
|
||||
jButtonCancel.addActionListener(this);
|
||||
}
|
||||
|
@ -158,7 +169,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JTextField getJTextFieldFilePath() {
|
||||
if (jTextFieldFilePath == null) {
|
||||
jTextFieldFilePath = new JTextField();
|
||||
jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 35, 250, 20));
|
||||
jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 60, 250, 20));
|
||||
}
|
||||
return jTextFieldFilePath;
|
||||
}
|
||||
|
@ -171,7 +182,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JButton getJButtonBrowse() {
|
||||
if (jButtonBrowse == null) {
|
||||
jButtonBrowse = new JButton();
|
||||
jButtonBrowse.setBounds(new java.awt.Rectangle(395, 35, 85, 20));
|
||||
jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20));
|
||||
jButtonBrowse.setText("Browse");
|
||||
jButtonBrowse.addActionListener(this);
|
||||
}
|
||||
|
@ -186,7 +197,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JTextField getJTextFieldName() {
|
||||
if (jTextFieldName == null) {
|
||||
jTextFieldName = new JTextField();
|
||||
jTextFieldName.setBounds(new java.awt.Rectangle(140, 60, 340, 20));
|
||||
jTextFieldName.setBounds(new java.awt.Rectangle(140, 85, 340, 20));
|
||||
}
|
||||
return jTextFieldName;
|
||||
}
|
||||
|
@ -199,7 +210,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JTextField getJTextFieldGuid() {
|
||||
if (jTextFieldGuid == null) {
|
||||
jTextFieldGuid = new JTextField();
|
||||
jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 85, 250, 20));
|
||||
jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 110, 250, 20));
|
||||
}
|
||||
return jTextFieldGuid;
|
||||
}
|
||||
|
@ -212,7 +223,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JButton getJButtonGen() {
|
||||
if (jButtonGen == null) {
|
||||
jButtonGen = new JButton();
|
||||
jButtonGen.setBounds(new java.awt.Rectangle(395, 85, 85, 20));
|
||||
jButtonGen.setBounds(new java.awt.Rectangle(395, 110, 85, 20));
|
||||
jButtonGen.setText("GEN");
|
||||
jButtonGen.addActionListener(this);
|
||||
}
|
||||
|
@ -227,11 +238,41 @@ public class SelectModuleBelong extends IDialog {
|
|||
private JTextField getJTextFieldVersion() {
|
||||
if (jTextFieldVersion == null) {
|
||||
jTextFieldVersion = new JTextField();
|
||||
jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 110, 340, 20));
|
||||
jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 135, 340, 20));
|
||||
}
|
||||
return jTextFieldVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonYes
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonYes() {
|
||||
if (jRadioButtonYes == null) {
|
||||
jRadioButtonYes = new JRadioButton();
|
||||
jRadioButtonYes.setBounds(new java.awt.Rectangle(140,35,100,20));
|
||||
jRadioButtonYes.setSelected(true);
|
||||
jRadioButtonYes.setText("Yes");
|
||||
}
|
||||
return jRadioButtonYes;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonNo
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonNo() {
|
||||
if (jRadioButtonNo == null) {
|
||||
jRadioButtonNo = new JRadioButton();
|
||||
jRadioButtonNo.setBounds(new java.awt.Rectangle(300,35,110,20));
|
||||
jRadioButtonNo.setSelected(false);
|
||||
jRadioButtonNo.setText("No");
|
||||
}
|
||||
return jRadioButtonNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
|
@ -260,6 +301,23 @@ public class SelectModuleBelong extends IDialog {
|
|||
this.jStarLabel1.setVisible(false);
|
||||
this.jLabelPackage.setVisible(false);
|
||||
this.jComboBoxExistingPackage.setVisible(false);
|
||||
this.jLabelIsLibrary.setVisible(false);
|
||||
this.jRadioButtonYes.setVisible(false);
|
||||
this.jRadioButtonNo.setVisible(false);
|
||||
upLocation(this.jStarLabel2, 50);
|
||||
upLocation(this.jStarLabel3, 50);
|
||||
upLocation(this.jStarLabel4, 50);
|
||||
upLocation(this.jStarLabel5, 50);
|
||||
upLocation(this.jLabelFilePath, 50);
|
||||
upLocation(this.jLabelName, 50);
|
||||
upLocation(this.jLabelGuid, 50);
|
||||
upLocation(this.jLabelVersion, 50);
|
||||
upLocation(this.jTextFieldFilePath, 50);
|
||||
upLocation(this.jTextFieldName, 50);
|
||||
upLocation(this.jTextFieldGuid, 50);
|
||||
upLocation(this.jTextFieldVersion, 50);
|
||||
upLocation(this.jButtonBrowse, 50);
|
||||
upLocation(this.jButtonGen, 50);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +327,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
* @return void
|
||||
*/
|
||||
private void init() {
|
||||
this.setSize(500, 200);
|
||||
this.setSize(500, 230);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setTitle("New");
|
||||
this.centerWindow();
|
||||
|
@ -282,24 +340,27 @@ public class SelectModuleBelong extends IDialog {
|
|||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jLabelIsLibrary = new JLabel();
|
||||
jLabelIsLibrary.setBounds(new java.awt.Rectangle(15,35,120,20));
|
||||
jLabelIsLibrary.setText("Is a Library");
|
||||
jLabelVersion = new JLabel();
|
||||
jLabelVersion.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
|
||||
jLabelVersion.setBounds(new java.awt.Rectangle(15, 135, 120, 20));
|
||||
jLabelVersion.setText("Version");
|
||||
jLabelGuid = new JLabel();
|
||||
jLabelGuid.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
|
||||
jLabelGuid.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
|
||||
jLabelGuid.setText("Guid");
|
||||
jLabelName = new JLabel();
|
||||
jLabelName.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
|
||||
jLabelName.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
|
||||
jLabelName.setText("Name");
|
||||
jLabelFilePath = new JLabel();
|
||||
jLabelFilePath.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
|
||||
jLabelFilePath.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
|
||||
jLabelFilePath.setText("File Path");
|
||||
jLabelPackage = new JLabel();
|
||||
jLabelPackage.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
|
||||
jLabelPackage.setText("Choose Package");
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.setSize(new java.awt.Dimension(490, 175));
|
||||
jContentPane.setSize(new java.awt.Dimension(490,198));
|
||||
jContentPane.add(getJComboBoxExistingPackage(), null);
|
||||
jContentPane.add(getJButtonOk(), null);
|
||||
jContentPane.add(getJButtonCancel(), null);
|
||||
|
@ -318,18 +379,23 @@ public class SelectModuleBelong extends IDialog {
|
|||
jStarLabel1 = new StarLabel();
|
||||
jStarLabel1.setLocation(new java.awt.Point(0, 10));
|
||||
jStarLabel2 = new StarLabel();
|
||||
jStarLabel2.setLocation(new java.awt.Point(0, 35));
|
||||
jStarLabel2.setLocation(new java.awt.Point(0, 60));
|
||||
jStarLabel3 = new StarLabel();
|
||||
jStarLabel3.setLocation(new java.awt.Point(0, 60));
|
||||
jStarLabel3.setLocation(new java.awt.Point(0, 85));
|
||||
jStarLabel4 = new StarLabel();
|
||||
jStarLabel4.setLocation(new java.awt.Point(0, 85));
|
||||
jStarLabel4.setLocation(new java.awt.Point(0, 110));
|
||||
jStarLabel5 = new StarLabel();
|
||||
jStarLabel5.setLocation(new java.awt.Point(0, 110));
|
||||
jStarLabel5.setLocation(new java.awt.Point(0, 135));
|
||||
jContentPane.add(jStarLabel1, null);
|
||||
jContentPane.add(jStarLabel2, null);
|
||||
jContentPane.add(jStarLabel3, null);
|
||||
jContentPane.add(jStarLabel4, null);
|
||||
jContentPane.add(jStarLabel5, null);
|
||||
jContentPane.add(jLabelIsLibrary, null);
|
||||
jContentPane.add(getJRadioButtonYes(), null);
|
||||
jContentPane.add(getJRadioButtonNo(), null);
|
||||
bg.add(getJRadioButtonNo());
|
||||
bg.add(getJRadioButtonYes());
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
@ -543,7 +609,7 @@ public class SelectModuleBelong extends IDialog {
|
|||
// Save to identification
|
||||
//
|
||||
mid = new ModuleIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
|
||||
this.jTextFieldVersion.getText(), path);
|
||||
this.jTextFieldVersion.getText(), path, jRadioButtonYes.isSelected());
|
||||
mid.setPackageId(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()));
|
||||
}
|
||||
|
||||
|
@ -660,4 +726,8 @@ public class SelectModuleBelong extends IDialog {
|
|||
public void setPid(PackageIdentification pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
private void upLocation(Component c, int size) {
|
||||
c.setLocation(c.getLocation().x, c.getLocation().y - size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,12 +113,7 @@ public class ToolChainConfig extends IFrame implements ListSelectionListener, Ta
|
|||
**/
|
||||
private JTable getJTable() {
|
||||
if (jTable == null) {
|
||||
// Vector<String> vTableHeader = new Vector<String>();
|
||||
// vTableHeader.addElement("Name");
|
||||
// vTableHeader.addElement("Value");
|
||||
//
|
||||
model = new DefaultTableModel();
|
||||
//model = new DefaultTableModel(vTableHeader);
|
||||
jTable = new JTable(model);
|
||||
jTable.setRowHeight(20);
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ public class DataType {
|
|||
|
||||
public static final int RETURN_TYPE_WORKSPACE = 15;
|
||||
|
||||
public static final int RETURN_TYPE_TEXT = 16;
|
||||
|
||||
|
||||
//
|
||||
// Define all used final variables
|
||||
|
@ -97,6 +99,12 @@ public class DataType {
|
|||
|
||||
public static final String ANT_BUILD_FILE_EXT_DESCRIPTION = ANT_BUILD_FILE + " (*." + ANT_BUILD_FILE_EXT + ")";
|
||||
|
||||
public static final String TEXT_FILE = "Text File";
|
||||
|
||||
public static final String TEXT_FILE_EXT = "txt";
|
||||
|
||||
public static final String TEXT_FILE_EXT_DESCRIPTION = TEXT_FILE + " (*." + TEXT_FILE_EXT + ")";
|
||||
|
||||
//
|
||||
// Define file separator for current OS
|
||||
//
|
||||
|
@ -171,4 +179,17 @@ public class DataType {
|
|||
|
||||
public static final String PROJECT_VERSION = "1.0";
|
||||
|
||||
//
|
||||
// Sort Type
|
||||
//
|
||||
public static final int SORT_TYPE_ASCENDING = 1;
|
||||
|
||||
public static final int SORT_TYPE_DESCENDING = 2;
|
||||
|
||||
//
|
||||
// Module Type
|
||||
//
|
||||
public static final String MODULE_TYPE_LIBRARY = "Library";
|
||||
|
||||
public static final String MODULE_TYPE_MODULE = "Module";
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ public class DataValidation {
|
|||
|
||||
**/
|
||||
public static boolean isVersionDataType(String arg0) {
|
||||
return isMatch("(\\d)+(.)?(\\d)+", arg0);
|
||||
return isMatch("\\d+(\\.\\d+)*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/** @file
|
||||
|
||||
The file is used to override DefaultTableModel to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
public class IDefaultTableModel extends DefaultTableModel {
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
private static final long serialVersionUID = -1782544418084080185L;
|
||||
|
||||
public IDefaultTableModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.table.TableModel#isCellEditable(int, int)
|
||||
*
|
||||
*/
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -81,6 +81,8 @@ public class IFileFilter extends FileFilter {
|
|||
return DataType.PACKAGE_SURFACE_AREA_EXT_DESCRIPTION;
|
||||
if (strExt.equals(DataType.PLATFORM_SURFACE_AREA_EXT))
|
||||
return DataType.PLATFORM_SURFACE_AREA_EXT_DESCRIPTION;
|
||||
if (strExt.equals(DataType.TEXT_FILE_EXT))
|
||||
return DataType.TEXT_FILE_EXT_DESCRIPTION;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,15 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
|
||||
/**
|
||||
The class is used to provides some useful interfaces
|
||||
|
||||
|
@ -44,6 +50,25 @@ public class Tools {
|
|||
**/
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getCurrentDateTime());
|
||||
// Vector<String> v = new Vector<String>();
|
||||
// Vector<String> v1 = new Vector<String>();
|
||||
//
|
||||
// v.addElement("CAC");
|
||||
// v1.addElement("1111");
|
||||
// v.addElement("1AC");
|
||||
// v1.addElement("2222");
|
||||
// v.addElement("ABC");
|
||||
// v1.addElement("3333");
|
||||
// v.addElement("0C");
|
||||
// v1.addElement("4444");
|
||||
// v.addElement("AAC");
|
||||
// v1.addElement("5555");
|
||||
// Vector<Integer> vs = new Vector<Integer>();
|
||||
// vs = Tools.getVectorSortSequence(v, DataType.Sort_Type_Ascending);
|
||||
// Tools.sortVectorString(v1, Tools.getVectorSortSequence(v, DataType.Sort_Type_Ascending));
|
||||
//
|
||||
// Tools.sortVectorString(v, DataType.Sort_Type_Ascending);
|
||||
// Tools.sortVectorString(v, DataType.Sort_Type_Descending);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,6 +166,27 @@ public class Tools {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Generate selection items for JList by input vector
|
||||
|
||||
**/
|
||||
public static void generateListByVector(JList jl, Vector<String> vector) {
|
||||
if (jl != null) {
|
||||
DefaultListModel listModel = (DefaultListModel) jl.getModel();
|
||||
listModel.removeAllElements();
|
||||
|
||||
if (vector != null) {
|
||||
for (int index = 0; index < vector.size(); index++) {
|
||||
listModel.addElement(vector.get(index));
|
||||
}
|
||||
}
|
||||
|
||||
if (listModel.size() > 0) {
|
||||
jl.setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get path only from a path
|
||||
|
@ -255,6 +301,9 @@ public class Tools {
|
|||
if (type == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
|
||||
match = DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT;
|
||||
}
|
||||
if (type == DataType.RETURN_TYPE_TEXT) {
|
||||
match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT;
|
||||
}
|
||||
if (path.length() <= match.length()) {
|
||||
path = path + match;
|
||||
return path;
|
||||
|
@ -274,18 +323,180 @@ public class Tools {
|
|||
public static void showInformationMessage(String arg0) {
|
||||
JOptionPane.showConfirmDialog(null, arg0, "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
if the string doesn't end with a file separator, append it to the string
|
||||
|
||||
@param arg0
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String addFileSeparator(String arg0) {
|
||||
if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {
|
||||
arg0 = arg0 + DataType.FILE_SEPARATOR;
|
||||
}
|
||||
return arg0;
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all elements in the vector as the specific sort type
|
||||
|
||||
@param v The vector need to be sorted
|
||||
@param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
|
||||
|
||||
**/
|
||||
public static void sortVectorString(Vector<String> v, int mode) {
|
||||
if (v != null) {
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
String temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all elements of vector and return sorted sequence
|
||||
|
||||
@param v The vector need to be sorted
|
||||
@param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
|
||||
@return Vector<Integer> The sorted sequence
|
||||
|
||||
**/
|
||||
public static Vector<Integer> getVectorSortSequence(Vector<String> v, int mode) {
|
||||
Vector<Integer> vSequence = new Vector<Integer>();
|
||||
//
|
||||
// Init sequence
|
||||
//
|
||||
if (v != null) {
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
vSequence.addElement(index);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// sort and get new sequence
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
//
|
||||
// Swap strings
|
||||
//
|
||||
String tempStr = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(tempStr, indexJ);
|
||||
|
||||
//
|
||||
// Swap sequences
|
||||
//
|
||||
int tempInt = vSequence.get(indexI);
|
||||
vSequence.setElementAt(vSequence.get(indexJ), indexI);
|
||||
vSequence.setElementAt(tempInt, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vSequence;
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all elements of vector as input sequence
|
||||
|
||||
@param v The vector need to be sorted
|
||||
@param vSequence The sort sequence should be followed
|
||||
|
||||
**/
|
||||
public static void sortVectorString(Vector<String> v, Vector<Integer> vSequence) {
|
||||
if (v != null && vSequence != null && v.size() == vSequence.size()) {
|
||||
Vector<String> tempV = new Vector<String>();
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
tempV.addElement(v.get(index));
|
||||
}
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
v.setElementAt(tempV.get(vSequence.get(index)), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
if the string doesn't end with a file separator, append it to the string
|
||||
Sort all modules
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
@param arg0
|
||||
@return
|
||||
**/
|
||||
public static void sortModules(Vector<ModuleIdentification> v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
ModuleIdentification temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all packages
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static String addFileSeparator(String arg0) {
|
||||
if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {
|
||||
arg0 = arg0 + DataType.FILE_SEPARATOR;
|
||||
public static void sortPackages(Vector<PackageIdentification> v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
PackageIdentification temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return arg0;
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all platforms
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortPlatforms(Vector<PlatformIdentification> v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
PlatformIdentification temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,6 +115,12 @@ public class IDefaultMutableTreeNode extends DefaultMutableTreeNode {
|
|||
public static final int PACKAGE = 2;
|
||||
|
||||
public static final int PLATFORM = 3;
|
||||
|
||||
public static final int MODULE_PACKAGE = 4;
|
||||
|
||||
public static final int MODULE_PACKAGE_LIBRARY = 5;
|
||||
|
||||
public static final int MODULE_PACKAGE_MODULE = 6;
|
||||
|
||||
//
|
||||
//Static final definitions for operation
|
||||
|
|
|
@ -126,7 +126,7 @@ public class IFrame extends JFrame implements ActionListener, WindowListener {
|
|||
*
|
||||
*/
|
||||
public void windowClosing(WindowEvent arg0) {
|
||||
this.onDisvisible();
|
||||
//this.onDisvisible();
|
||||
}
|
||||
|
||||
public void windowOpened(WindowEvent arg0) {
|
||||
|
|
|
@ -24,13 +24,17 @@ import java.awt.event.FocusEvent;
|
|||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JDesktopPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JInternalFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
|
||||
/**
|
||||
* The class is used to override JInternalFrame to provides customized
|
||||
|
@ -39,7 +43,8 @@ import org.tianocore.frameworkwizard.common.DataType;
|
|||
*
|
||||
*
|
||||
*/
|
||||
public class IInternalFrame extends JInternalFrame implements ActionListener, ComponentListener, ItemListener, FocusListener {
|
||||
public class IInternalFrame extends JInternalFrame implements ActionListener, ComponentListener, ItemListener,
|
||||
FocusListener, ListSelectionListener, TableModelListener, MouseListener {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
|
@ -157,8 +162,7 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
|
|||
*
|
||||
*/
|
||||
public void resizeComponentWidth(Component c, int containerWidth, int preferredWidth) {
|
||||
int newWidth = c.getPreferredSize().width
|
||||
+ (containerWidth - preferredWidth);
|
||||
int newWidth = c.getPreferredSize().width + (containerWidth - preferredWidth);
|
||||
if (newWidth < c.getPreferredSize().width) {
|
||||
newWidth = c.getPreferredSize().width;
|
||||
}
|
||||
|
@ -190,7 +194,8 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
|
|||
* @param containerHeight
|
||||
*
|
||||
*/
|
||||
public void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth, int preferredHeight) {
|
||||
public void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth,
|
||||
int preferredHeight) {
|
||||
resizeComponentWidth(c, containerWidth, preferredWidth);
|
||||
resizeComponentHeight(c, containerHeight, preferredHeight);
|
||||
}
|
||||
|
@ -206,7 +211,7 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
|
|||
public void relocateComponentX(Component c, int containerWidth, int preferredWidth, int spaceToRight) {
|
||||
int intGapToRight = spaceToRight + c.getPreferredSize().width;
|
||||
int newLocationX = containerWidth - intGapToRight;
|
||||
if (newLocationX < preferredWidth -intGapToRight) {
|
||||
if (newLocationX < preferredWidth - intGapToRight) {
|
||||
newLocationX = preferredWidth - intGapToRight;
|
||||
}
|
||||
c.setLocation(newLocationX, c.getLocation().y);
|
||||
|
@ -221,10 +226,11 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
|
|||
* @param spaceToBottom
|
||||
*
|
||||
*/
|
||||
public void relocateComponentY(Component c, int containerHeight, int spaceToBottom) {
|
||||
int newLocationY = containerHeight - spaceToBottom;
|
||||
if (newLocationY < DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT - spaceToBottom) {
|
||||
newLocationY = DataType.MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT - spaceToBottom;
|
||||
public void relocateComponentY(Component c, int containerHeight, int preferredHeight, int spaceToBottom) {
|
||||
int intGapToBottom = spaceToBottom + c.getPreferredSize().height;
|
||||
int newLocationY = containerHeight - intGapToBottom;
|
||||
if (newLocationY < preferredHeight - spaceToBottom) {
|
||||
newLocationY = preferredHeight - spaceToBottom;
|
||||
}
|
||||
c.setLocation(c.getLocation().x, newLocationY);
|
||||
c.validate();
|
||||
|
@ -240,10 +246,10 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
|
|||
* @param spaceToRight
|
||||
*
|
||||
*/
|
||||
public void relocateComponent(Component c, int containerWidth, int containerHeight, int spaceToBottom,
|
||||
int spaceToRight, int preferredWidht, int preferredHeight) {
|
||||
relocateComponentX(c, containerWidth, preferredWidht, spaceToBottom);
|
||||
relocateComponentY(c, containerHeight, spaceToRight);
|
||||
public void relocateComponent(Component c, int containerWidth, int containerHeight, int preferredWidht,
|
||||
int preferredHeight, int spaceToRight, int spaceToBottom) {
|
||||
relocateComponentX(c, containerWidth, preferredWidht, spaceToRight);
|
||||
relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);
|
||||
}
|
||||
|
||||
public void showStandard() {
|
||||
|
@ -260,16 +266,51 @@ public class IInternalFrame extends JInternalFrame implements ActionListener, Co
|
|||
|
||||
public void itemStateChanged(ItemEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void valueChanged(ListSelectionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void tableChanged(TableModelEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,12 +238,19 @@ public class ITree extends JTree {
|
|||
if (iNode.getId().equals(id) && iNode.getCategory() == category) {
|
||||
return iNode;
|
||||
}
|
||||
IDefaultMutableTreeNode childNode = getNodeById(iNode, id, category);
|
||||
if (childNode != null) {
|
||||
return childNode;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TreePath getPathOfNode(IDefaultMutableTreeNode node) {
|
||||
TreePath treePath = new TreePath(treeModel.getPathToRoot(node));
|
||||
return treePath;
|
||||
if (node != null) {
|
||||
TreePath treePath = new TreePath(treeModel.getPathToRoot(node));
|
||||
return treePath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,6 +86,22 @@ public class ICheckBoxList extends JList {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
Get All Checked Items index of the CheckBoxList component.
|
||||
|
||||
@return All Checked Items index
|
||||
**/
|
||||
public Vector<Integer> getAllCheckedItemsIndex() {
|
||||
Vector<Integer> result = new Vector<Integer>();
|
||||
|
||||
for (int i = 0; i < this.getModel().getSize(); i++) {
|
||||
if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
|
||||
result.addElement(i);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
Get All Checked Items String of the CheckBoxList component.
|
||||
|
|
|
@ -86,4 +86,11 @@ public class LibraryClassVector {
|
|||
public int size() {
|
||||
return this.vLibraryClass.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getLibraryClass(index).getLibraryClassName());
|
||||
v.addElement(getLibraryClass(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,44 +16,69 @@
|
|||
package org.tianocore.frameworkwizard.module.Identifications;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.tianocore.LibraryUsage;
|
||||
import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpenFile;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
public class ModuleIdentification extends Identification {
|
||||
|
||||
private PackageIdentification packageId;
|
||||
|
||||
private String moduleType;
|
||||
|
||||
private boolean isLibrary;
|
||||
|
||||
public ModuleIdentification(String name, String guid, String version, String path) {
|
||||
super(name, guid, version, path);
|
||||
setModuleType();
|
||||
}
|
||||
|
||||
public ModuleIdentification(Identification id) {
|
||||
public ModuleIdentification(String name, String guid, String version, String path, boolean library) {
|
||||
super(name, guid, version, path);
|
||||
this.isLibrary = library;
|
||||
}
|
||||
|
||||
public ModuleIdentification(Identification id, boolean library) {
|
||||
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
|
||||
this.isLibrary = library;
|
||||
}
|
||||
|
||||
public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId){
|
||||
super(name, guid, version, path);
|
||||
this.packageId = packageId;
|
||||
setModuleType();
|
||||
}
|
||||
|
||||
public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId, String type){
|
||||
super(name, guid, version, path);
|
||||
this.packageId = packageId;
|
||||
this.moduleType = type;
|
||||
}
|
||||
|
||||
public ModuleIdentification(Identification id, PackageIdentification packageId) {
|
||||
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
|
||||
this.packageId = packageId;
|
||||
setModuleType();
|
||||
}
|
||||
|
||||
// public boolean equals(Object obj) {
|
||||
// if (obj instanceof Identification) {
|
||||
// Identification id = (Identification)obj;
|
||||
// if ( this.getName().equalsIgnoreCase(id.getName())) {
|
||||
// return true;
|
||||
// }
|
||||
// // and package is the same one
|
||||
// return false;
|
||||
// }
|
||||
// else {
|
||||
// return super.equals(obj);
|
||||
// }
|
||||
// }
|
||||
public ModuleIdentification(Identification id, PackageIdentification packageId, boolean library) {
|
||||
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
|
||||
this.packageId = packageId;
|
||||
this.isLibrary = library;
|
||||
}
|
||||
|
||||
public ModuleIdentification(Identification id, PackageIdentification packageId, String type) {
|
||||
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
|
||||
this.packageId = packageId;
|
||||
this.moduleType = type;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId;
|
||||
|
@ -66,4 +91,50 @@ public class ModuleIdentification extends Identification {
|
|||
public void setPackageId(PackageIdentification packageId) {
|
||||
this.packageId = packageId;
|
||||
}
|
||||
|
||||
public String getModuleType() {
|
||||
return moduleType;
|
||||
}
|
||||
|
||||
public void setModuleType(String moduleType) {
|
||||
this.moduleType = moduleType;
|
||||
}
|
||||
|
||||
private void setModuleType() {
|
||||
ModuleSurfaceArea msa = null;
|
||||
try {
|
||||
msa = OpenFile.openMsaFile(this.getPath());
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
||||
} catch (XmlException e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
|
||||
}
|
||||
setModuleType(DataType.MODULE_TYPE_MODULE);
|
||||
setLibrary(false);
|
||||
if (msa != null) {
|
||||
LibraryClassDefinitions lib = msa.getLibraryClassDefinitions();
|
||||
if (lib != null) {
|
||||
for (int index = 0; index < lib.getLibraryClassList().size(); index++) {
|
||||
if (lib.getLibraryClassList().get(index).getUsage().equals(LibraryUsage.ALWAYS_PRODUCED)) {
|
||||
setModuleType(DataType.MODULE_TYPE_LIBRARY);
|
||||
setLibrary(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLibrary() {
|
||||
return isLibrary;
|
||||
}
|
||||
|
||||
public void setLibrary(boolean isLibrary) {
|
||||
this.isLibrary = isLibrary;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,17 +14,11 @@
|
|||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.packaging;
|
||||
import java.io.File;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
||||
|
||||
public class PackageIdentification extends Identification{
|
||||
|
||||
//
|
||||
// It is optional
|
||||
//
|
||||
private File spdFile;
|
||||
|
||||
public PackageIdentification(String name, String guid, String version){
|
||||
super(name, guid, version);
|
||||
}
|
||||
|
@ -36,25 +30,4 @@ public class PackageIdentification extends Identification{
|
|||
public PackageIdentification(Identification id){
|
||||
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
|
||||
}
|
||||
|
||||
public PackageIdentification(String name, String guid, String version, File spdFile){
|
||||
super(name, guid, version);
|
||||
this.spdFile = spdFile;
|
||||
}
|
||||
|
||||
public File getSpdFile() {
|
||||
return spdFile;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "Package " + this.getName() + "[" + this.getGuid() + "]";
|
||||
}
|
||||
|
||||
public void setSpdFile(File spdFile) {
|
||||
this.spdFile = spdFile;
|
||||
}
|
||||
|
||||
public String getPackageDir(){
|
||||
return spdFile.getParent();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,36 +15,15 @@
|
|||
|
||||
package org.tianocore.frameworkwizard.platform;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
||||
|
||||
public class PlatformIdentification extends Identification{
|
||||
|
||||
private File fpdFile;
|
||||
|
||||
public PlatformIdentification(String name, String guid, String version, String path){
|
||||
super(name, guid, version, path);
|
||||
}
|
||||
|
||||
public PlatformIdentification(String name, String guid, String version, File fpdFile){
|
||||
super(name, guid, version);
|
||||
this.fpdFile = fpdFile;
|
||||
}
|
||||
|
||||
public PlatformIdentification(Identification id){
|
||||
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "Platform " + this.getName() + "[" + this.getGuid() + "]";
|
||||
}
|
||||
|
||||
public void setFpdFile(File fpdFile) {
|
||||
this.fpdFile = fpdFile;
|
||||
}
|
||||
|
||||
public File getFpdFile() {
|
||||
return fpdFile;
|
||||
}
|
||||
}
|
|
@ -89,11 +89,11 @@ public class WorkspaceTools {
|
|||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (XmlException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
return modulePath;
|
||||
}
|
||||
|
@ -117,11 +117,11 @@ public class WorkspaceTools {
|
|||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (XmlException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
return includePath;
|
||||
}
|
||||
|
@ -147,22 +147,54 @@ public class WorkspaceTools {
|
|||
vPackageList.addElement(new PackageIdentification(id));
|
||||
} catch (IOException e) {
|
||||
Log.err("Open Package Surface Area " + path, e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Package Surface Area " + path, e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Package Surface Area " + path, "Invalid file type");
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
Tools.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);
|
||||
return vPackageList;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all module basic information from a package
|
||||
|
||||
@param id Package id
|
||||
@return A vector includes all modules' basic information
|
||||
|
||||
**/
|
||||
public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {
|
||||
Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();
|
||||
Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());
|
||||
Identification id = null;
|
||||
String modulePath = null;
|
||||
|
||||
for (int index = 0; index < modulePaths.size(); index++) {
|
||||
try {
|
||||
modulePath = modulePaths.get(index);
|
||||
id = getId(modulePath, OpenFile.openMsaFile(modulePath));
|
||||
} catch (IOException e) {
|
||||
Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());
|
||||
} catch (XmlException e) {
|
||||
Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());
|
||||
} catch (Exception e) {
|
||||
Log.log("Error when Open Module Surface Area " + modulePath, "Invalid file type " + e.getMessage());
|
||||
}
|
||||
v.addElement(new ModuleIdentification(id, pid));
|
||||
}
|
||||
Tools.sortModules(v, DataType.SORT_TYPE_ASCENDING);
|
||||
return v;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Get all package basic information form the FrameworkDatabase.db file
|
||||
Get all module basic information form the FrameworkDatabase.db file
|
||||
|
||||
@return vPackageList A vector includes all packages' basic information
|
||||
@return vModuleList A vector includes all modules' basic information
|
||||
|
||||
*/
|
||||
public Vector<ModuleIdentification> getAllModules() {
|
||||
|
@ -190,17 +222,14 @@ public class WorkspaceTools {
|
|||
vModuleList.addElement(new ModuleIdentification(id, vPackageList.elementAt(indexI)));
|
||||
} catch (IOException e) {
|
||||
Log.err("Open Module Surface Area " + modulePath, e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Module Surface Area " + modulePath, e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tools.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);
|
||||
return vModuleList;
|
||||
}
|
||||
|
||||
|
@ -225,15 +254,13 @@ public class WorkspaceTools {
|
|||
vPlatformList.addElement(new PlatformIdentification(id));
|
||||
} catch (IOException e) {
|
||||
Log.err("Open Platform Surface Area " + path, e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Platform Surface Area " + path, e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Platform Surface Area " + path, "Invalid file type");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Tools.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);
|
||||
return vPlatformList;
|
||||
}
|
||||
|
||||
|
@ -251,6 +278,7 @@ public class WorkspaceTools {
|
|||
}
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -268,6 +296,7 @@ public class WorkspaceTools {
|
|||
}
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -285,6 +314,7 @@ public class WorkspaceTools {
|
|||
}
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -302,6 +332,7 @@ public class WorkspaceTools {
|
|||
}
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -319,6 +350,7 @@ public class WorkspaceTools {
|
|||
}
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -340,15 +372,13 @@ public class WorkspaceTools {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (XmlException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -368,15 +398,13 @@ public class WorkspaceTools {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (XmlException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -396,15 +424,13 @@ public class WorkspaceTools {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (XmlException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -424,15 +450,13 @@ public class WorkspaceTools {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (XmlException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -452,15 +476,13 @@ public class WorkspaceTools {
|
|||
}
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (XmlException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);
|
||||
return vector;
|
||||
}
|
||||
|
||||
|
@ -495,11 +517,11 @@ public class WorkspaceTools {
|
|||
return vPackageList.elementAt(indexI);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (XmlException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue