From f4a250cb18e970d32d8a936b249c67608e59884d Mon Sep 17 00:00:00 2001 From: hche10x Date: Fri, 30 Jun 2006 10:06:58 +0000 Subject: Remove ModuleEditor and PackageEditor from Tools\Source git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@672 6f19259b-4bc3-4df7-8a09-765794883524 --- Tools/Source/PackageEditor/MANIFEST.MF | 3 - Tools/Source/PackageEditor/build.xml | 44 - .../src/org/tianocore/common/Tools.java | 159 --- .../src/org/tianocore/packaging/CreateFdp.java | 93 -- .../org/tianocore/packaging/DbFileContents.java | 315 ----- .../org/tianocore/packaging/ForceInstallPkg.java | 80 -- .../src/org/tianocore/packaging/FrameworkPkg.java | 402 ------ .../src/org/tianocore/packaging/GenGuidDialog.java | 391 ------ .../src/org/tianocore/packaging/GuiPkgInstall.java | 804 ------------ .../org/tianocore/packaging/GuiPkgUninstall.java | 370 ------ .../src/org/tianocore/packaging/GuidEditor.java | 92 -- .../org/tianocore/packaging/ManifestContents.java | 74 -- .../org/tianocore/packaging/ModalFrameUtil.java | 107 -- .../src/org/tianocore/packaging/PackageAction.java | 352 ------ .../src/org/tianocore/packaging/PackageGuids.java | 354 ------ .../tianocore/packaging/PackageLibraryClass.java | 560 --------- .../org/tianocore/packaging/PackageMsaFile.java | 371 ------ .../src/org/tianocore/packaging/PackageNew.java | 533 -------- .../src/org/tianocore/packaging/PackagePCD.java | 321 ----- .../org/tianocore/packaging/PackagePkgHeader.java | 454 ------- .../src/org/tianocore/packaging/PackagePpi.java | 41 - .../org/tianocore/packaging/PackageProtocols.java | 377 ------ .../src/org/tianocore/packaging/PackagingMain.java | 330 ----- .../tianocore/packaging/PkgInstallTypeChooser.java | 373 ------ .../org/tianocore/packaging/SpdFileContents.java | 1282 -------------------- .../src/org/tianocore/packaging/UpdateAction.java | 328 ----- .../src/org/tianocore/packaging/UpdateGuids.java | 249 ---- .../tianocore/packaging/UpdateLibraryClass.java | 243 ---- .../src/org/tianocore/packaging/UpdateMsaFile.java | 237 ---- .../src/org/tianocore/packaging/UpdateNew.java | 573 --------- .../src/org/tianocore/packaging/UpdatePCD.java | 277 ----- .../org/tianocore/packaging/UpdatePkgHeader.java | 257 ---- .../src/org/tianocore/packaging/UpdatePpi.java | 248 ---- .../org/tianocore/packaging/UpdateProtocols.java | 250 ---- .../tianocore/packaging/common/ui/StarLabel.java | 41 - 35 files changed, 10985 deletions(-) delete mode 100644 Tools/Source/PackageEditor/MANIFEST.MF delete mode 100644 Tools/Source/PackageEditor/build.xml delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/CreateFdp.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/ForceInstallPkg.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/FrameworkPkg.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/GenGuidDialog.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgInstall.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgUninstall.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/GuidEditor.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/ManifestContents.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/ModalFrameUtil.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageGuids.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageNew.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePCD.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePpi.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageProtocols.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/PkgInstallTypeChooser.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateAction.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateNew.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java delete mode 100644 Tools/Source/PackageEditor/src/org/tianocore/packaging/common/ui/StarLabel.java (limited to 'Tools/Source/PackageEditor') diff --git a/Tools/Source/PackageEditor/MANIFEST.MF b/Tools/Source/PackageEditor/MANIFEST.MF deleted file mode 100644 index 8a92b4ff87..0000000000 --- a/Tools/Source/PackageEditor/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: org.tianocore.packaging.PackagingMain - diff --git a/Tools/Source/PackageEditor/build.xml b/Tools/Source/PackageEditor/build.xml deleted file mode 100644 index 982e159a52..0000000000 --- a/Tools/Source/PackageEditor/build.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java b/Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java deleted file mode 100644 index 311370d85d..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java +++ /dev/null @@ -1,159 +0,0 @@ -/** @file - Java class Tools contains common use procedures. - -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.common; - -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.UUID; - -/** - This class contains static methods for some common operations - - @since PackageEditor 1.0 -**/ -public class Tools { - - public static final String guidArrayPat = "0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?"; - public static final String guidRegistryPat = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"; - /** - get current date and time, then return - @return String - **/ - public static String getCurrentDateTime() { - Date now = new Date(System.currentTimeMillis()); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - return sdf.format(now); - } - - /** - Delete a folder and all its files - @param strFolderName - @return boolean - **/ - public static boolean deleteFolder(File fleFolderName) { - boolean blnIsDeleted = true; - File[] aryAllFiles = fleFolderName.listFiles(); - - for (int indexI = 0; indexI < aryAllFiles.length; indexI++) { - if (blnIsDeleted) { - if (aryAllFiles[indexI].isDirectory()) { - blnIsDeleted = deleteFolder(aryAllFiles[indexI]); - } else if (aryAllFiles[indexI].isFile()) { - if (!aryAllFiles[indexI].delete()) { - blnIsDeleted = false; - } - } - } - } - if (blnIsDeleted) { - fleFolderName.delete(); - } - return blnIsDeleted; - } - - /** - Get a new GUID - - @return String - **/ - public static String generateUuidString() { - return UUID.randomUUID().toString(); - } - - public static String formatGuidString (String guidNameConv) { - String[] strList; - String guid = ""; - int index = 0; - if (guidNameConv - .matches(Tools.guidRegistryPat)) { - strList = guidNameConv.split("-"); - guid = "0x" + strList[0] + ", "; - guid = guid + "0x" + strList[1] + ", "; - guid = guid + "0x" + strList[2] + ", "; -// guid = guid + "{"; - guid = guid + "0x" + strList[3].substring(0, 2) + ", "; - guid = guid + "0x" + strList[3].substring(2, 4); - - while (index < strList[4].length()) { - guid = guid + ", "; - guid = guid + "0x" + strList[4].substring(index, index + 2); - index = index + 2; - } -// guid = guid + "}"; - return guid; - } - else if (guidNameConv - .matches(Tools.guidArrayPat)) { - strList = guidNameConv.split(","); - - // - // chang ANSI c form to registry form - // - for (int i = 0; i < strList.length; i++){ - strList[i] = strList[i].substring(strList[i].lastIndexOf("x") + 1); - } - if (strList[strList.length - 1].endsWith("}")) { - strList[strList.length -1] = strList[strList.length-1].substring(0, strList[strList.length-1].length()-1); - } - // - //inserting necessary leading zeros - // - - int segLen = strList[0].length(); - if (segLen < 8){ - for (int i = 0; i < 8 - segLen; ++i){ - strList[0] = "0" + strList[0]; - } - } - - segLen = strList[1].length(); - if (segLen < 4){ - for (int i = 0; i < 4 - segLen; ++i){ - strList[1] = "0" + strList[1]; - } - } - segLen = strList[2].length(); - if (segLen < 4){ - for (int i = 0; i < 4 - segLen; ++i){ - strList[2] = "0" + strList[2]; - } - } - for (int i = 3; i < 11; ++i) { - segLen = strList[i].length(); - if (segLen < 2){ - strList[i] = "0" + strList[i]; - } - } - - for (int i = 0; i < 3; i++){ - guid += strList[i] + "-"; - } - - guid += strList[3]; - guid += strList[4] + "-"; - - for (int i = 5; i < strList.length; ++i){ - guid += strList[i]; - } - - - return guid; - } else { - - return "0"; - - } - } -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/CreateFdp.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/CreateFdp.java deleted file mode 100644 index 6988b5ae01..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/CreateFdp.java +++ /dev/null @@ -1,93 +0,0 @@ -/** @file - Java class CreateFdp is used to create a distributable package containing - FDPManifest.xml file in its root directory. - -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.packaging; - -import java.io.*; -import java.util.jar.*; - -/** - This class contains static method create to generate *.fdp format package. - - @since PackageEditor 1.0 -**/ -public class CreateFdp { - - /** - recursively add contents under dir into output package. - - @param dir The directory with files that will be put into package - @param jos Stream used to create output package - @param wkDir The position of source directory - @throws Exception Any exception occurred during this process - **/ - public static void create(File dir, JarOutputStream jos, String wkDir) throws Exception { - - String[] list = dir.list(); - - try { - byte[] buffer = new byte[1024]; - int bytesRead; - - // - // Loop through the file names provided. - // - for (int i = 0; i < list.length; i++) { - - File f = new File(dir, list[i]); - if (f.getName().equals("..")) { - continue; - } - if (f.isDirectory()) { - // - // Call this method recursively for directory - // - CreateFdp.create(f, jos, wkDir); - continue; - } - - try { - // - // Open the file - // - FileInputStream fis = new FileInputStream(f); - - try { - // - // Create a Jar entry and add it, keep relative path only. - // - JarEntry entry = new JarEntry(f.getPath().substring(wkDir.length() + 1)); - jos.putNextEntry(entry); - - // - // Read the file and write it to the Jar. - // - while ((bytesRead = fis.read(buffer)) != -1) { - jos.write(buffer, 0, bytesRead); - } - - System.out.println(entry.getName() + " added."); - } catch (Exception ex) { - System.out.println(ex); - } finally { - fis.close(); - } - } catch (IOException ex) { - System.out.println(ex); - } - } - } finally { - System.out.println(dir.getPath() + " processed."); - } - } -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java deleted file mode 100644 index 4f5fb37f71..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/DbFileContents.java +++ /dev/null @@ -1,315 +0,0 @@ -/** @file - Java class DbFileContents is used to deal with FrameworkDatabase.db file cotents. - -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.packaging; - -import java.io.File; -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Date; -import java.text.SimpleDateFormat; - -import org.apache.xmlbeans.XmlCursor; -import org.apache.xmlbeans.XmlObject; -import org.apache.xmlbeans.XmlOptions; - -import org.tianocore.*; - -/** - This class provides methods for add, remove, query FrameworkDatabase.db file. - - @since PackageEditor 1.0 -**/ -public class DbFileContents { - - /// - /// return values for various conditions. - /// - static final int BASE_PACKAGE_NOT_INSTALLED = 1; - - static final int VERSION_NOT_EQUAL = 2; - - static final int GUID_NOT_EQUAL = 3; - - static final int SAME_ALL = 4; - - private File dbFile = null; - - private FrameworkDatabaseDocument fdd = null; - - private FrameworkDatabaseDocument.FrameworkDatabase fddRoot = null; - - private PackageListDocument.PackageList pkgList = null; - - public DbFileContents() { - super(); - // TODO Auto-generated constructor stub - } - - /** - Parse file f, store its xml data in fdd, store root xml element in fddRoot. - - @param f DB file to parse - **/ - public DbFileContents(File f) { - try { - dbFile = f; - if (fdd == null) { - fdd = ((FrameworkDatabaseDocument) XmlObject.Factory.parse(dbFile)); - } - fddRoot = fdd.getFrameworkDatabase(); - } catch (Exception e) { - System.out.println(e.toString()); - } - } - - /** - Generate the Package element in FrameworkDatabase.db - - @param baseName Base name of package - @param ver Version of package - @param guid GUID of package - @param path Where the package installed - @param installDate When the package installed - **/ - public void genPackage (String baseName, String ver, String guid, String path, String installDate) { - if (getPkgList() == null) { - pkgList = fddRoot.addNewPackageList(); - } - PackageListDocument.PackageList.Package p = pkgList.addNewPackage(); - p.addNewPackageName().setStringValue(baseName); - p.addNewGuid().setStringValue(guid); - p.addVersion(ver); - p.addNewPath().setStringValue(path); - p.addNewInstalledDate().setStringValue(installDate); - } - - /** - Get PackageList - - @return PackageListDocument.PackageList - **/ - public PackageListDocument.PackageList getPkgList() { - if (pkgList == null) { - pkgList = fddRoot.getPackageList(); - } - return pkgList; - } - - /** - Remove PackageList and all elements under it. - **/ - public void removePackageList() { - XmlObject o = fddRoot.getPackageList(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - } - /** - Get the number of Package elements. - - @return int - **/ - public int getPackageCount () { - return fddRoot.getPackageList().getPackageList().size(); - } - - /** - Get all Package contents into String array - - @param pkg Two dimentional array to store Package info. - **/ - public void getPackageList(String[][] pkg) { - List l = fddRoot.getPackageList().getPackageList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) li - .next(); - if (p.getPackageNameArray(0)!= null) { - pkg[i][0] = p.getPackageNameArray(0).getStringValue(); - } - - pkg[i][1] = p.getVersionArray(0); - - if (p.getGuidArray(0) != null) { - pkg[i][2] = p.getGuidArray(0).getStringValue(); - } - if (p.getPathArray(0) != null) { - pkg[i][3] = p.getPathArray(0).getStringValue(); - } - if (p.getInstalledDateArray(0) != null) { - pkg[i][4] = p.getInstalledDateArray(0); - } - i++; - } - } - /** - Check whether destDir has been used by one Package - - @param destDir The directory to check. - @retval <1> destDir has been used - @retval <0> destDir has not been used - @return int - **/ - public int checkDir(String destDir) { - List lp = fddRoot.getPackageList().getPackageList(); - - ListIterator lpi = lp.listIterator(); - while (lpi.hasNext()) { - PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next(); - if (p.getPathArray(0).getStringValue().equals(destDir)) { - return 1; - } - } - return 0; - } - - /** - Find the package info. and store results into list of same base name or list - of same version. - - @param base The base name of package - @param version The version of package - @param guid the GUID of package - @param lpSameBase The list to store package info with the same base name with "base" - @param lpSameVersion The list to store package info from lpSameBase and same version - with "version" - @retval <0> No package installed has base name "base" - @retval At least one package installed with "base" but no "version" - @retval At least one package installed with "base" and "version" but no "guid" - @retval One installed package has the same base, version and guid - @return int - **/ - public int query(String base, String version, String guid, - List lpSameBase, - List lpSameVersion) { - - List lp = fddRoot.getPackageList().getPackageList(); - - ListIterator lpi = lp.listIterator(); - while (lpi.hasNext()) { - PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next(); - if (p.getPackageNameArray(0).getStringValue().equals(base)) { - lpSameBase.add(p); - } - } - - if (lpSameBase.size() == 0) { - return 0; - } - - for (ListIterator li = lpSameBase.listIterator(); li.hasNext();) { - PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) li.next(); - if (p.getVersionArray(0).equals(version)) { - lpSameVersion.add(p); - } - } - - if (lpSameVersion.size() == 0) { - return VERSION_NOT_EQUAL; - } - - for (ListIterator li = lpSameVersion.listIterator(); li.hasNext();) { - PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) li.next(); - if (!p.getGuidArray(0).getStringValue().equals(guid)) { - return GUID_NOT_EQUAL; - } - } - - return SAME_ALL; - - } - - /** - Update package info (name, version, guid) with installDir, newVer, newGuid. - And update install date with current date. if no package info available, add - a new entry. - - @param name Original base name - @param version Original version - @param guid Original GUID - @param installDir original path - @param newVer Version value of package to be installed - @param newGuid GUID value of package to be installed - @throws IOException Exception during file operation - **/ - public void updatePkgInfo(String name, String version, String guid, String installDir, String newVer, String newGuid) - throws IOException { - List lp = fddRoot.getPackageList().getPackageList(); - - ListIterator lpi = lp.listIterator(); - while (lpi.hasNext()) { - PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next(); - if (p.getPackageNameArray(0).getStringValue().equals(name)) { - if (p.getVersionArray(0).equals(version)) { - if (p.getGuidArray(0).getStringValue().equals(guid)) { - p.setVersionArray(0, newVer); - p.getGuidArray(0).setStringValue(newGuid); - p.getPathArray(0).setStringValue(installDir); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - Date date = new Date(); - p.setInstalledDateArray(0, format.format(date)); - saveAs(); - return; - - } - } - } - } - - addNewPkgInfo(name, newVer, newGuid, installDir); - } - - /** - Add one new package entry. - - @param name Package base name - @param version Package version - @param guid Package Guid - @param installDir Package path - @throws IOException Exception during file operation - **/ - public void addNewPkgInfo(String name, String version, String guid, String installDir) throws IOException { - - PackageListDocument.PackageList.Package p = fddRoot.getPackageList().addNewPackage(); - p.addNewPackageName().setStringValue(name); - p.addNewGuid().setStringValue(guid); - p.addNewVersion().setStringValue(version); - p.addNewPath().setStringValue(installDir + "/"); - - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - Date date = new Date(); - p.addNewInstalledDate().setStringValue(format.format(date)); - saveAs(); - } - - /** - Save the fdd into file with format options - **/ - public void saveAs() { - XmlOptions options = new XmlOptions(); - - options.setCharacterEncoding("UTF-8"); - options.setSavePrettyPrint(); - options.setSavePrettyPrintIndent(2); - try { - fdd.save(dbFile, options); - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/ForceInstallPkg.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/ForceInstallPkg.java deleted file mode 100644 index 4fe88b49fd..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/ForceInstallPkg.java +++ /dev/null @@ -1,80 +0,0 @@ -/** @file - Java class ForceInstallPkg is used to install a package without DB check. - -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.packaging; - -import java.io.*; -import java.util.jar.*; -import org.apache.xmlbeans.XmlException; - -/** - Derived class from FrameworkPkg, installation skipping some checks. - - @since PackageEditor 1.0 -**/ -public class ForceInstallPkg extends FrameworkPkg { - - private String oldVer = null; - - private String oldGuid = null; - - /** - Constructor with parameters - - @param s Package path to be installed - @param d Destination directory - **/ - public ForceInstallPkg(String s, String d) { - super(s, d); - - } - - public void setOldVersion(String v) { - oldVer = v; - } - - public void setOldGuid(String guid) { - oldGuid = guid; - } - - /** - Set jar file to package name to be installed - **/ - protected void pre_install() throws DirSame, IOException { - setJf(new JarFile(getPkg())); - - } - - /** - Update database file contents after install - **/ - protected void post_install() throws IOException, XmlException { - // - // Get package info. from FDPManifest.xml file - // - setJf(new JarFile(getPkg())); - ManifestContents manFile = new ManifestContents(getManifestInputStream(getJf())); - setBName(manFile.getBaseName()); - setPVer(manFile.getVersion()); - setPGuid(manFile.getGuid()); - getJf().close(); - - // - // Add force installed package info. into database file - // - setDbFile(new File(getWkSpace() + System.getProperty("file.separator") + FrameworkPkg.dbConfigFile)); - setDfc(new DbFileContents(new File(getWkSpace() + System.getProperty("file.separator") + dbConfigFile))); - getDfc().updatePkgInfo(getBName(), oldVer, oldGuid, getWkDir().substring(getWkSpace().length() + 1), getPVer(), - getPGuid()); - } - -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/FrameworkPkg.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/FrameworkPkg.java deleted file mode 100644 index b184cf9364..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/FrameworkPkg.java +++ /dev/null @@ -1,402 +0,0 @@ -/** @file - Java class FrameworkPkg is used to do package related operations. - -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.packaging; - -import java.io.*; -import java.util.Enumeration; -import java.util.LinkedList; -import java.util.List; -import java.util.jar.*; -import org.apache.xmlbeans.*; - -import org.tianocore.PackageListDocument; - -/** - This class deals with package related operations - - @since PackageEditor 1.0 -**/ -public class FrameworkPkg { - - private String pkg = null; - - private JarFile jf = null; - - /// - /// where the package will be extracted to - /// - private String wkDir = null; - - private String bName = null; - - private String pVer = null; - - private String pGuid = null; - - /// - /// current WORKSPACE location - /// - private String wkSpace = null; - - private File dbFile = null; - - private DbFileContents dfc = null; - - /// - /// relative path of FrameworkDatabase.db file - /// - final static String dbConfigFile = "Tools" + System.getProperty("file.separator") + "Conf" - + System.getProperty("file.separator") + "FrameworkDatabase.db"; - - - public FrameworkPkg() { - - } - - public FrameworkPkg(String package_name, String work_space) { - pkg = package_name; - wkSpace = work_space; - } - - /** - install package (*.fdp file) to dir - - @param dir Destination directory - @retval <0> Install successfully - @return int - @throws IOException - @throws XmlException Xml file exception - @throws DirSame One package already installed to dir - @throws BasePkgNotInstalled Some package must be installed first - @throws VerNotEqual At least one package info with same base name but version different - @throws GuidNotEqual At least one package info with same base name and version but guid different - @throws SameAll At least one package info with same base name, version and guid same - **/ - public int install(final String dir) throws IOException, XmlException, DirSame, BasePkgNotInstalled, VerNotEqual, - GuidNotEqual, SameAll { - wkDir = dir; - pre_install(); - extract(wkDir); - post_install(); - return 0; - } - - public int uninstall() { - - return 0; - } - - /** - Check package info. against Frameworkdatabase.db - - @throws IOException - @throws XmlException Xml file exception - @throws DirSame One package already installed to dir - @throws BasePkgNotInstalled Some package must be installed first - @throws VerNotEqual At least one package info with same base name but version different - @throws GuidNotEqual At least one package info with same base name and version but guid different - @throws SameAll At least one package info with same base name, version and guid same - **/ - protected void pre_install() throws IOException, XmlException, DirSame, BasePkgNotInstalled, VerNotEqual, - GuidNotEqual, SameAll { - - jf = new JarFile(pkg); - - ManifestContents manFile = new ManifestContents(getManifestInputStream(jf)); - - String baseName = manFile.getBaseName(); - String pkgVersion = manFile.getVersion(); - String pkgGuid = manFile.getGuid(); - bName = baseName; - pVer = pkgVersion; - pGuid = pkgGuid; - - if (dbFile == null) { - dbFile = new File(wkSpace + System.getProperty("file.separator") + dbConfigFile); - } - // - // the db file should exist if base packages have been installed - // - if (!dbFile.exists()) { - throw new BasePkgNotInstalled(); - } - - if (dfc == null) { - dfc = new DbFileContents(dbFile); - } - if (dfc.checkDir(wkDir) != 0) { - throw new DirSame(); - } - - // - // Get database info into lists - // - List lpSameBase = new LinkedList(); - List lpSameVersion = new LinkedList(); - int i = dfc.query(baseName, pkgVersion, pkgGuid, lpSameBase, lpSameVersion); - - // - // throw various kind of exceptions according to query return value. - // - if (i == DbFileContents.VERSION_NOT_EQUAL) { - - jf.close(); - throw new VerNotEqual(lpSameBase); - } - if (i == DbFileContents.GUID_NOT_EQUAL) { - - jf.close(); - throw new GuidNotEqual(lpSameVersion); - } - if (i == DbFileContents.SAME_ALL) { - jf.close(); - throw new SameAll(lpSameVersion); - } - - } - - /** - Add package info into db file. - - @throws IOException - @throws XmlException - **/ - protected void post_install() throws IOException, XmlException { - - dfc.addNewPkgInfo(bName, pVer, pGuid, wkDir.substring(wkSpace.length() + 1)); - - } - - /** - Extract package to dir - - @param dir Destination directory - @throws DirSame - @throws IOException - **/ - private void extract(String dir) throws DirSame, IOException { - - new File(dir).mkdirs(); - dir += System.getProperty("file.separator"); - try { - for (Enumeration e = jf.entries(); e.hasMoreElements();) { - JarEntry je = (JarEntry) e.nextElement(); - - // - // jar entry contains directory only, make these directories - // - if (je.isDirectory()) { - new File(dir + je.getName()).mkdirs(); - continue; - } - - // - // jar entry contains relative path and file name, make relative directories - // under destination dir - // - int index = je.getName().lastIndexOf(System.getProperty("file.separator")); - if (index != -1) { - String dirPath = je.getName().substring(0, index); - new File(dir + dirPath).mkdirs(); - } - - if (je != null) { - // - // Get an input stream for this entry. - // - InputStream entryStream = jf.getInputStream(je); - - try { - // - // Create the output file (clobbering the file if it exists). - // - FileOutputStream file = new FileOutputStream(dir + je.getName()); - - try { - - byte[] buffer = new byte[1024]; - int bytesRead; - // - // Read the entry data and write it to the output file. - // - while ((bytesRead = entryStream.read(buffer)) != -1) { - file.write(buffer, 0, bytesRead); - } - - System.out.println(je.getName() + " extracted."); - } finally { - file.close(); - } - } finally { - entryStream.close(); - } - } - - } - - } finally { - jf.close(); - - } - - } - - public String getBName() { - return bName; - } - - public void setBName(String name) { - bName = name; - } - - public File getDbFile() { - return dbFile; - } - - public void setDbFile(File dbFile) { - this.dbFile = dbFile; - } - - public DbFileContents getDfc() { - return dfc; - } - - public void setDfc(DbFileContents dfc) { - this.dfc = dfc; - } - - public String getPGuid() { - return pGuid; - } - - public void setPGuid(String guid) { - pGuid = guid; - } - - public String getPVer() { - return pVer; - } - - public void setPVer(String ver) { - pVer = ver; - } - - public String getWkDir() { - return wkDir; - } - - public void setWkDir(String wkDir) { - this.wkDir = wkDir; - } - - public String getWkSpace() { - return wkSpace; - } - - public void setWkSpace(String wkSpace) { - this.wkSpace = wkSpace; - } - - public JarFile getJf() { - return jf; - } - - public void setJf(JarFile jf) { - this.jf = jf; - } - - public String getPkg() { - return pkg; - } - - public void setPkg(String pkg) { - this.pkg = pkg; - } - - /** - Get the input stream of FDPManifest.xml file from jar entry - - @param jf The Jar file that contains FDPManifest.xml file - @return InputStream - @throws IOException - **/ - protected InputStream getManifestInputStream(JarFile jf) throws IOException { - JarEntry je = null; - for (Enumeration e = jf.entries(); e.hasMoreElements();) { - je = (JarEntry) e.nextElement(); - if (je.getName().contains("FDPManifest.xml")) - return jf.getInputStream(je); - } - - return null; - } - -} - - -/** - Various Exception classes for what happened when database info and package info - are compared. - - @since PackageEditor 1.0 -**/ -class DirSame extends Exception { - final static long serialVersionUID = 0; -} - -class BasePkgNotInstalled extends Exception { - final static long serialVersionUID = 0; -} - -class VerNotEqual extends Exception { - final static long serialVersionUID = 0; - - //private String version = null; - List lppSameBase = null; - - VerNotEqual(List ver) { - lppSameBase = ver; - } - - public List getVersion() { - return lppSameBase; - } -} - -class GuidNotEqual extends Exception { - final static long serialVersionUID = 0; - - private List lppSameVer = null; - - GuidNotEqual(List ver) { - lppSameVer = ver; - } - - public List getGuid() { - return lppSameVer; - } -} - -class SameAll extends Exception { - final static long serialVersionUID = 0; - - private List version = null; - - SameAll(List ver) { - version = ver; - } - - public List getVersion() { - return version; - } -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GenGuidDialog.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GenGuidDialog.java deleted file mode 100644 index c58010a9d7..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GenGuidDialog.java +++ /dev/null @@ -1,391 +0,0 @@ -/** @file - Java class GenGuidDialog. - -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.packaging; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; - -import javax.swing.JPanel; -import javax.swing.JDialog; -import java.awt.GridLayout; - -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JTextField; -import javax.swing.JLabel; -import javax.swing.JRadioButton; -import javax.swing.ButtonGroup; -import javax.swing.JButton; - -import org.tianocore.common.Tools; - -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -/** - Dialog for GUID generation. - @since PackageEditor 1.0 -**/ -public class GenGuidDialog extends JDialog implements ActionListener{ - - static private JFrame frame; - private JPanel jContentPane = null; - private JPanel jPanel = null; - private JPanel jPanel1 = null; - private JPanel jPanel2 = null; - private JPanel jPanel3 = null; - private JPanel jPanel4 = null; - private JTextField jTextField = null; - private JLabel jLabel = null; - private JRadioButton jRadioButton = null; - private JRadioButton jRadioButton1 = null; - private JButton jButton = null; - private JButton jButton1 = null; - private JButton jButton2 = null; - -// private String guid = null; - - public void actionPerformed(ActionEvent arg0) { - // TODO Auto-generated method stub - if (arg0.getSource() == jButton1){ - String uuid = Tools.generateUuidString(); - if (jRadioButton1.isSelected()) { - jTextField.setText(uuid); - } - else { - //ToDo: transform to comma-sep guid - String s = Tools.formatGuidString(uuid); - if (s.equals("0")) { - JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema."); - return; - } - jTextField.setText(s); - } - } - - if (arg0.getSource() == jRadioButton1){ - - //ToDo: check text field value against RegExp and transform if needed - if (jTextField.getText().matches(Tools.guidRegistryPat)){ - return; - } - if (jTextField.getText().matches(Tools.guidArrayPat)) { - jTextField.setText(Tools.formatGuidString(jTextField.getText())); - return; - } - - JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema."); - - } - - if (arg0.getSource() == jRadioButton){ - - //ToDo: check text field value against RegExp and transform if needed - if (jTextField.getText().matches(Tools.guidArrayPat)){ - return; - } - if (jTextField.getText().matches(Tools.guidRegistryPat)) { - jTextField.setText(Tools.formatGuidString(jTextField.getText())); - return; - } - - JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema."); - - } - - if (arg0.getSource() == jButton2){ -// if (jTextField.getText().matches(Tools.guidArrayPat) -// || jTextField.getText().matches(Tools.guidRegistryPat)){ -// this.setVisible(false); -// } -// else { -// JOptionPane.showMessageDialog(frame, "Incorrect GUID Value Format."); -// } - this.dispose(); - } - - if (arg0.getSource() == jButton){ - this.dispose(); - } - } - - /** - * This method initializes jPanel - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel() { - if (jPanel == null) { - FlowLayout flowLayout = new FlowLayout(); - flowLayout.setVgap(10); - jPanel = new JPanel(); - jPanel.setLayout(flowLayout); - jPanel.setPreferredSize(new java.awt.Dimension(100,30)); - jPanel.add(getJButton1(), null); - jPanel.add(getJButton2(), null); - jPanel.add(getJButton(), null); - } - return jPanel; - } - - /** - * This method initializes jPanel1 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel1() { - if (jPanel1 == null) { - jPanel1 = new JPanel(); - } - return jPanel1; - } - - /** - * This method initializes jPanel2 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel2() { - if (jPanel2 == null) { - jPanel2 = new JPanel(); - } - return jPanel2; - } - - /** - * This method initializes jPanel3 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel3() { - if (jPanel3 == null) { - jPanel3 = new JPanel(); - } - return jPanel3; - } - - /** - * This method initializes jPanel4 - * - * @return javax.swing.JPanel - */ - private JPanel getJPanel4() { - if (jPanel4 == null) { - jLabel = new JLabel(); - jLabel.setText("GUID Value"); - GridLayout gridLayout = new GridLayout(); - gridLayout.setRows(4); - jPanel4 = new JPanel(); - jPanel4.setLayout(gridLayout); - jPanel4.add(getJRadioButton1(), null); - jPanel4.add(getJRadioButton(), null); - jPanel4.add(jLabel, null); - jPanel4.add(getJTextField(), null); - ButtonGroup bg = new ButtonGroup(); - bg.add(jRadioButton1); - bg.add(jRadioButton); - } - return jPanel4; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setHorizontalAlignment(JTextField.LEADING); - jTextField.setPreferredSize(new java.awt.Dimension(100,20)); - } - return jTextField; - } - - /** - * This method initializes jRadioButton - * - * @return javax.swing.JRadioButton - */ - private JRadioButton getJRadioButton() { - if (jRadioButton == null) { - jRadioButton = new JRadioButton(); - jRadioButton.setText("Comma-Seperated Format"); - jRadioButton.addActionListener(this); - } - return jRadioButton; - } - - /** - * This method initializes jRadioButton1 - * - * @return javax.swing.JRadioButton - */ - private JRadioButton getJRadioButton1() { - if (jRadioButton1 == null) { - jRadioButton1 = new JRadioButton(); - jRadioButton1.setText("Registry Format"); - jRadioButton1.setSelected(true); - jRadioButton1.addActionListener(this); - } - return jRadioButton1; - } - - /** - * This method initializes jButton - * - * @return javax.swing.JButton - */ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setPreferredSize(new java.awt.Dimension(80,20)); - jButton.setText("Cancel"); - jButton.addActionListener(this); - } - return jButton; - } - - /** - * This method initializes jButton1 - * - * @return javax.swing.JButton - */ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setPreferredSize(new java.awt.Dimension(80,20)); - jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING); - jButton1.setText("New"); - jButton1.addActionListener(this); - } - return jButton1; - } - - /** - * This method initializes jButton2 - * - * @return javax.swing.JButton - */ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setPreferredSize(new java.awt.Dimension(80,20)); - jButton2.setText("Ok"); - jButton2.addActionListener(this); - } - return jButton2; - } - - /** - - @param args - **/ - public static void main(String[] args) { - // TODO Auto-generated method stub - new GenGuidDialog().setVisible(true); - } - - public String getGuid(){ - return jTextField.getText(); - } - - public void setGuid(String s){ - jTextField.setText(s); - } - /** - * This is the default constructor - */ - public GenGuidDialog() { - super(); - initialize(); - } - - public GenGuidDialog(ActionListener i){ - super(); - initialize(); - jButton2.addActionListener(i); - this.addWindowListener(new WindowAdapter(){ - - @Override - public void windowActivated(WindowEvent arg0) { - // TODO Auto-generated method stub - super.windowActivated(arg0); - if ((jRadioButton1.isSelected() && jTextField.getText().matches(Tools.guidArrayPat)) - || (jRadioButton.isSelected() && jTextField.getText().matches(Tools.guidRegistryPat))) { - jTextField.setText(Tools.formatGuidString(jTextField.getText())); - } - -// if (!jTextField.getText().matches(Tools.guidArrayPat) || !jTextField.getText().matches(Tools.guidRegistryPat)) { -// JOptionPane.showMessageDialog(frame, "InitVal: Incorrect GUID Value Format."); -// return; -// } - } - - }); - } - - /** - * This method initializes this - * - * @return void - */ - private void initialize() { - this.setSize(466, 157); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setModal(true); - this.setTitle("Editing GUID Value"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - - /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(new BorderLayout()); - jContentPane.add(getJPanel(), java.awt.BorderLayout.EAST); - jContentPane.add(getJPanel1(), java.awt.BorderLayout.WEST); - jContentPane.add(getJPanel2(), java.awt.BorderLayout.NORTH); - jContentPane.add(getJPanel3(), java.awt.BorderLayout.SOUTH); - jContentPane.add(getJPanel4(), java.awt.BorderLayout.CENTER); - } - return jContentPane; - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - -} // @jve:decl-index=0:visual-constraint="10,10" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgInstall.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgInstall.java deleted file mode 100644 index 3e757206f7..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgInstall.java +++ /dev/null @@ -1,804 +0,0 @@ -/** @file - Java class GuiPkgInstall is GUI for package installation. - -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.packaging; - - -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTextField; - -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.Toolkit; - -import java.awt.FlowLayout; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import java.awt.ComponentOrientation; -import java.io.File; -import java.util.Hashtable; - -import javax.swing.SwingConstants; -import javax.swing.JProgressBar; -import javax.swing.filechooser.FileFilter; - -import org.apache.xmlbeans.XmlException; - - -/** - GUI for package installation. - - @since PackageEditor 1.0 -**/ -public class GuiPkgInstall extends JFrame implements MouseListener { - - final static long serialVersionUID = 0; - - static JFrame frame; - - /// - /// backup of "this". As we cannot use "this" to refer outer class inside inner class - /// - private JFrame pThis = null; - - private JFileChooser chooser = null; - - private JPanel jPanel = null; - - private JPanel jPanel1 = null; - - private JTextField jTextField = null; - - private JButton jButton = null; - - private JPanel jPanel2 = null; - - private JLabel jLabel1 = null; - - private JPanel jPanel4 = null; - - private JTextField jTextField1 = null; - - private JButton jButton1 = null; - - private JPanel jPanel5 = null; - - private JPanel jPanel6 = null; - - private JPanel jPanel7 = null; - - private JLabel jLabel2 = null; - - private JTextField jTextField2 = null; - - private JButton jButton2 = null; - - private JButton jButton3 = null; - - private JPanel jPanel3 = null; - - private JLabel jLabel = null; - - private JProgressBar jProgressBar = null; - - private JButton jButton4 = null; - - - public GuiPkgInstall() { - super(); - initialize(); - - } - - /** - GUI initialization - **/ - private void initialize() { - this.setSize(new java.awt.Dimension(454, 313)); - this.setContentPane(getJPanel()); - this.setTitle("Package Installation"); - this.addWindowListener(new GuiPkgInstallAdapter(this)); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); - this.centerWindow(); - pThis = this; - } - - /** - make window appear center of screen - - @param intWidth - @param intHeight - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes jPanel - @return javax.swing.JPanel - **/ - private JPanel getJPanel() { - if (jPanel == null) { - GridLayout gridLayout = new GridLayout(); - gridLayout.setRows(7); - gridLayout.setColumns(1); - jPanel = new JPanel(); - jPanel.setLayout(gridLayout); - jPanel.add(getJPanel3(), null); - jPanel.add(getJPanel1(), null); - jPanel.add(getJPanel2(), null); - jPanel.add(getJPanel4(), null); - jPanel.add(getJPanel5(), null); - jPanel.add(getJPanel6(), null); - jPanel.add(getJPanel7(), null); - } - return jPanel; - } - - /** - This method initializes jPanel1 - - @return javax.swing.JPanel - **/ - private JPanel getJPanel1() { - if (jPanel1 == null) { - FlowLayout flowLayout = new FlowLayout(); - flowLayout.setAlignment(java.awt.FlowLayout.LEFT); - jPanel1 = new JPanel(); - jPanel1.setLayout(flowLayout); - jPanel1.add(getJTextField(), null); - jPanel1.add(getJButton(), null); - } - return jPanel1; - } - - /** - This method initializes jTextField - - @return javax.swing.JTextField - **/ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setHorizontalAlignment(javax.swing.JTextField.LEFT); - jTextField.setPreferredSize(new java.awt.Dimension(350, 20)); - } - return jTextField; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); - jButton.setText("Browse"); - jButton.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - jButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); - jButton.setToolTipText("Where is the package?"); - jButton.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 12)); - - jButton.setPreferredSize(new java.awt.Dimension(80, 20)); - jButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - if (chooser == null) { - chooser = new JFileChooser(); - } - // - // disable multi-selection, you can only select one item each time. - // - chooser.setMultiSelectionEnabled(false); - chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - chooser.setFileFilter(new PkgFileFilter("fdp")); - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - - File theFile = chooser.getSelectedFile(); - jTextField.setText(theFile.getPath()); - // - // set a default directory for installation (WORKSPACE\PackageFileName) - // - if (jTextField1.getText().length() > 0) { - int indexbegin = jTextField.getText().lastIndexOf(System.getProperty("file.separator")); - int indexend = jTextField.getText().lastIndexOf('.'); - if (indexbegin >= 0 && indexend >= 0) { - jTextField2.setText(jTextField1.getText() - + jTextField.getText().substring(indexbegin, indexend)); - } else { - JOptionPane.showMessageDialog(frame, "Wrong Path:" + jTextField.getText()); - } - } - } - } - }); - } - return jButton; - } - - /** - This method initializes jPanel2 - - @return javax.swing.JPanel - **/ - private JPanel getJPanel2() { - if (jPanel2 == null) { - FlowLayout flowLayout1 = new FlowLayout(); - flowLayout1.setAlignment(java.awt.FlowLayout.LEFT); - flowLayout1.setVgap(20); - jLabel1 = new JLabel(); - jLabel1.setText("Enter Workspace Location"); - jLabel1.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN); - jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING); - jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jPanel2 = new JPanel(); - jPanel2.setLayout(flowLayout1); - jPanel2.add(jLabel1, null); - } - return jPanel2; - } - - /** - This method initializes jPanel4 - - @return javax.swing.JPanel - **/ - private JPanel getJPanel4() { - if (jPanel4 == null) { - FlowLayout flowLayout2 = new FlowLayout(); - flowLayout2.setAlignment(java.awt.FlowLayout.LEFT); - jPanel4 = new JPanel(); - jPanel4.setLayout(flowLayout2); - jPanel4.add(getJTextField1(), null); - jPanel4.add(getJButton1(), null); - } - return jPanel4; - } - - /** - This method initializes jTextField1 - - @return javax.swing.JTextField - **/ - private JTextField getJTextField1() { - if (jTextField1 == null) { - jTextField1 = new JTextField(); - jTextField1.setPreferredSize(new java.awt.Dimension(350, 20)); - - } - // - // default value is WORKSPACE environmental variable value - // - jTextField1.setText(System.getenv("WORKSPACE")); - return jTextField1; - } - - /** - This method initializes jButton1 - - @return javax.swing.JButton - **/ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - - jButton1.setHorizontalAlignment(javax.swing.SwingConstants.LEADING); - jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING); - jButton1.setText("Browse"); - jButton1.setPreferredSize(new java.awt.Dimension(80, 20)); - jButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - if (chooser == null) { - chooser = new JFileChooser(); - } - // - // only directories can be selected for workspace location. - // - chooser.setMultiSelectionEnabled(false); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - - File theFile = chooser.getSelectedFile(); - jTextField1.setText(theFile.getPath()); - // - // set a default directory for installation (WORKSPACE\PackageFileName) - // - if (jTextField.getText().length() > 0) { - int indexbegin = jTextField.getText().lastIndexOf(System.getProperty("file.separator")); - int indexend = jTextField.getText().lastIndexOf('.'); - if (indexbegin >= 0 && indexend >= 0) { - jTextField2.setText(jTextField1.getText() - + jTextField.getText().substring(indexbegin, indexend)); - } else { - JOptionPane.showMessageDialog(frame, "Wrong Path:" + jTextField.getText()); - } - } - } - - } - }); - } - return jButton1; - } - - /** - This method initializes jButton4 - - @return javax.swing.JButton - **/ - private JButton getJButton4() { - if (jButton4 == null) { - jButton4 = new JButton(); - jButton4.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); - - jButton4.setHorizontalAlignment(SwingConstants.LEADING); - jButton4.setHorizontalTextPosition(SwingConstants.TRAILING); - jButton4.setText("Browse"); - jButton4.setPreferredSize(new Dimension(80, 20)); - jButton4.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - JFileChooser chooser = new JFileChooser(jTextField1.getText()); - - chooser.setMultiSelectionEnabled(false); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - // - // specify installation directory from file chooser - // - File theFile = chooser.getSelectedFile(); - jTextField2.setText(theFile.getPath()); - - } - } - }); - - } - return jButton4; - } - /** - This method initializes jPanel5 - - @return javax.swing.JPanel - **/ - private JPanel getJPanel5() { - if (jPanel5 == null) { - FlowLayout flowLayout3 = new FlowLayout(); - flowLayout3.setAlignment(java.awt.FlowLayout.LEFT); - flowLayout3.setVgap(20); - jLabel2 = new JLabel(); - jLabel2.setComponentOrientation(java.awt.ComponentOrientation.UNKNOWN); - jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.TRAILING); - jLabel2.setText("Enter Installation Location Within Workspace"); - jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); - jPanel5 = new JPanel(); - jPanel5.setLayout(flowLayout3); - jPanel5.add(jLabel2, null); - } - return jPanel5; - } - - /** - This method initializes jPanel6 - - @return javax.swing.JPanel - **/ - private JPanel getJPanel6() { - if (jPanel6 == null) { - FlowLayout flowLayout4 = new FlowLayout(); - flowLayout4.setAlignment(java.awt.FlowLayout.LEFT); - jPanel6 = new JPanel(); - jPanel6.setLayout(flowLayout4); - jPanel6.add(getJTextField2(), null); - jPanel6.add(getJButton4(), null); - } - return jPanel6; - } - - /** - This method initializes jPanel7 - - @return javax.swing.JPanel - **/ - private JPanel getJPanel7() { - if (jPanel7 == null) { - FlowLayout flowLayout5 = new FlowLayout(); - flowLayout5.setAlignment(java.awt.FlowLayout.RIGHT); - jPanel7 = new JPanel(); - jPanel7.setLayout(flowLayout5); - jPanel7.add(getJProgressBar(), null); - jPanel7.add(getJButton2(), null); - jPanel7.add(getJButton3(), null); - } - return jPanel7; - } - - /** - This method initializes jTextField2 - - @return javax.swing.JTextField - **/ - private JTextField getJTextField2() { - if (jTextField2 == null) { - jTextField2 = new JTextField(); - jTextField2.setPreferredSize(new java.awt.Dimension(350, 20)); - } - return jTextField2; - } - - /** - This method initializes jButton2 - - @return javax.swing.JButton - **/ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setPreferredSize(new java.awt.Dimension(80, 20)); - jButton2.setText("Ok"); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - try { - // - // The installation directory must under workspace directory - // - locationcheck(jTextField.getText(), jTextField1.getText(), jTextField2.getText()); - } catch (Exception ee) { - JOptionPane.showMessageDialog(frame, "Package Location Error!"); - return; - } - - try { - // - // create a new FrameworkPkg object with user-selected package, current workspace location. - // install the package to dest dir from jTextField2 - // - int i = new FrameworkPkg(jTextField.getText(), jTextField1.getText()) - .install(jTextField2 - .getText()); - // - // the package is installed smoothly - // - if (i == 0) { - JOptionPane.showMessageDialog(frame, "Package" + jTextField.getText() - + " Installed Successfully!"); - } - } catch (BasePkgNotInstalled bpni) { - // - // exception no base package installed - // - JOptionPane - .showMessageDialog(frame, - "The Edk package needs to be installed before installing any other packages."); - } catch (VerNotEqual vne) { - // - // show modal GUI PkgInstallTypeChooser with user selected package name, - // current workspace location and the list of package info with same base name - // - ModalFrameUtil.showAsModal(new PkgInstallTypeChooser(jTextField.getText(), - jTextField1.getText(), vne.getVersion()), - pThis); - - } catch (GuidNotEqual gne) { - // - // show modal GUI PkgInstallTypeChooser with user selected package name, - // current workspace location and the list of package info with same base name and version - // - ModalFrameUtil.showAsModal(new PkgInstallTypeChooser(jTextField.getText(), - jTextField1.getText(), gne.getGuid()), - pThis); - - } catch (SameAll sa) { - // - // the package with same (base, version, guid) already exists. confirm user action. - // quit or replace the original info. (So only one package info entry in db file that may be triple same) - // - int retVal = JOptionPane - .showConfirmDialog( - frame, - "Package already exists. Would you like to replace it?", - "Package Installation", JOptionPane.YES_NO_OPTION); - if (retVal == JOptionPane.YES_OPTION) { - String installDir = sa.getVersion().listIterator().next().getPathArray(0).getStringValue(); - try { - ForceInstallPkg f = new ForceInstallPkg(jTextField.getText(), jTextField1.getText()); - // - // Get old packag info to meet the calling parameter layout of DbFileContents.updatePkgInfo - // ForceInstallPkg will call it after installation to update package info. - // - f.setOldVersion(sa.getVersion().listIterator().next().getVersionArray(0)); - f.setOldGuid(sa.getVersion().listIterator().next().getGuidArray(0).getStringValue()); - int i = f.install(jTextField1.getText() + System.getProperty("file.separator") + installDir); - if (i == 0) { - JOptionPane.showMessageDialog(frame, "Package" + jTextField.getText() - + " Installed Successfully!"); - } - } catch (Exception sae) { - System.out.println(sae.toString()); - JOptionPane.showMessageDialog(frame, "Extraction Error!"); - } - } - return; - } catch (XmlException xmle) { - System.out.println(xmle.toString()); - JOptionPane.showMessageDialog(frame, "Package Format Error!"); - } catch (DirSame ds) { - // - // You cannot install different packages into the same directory. - // - System.out.println(ds.toString()); - JOptionPane.showMessageDialog(frame, - "Another Package Exists There, Please Select Another Directory!"); - } catch (Exception ext) { - System.out.println(ext.toString()); - JOptionPane.showMessageDialog(frame, "Extraction Error!"); - } - } - }); - } - return jButton2; - } - - /** - * This method initializes jButton3 - * - * @return javax.swing.JButton - */ - private JButton getJButton3() { - if (jButton3 == null) { - jButton3 = new JButton(); - jButton3.setPreferredSize(new java.awt.Dimension(80, 20)); - jButton3.setText("Cancel"); - jButton3.addMouseListener(this); - } - return jButton3; - - } - - /** - This method initializes jPanel3 - - @return javax.swing.JPanel - */ - private JPanel getJPanel3() { - if (jPanel3 == null) { - jLabel = new JLabel(); - jLabel.setComponentOrientation(ComponentOrientation.UNKNOWN); - jLabel.setHorizontalTextPosition(SwingConstants.TRAILING); - jLabel.setText("Enter Package Location"); - jLabel.setHorizontalAlignment(SwingConstants.TRAILING); - FlowLayout flowLayout6 = new FlowLayout(); - flowLayout6.setVgap(20); - flowLayout6.setAlignment(FlowLayout.LEFT); - jPanel3 = new JPanel(); - jPanel3.setLayout(flowLayout6); - jPanel3.add(jLabel, null); - } - return jPanel3; - } - - /** - check user input validity - - @param s package path - @param s1 workspace path - @param s2 installation path - @throws Exception - **/ - private void locationcheck(String s, String s1, String s2) throws Exception { - if (new File(s).isFile() == false) - throw new Exception(); - if (new File(s1).isDirectory() == false) - throw new Exception(); - if (s2.startsWith(s1) == false) - throw new Exception(); - } - - - public void mouseClicked(MouseEvent arg0) { - // TODO Auto-generated method stub - int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to exit?", "Quit", JOptionPane.YES_NO_OPTION); - if (retVal == JOptionPane.YES_OPTION) { - this.dispose(); - } - return; - } - - 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 - - } - - /** - This method initializes jProgressBar - - @return javax.swing.JProgressBar - **/ - private JProgressBar getJProgressBar() { - if (jProgressBar == null) { - jProgressBar = new JProgressBar(); - jProgressBar.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT); - jProgressBar.setVisible(false); - } - return jProgressBar; - } - - - -} // @jve:decl-index=0:visual-constraint="24,82" - -/** -Derived from WindowAdapter, Event adapter for windowClosing event - -@since PackageEditor 1.0 -**/ -class GuiPkgInstallAdapter extends WindowAdapter { - - private JFrame frame = null; - - GuiPkgInstallAdapter(JFrame f) { - super(); - frame = f; - } - - /* (non-Javadoc) - * @see java.awt.event.WindowAdapter#windowClosing(java.awt.event.WindowEvent) - */ - @Override - public void windowClosing(WindowEvent arg0) { - // TODO Auto-generated method stub - super.windowClosing(arg0); - int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to exit?", "Quit", - JOptionPane.YES_NO_OPTION); - if (retVal == JOptionPane.YES_OPTION) { - frame.dispose(); - } - - } - -} - -/** - Filter out some specific type of file - - @since PackageEditor 1.0 -**/ -class PkgFileFilter extends FileFilter { - - /// - /// hash table used to store filter info. - /// - private Hashtable filters = null; - - - public PkgFileFilter() { - this.filters = new Hashtable(); - } - - /** - Create filter and add extension to hash table - - @param extension file extension string (e.g. "exe") - **/ - public PkgFileFilter(String extension) { - this(); - if(extension!=null) { - addExtension(extension); - } - - } - - public PkgFileFilter(String[] fileFilters) { - this(); - int i = 0; - while (i < fileFilters.length) { - // add filters one by one - addExtension(fileFilters[i]); - i++; - } - - } - - - /* (non-Javadoc) - * @see javax.swing.filechooser.FileFilter#accept(java.io.File) - */ - public boolean accept(File f) { - if (f != null) { - if (f.isDirectory()) { - return true; - } - - if (getExtension(f) != null && filters.get(getExtension(f)) != null) { - return true; - } - } - return false; - } - - - /** - Get the extension string of file - - @param f target file - @return String - **/ - public String getExtension(File f) { - if (f != null) { - int i = f.getName().lastIndexOf('.'); - if (i>0 && i(5); - } - filters.put(ext.toLowerCase(), "ext"); - - } - - /* (non-Javadoc) - * @see javax.swing.filechooser.FileFilter#getDescription() - */ - public String getDescription() { - return null; - } - -} - diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgUninstall.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgUninstall.java deleted file mode 100644 index 667f65bf29..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuiPkgUninstall.java +++ /dev/null @@ -1,370 +0,0 @@ -/** @file - Java class GuiPkgUninstall is GUI for package installation. - -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.packaging; - -import javax.swing.JPanel; -import javax.swing.JFrame; -import java.awt.FlowLayout; -//import java.awt.GridLayout; -import javax.swing.JLabel; -import javax.swing.JTextField; -import java.awt.Dimension; -import javax.swing.JButton; -import java.awt.ComponentOrientation; -import java.awt.Font; -import java.awt.Toolkit; -import java.io.File; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.SwingConstants; -import javax.swing.JList; -import javax.swing.JTextPane; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.DefaultTableModel; - -/** - GUI for package uninstallation. - - @since PackageEditor 1.0 -**/ -public class GuiPkgUninstall extends JFrame { - - final static long serialVersionUID = 0; - - static JFrame frame; - - private JPanel jPanel = null; - - private JLabel jLabel = null; - - private JTextField jTextField = null; - - private JButton jButton = null; - - private JLabel jLabel1 = null; - - private JPanel jPanel1 = null; - - private JButton jButton1 = null; - - private JButton jButton2 = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private JButton jButton3 = null; - - private PkgRemoveTableModel model = null; - - private DbFileContents dfc = null; - - private JFrame pThis = null; - - - public GuiPkgUninstall() { - super(); - initialize(); - } - - - private void initialize() { - this.setSize(481, 404); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setContentPane(getJPanel()); - this.setTitle("Package Uninstallation"); - this.centerWindow(); - pThis = this; - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - initialize table contents from db file - - @param f FrameworkDatabase.db file under workspace - **/ - protected void loadDB(File f) { - if (!f.exists()) { - JOptionPane.showMessageDialog(frame, - "No FrameworkDatabase.db File!"); - return; - } - dfc = new DbFileContents(f); - if (dfc.getPackageCount() == 0) { - return; - } - // - // Get package list info. and add them one by one into table - // - String[][] saa = new String[dfc.getPackageCount()][5]; - dfc.getPackageList(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - - } - /** - save package info. from table to db file - **/ - protected void save() { - dfc.removePackageList(); - int rowCount = jTable.getRowCount(); - int i = 0; - while (i < rowCount) { - - dfc.genPackage(jTable.getValueAt(i, 0).toString(), jTable.getValueAt(i, 1).toString(), - jTable.getValueAt(i, 2).toString(), jTable.getValueAt(i, 3).toString(), - jTable.getValueAt(i, 4).toString()); - i++; - } - dfc.saveAs(); - } - - private JPanel getJPanel() { - if (jPanel == null) { - jLabel1 = new JLabel(); - jLabel1.setBounds(new java.awt.Rectangle(20, 83, 141, 16)); - jLabel1.setText(" Packages Installed"); - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(17, 16, 171, 16)); - jLabel.setText(" Enter Workspace Location"); - jPanel = new JPanel(); - jPanel.setLayout(null); - jPanel.add(jLabel, null); - jPanel.add(getJTextField(), null); - jPanel.add(getJButton(), null); - jPanel.add(jLabel1, null); - jPanel.add(getJPanel1(), null); - jPanel.add(getJScrollPane(), null); - } - return jPanel; - } - - /** - This method initializes jTextField - - @return javax.swing.JTextField - **/ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(16, 41, 350, 20)); - jTextField.setHorizontalAlignment(JTextField.LEFT); - jTextField.setEditable(false); - jTextField.setText(System.getenv("WORKSPACE")); - jTextField.setPreferredSize(new Dimension(350, 20)); - } - return jTextField; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(372,40,78,20)); - jButton.setFont(new Font("Dialog", Font.BOLD, 12)); - jButton.setPreferredSize(new Dimension(80, 20)); - jButton.setToolTipText("Where is the package?"); - jButton.setHorizontalAlignment(SwingConstants.LEFT); - jButton.setHorizontalTextPosition(SwingConstants.CENTER); - jButton.setText("Browse"); - jButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - // - // user can select another workspace directory - // - JFileChooser chooser = new JFileChooser(); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - chooser.setMultiSelectionEnabled(false); - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - // - // update table when user selects a new workspace directory - // - jTextField.setText(chooser.getSelectedFile().getPath()); - File f = new File(chooser.getSelectedFile(), FrameworkPkg.dbConfigFile); - loadDB(f); - } - } - }); - } - return jButton; - } - - /** - This method initializes jPanel1 - - @return javax.swing.JPanel - **/ - private JPanel getJPanel1() { - if (jPanel1 == null) { - FlowLayout flowLayout = new FlowLayout(); - flowLayout.setAlignment(java.awt.FlowLayout.LEFT); - flowLayout.setHgap(20); - jPanel1 = new JPanel(); - jPanel1.setLayout(flowLayout); - jPanel1.setBounds(new java.awt.Rectangle(133,310,318,53)); - jPanel1.add(getJButton3(), null); - jPanel1.add(getJButton1(), null); - jPanel1.add(getJButton2(), null); - } - return jPanel1; - } - - /** - This method initializes jButton1 - - @return javax.swing.JButton - **/ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setPreferredSize(new java.awt.Dimension(85, 20)); - jButton1.setText("Ok"); - jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); - jButton1.setEnabled(true); - jButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - if (dfc != null) { - // - // save package info. to file before exit - // - save(); - } - pThis.dispose(); - } - }); - } - return jButton1; - } - - /** - This method initializes jButton2 - - @return javax.swing.JButton - **/ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setPreferredSize(new java.awt.Dimension(85, 20)); - jButton2.setText("Cancel"); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - pThis.dispose(); - } - }); - } - return jButton2; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(20,108,431,194)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable() { - if (jTable == null) { - model = new PkgRemoveTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - jTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - jTable.setRowSelectionAllowed(true); - model.addColumn("PackageName"); - model.addColumn("Version"); - model.addColumn("GUID"); - model.addColumn("Path"); - model.addColumn("InstallDate"); - File f = new File(jTextField.getText(), FrameworkPkg.dbConfigFile); - loadDB(f); - } - return jTable; - } - - /** - This method initializes jButton3 - - @return javax.swing.JButton - **/ - private JButton getJButton3() { - if (jButton3 == null) { - jButton3 = new JButton(); - jButton3.setText("Remove"); - jButton3.setPreferredSize(new java.awt.Dimension(85,20)); - jButton3.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - if (model != null){ - int index = jTable.getSelectedRow(); - if (index > -1) { - model.removeRow(index); - } - } - } - }); - } - return jButton3; - } - -} // @jve:decl-index=0:visual-constraint="10,10" - -/** - Derived table model which disables table edit - - @since PackageEditor 1.0 -**/ -class PkgRemoveTableModel extends DefaultTableModel { - PkgRemoveTableModel() { - super(); - } - - public boolean isCellEditable (int row, int col) { - return false; - } -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuidEditor.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuidEditor.java deleted file mode 100644 index 3057f17bab..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuidEditor.java +++ /dev/null @@ -1,92 +0,0 @@ -/** @file - Java class GuidEditor. - -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.packaging; - -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.AbstractCellEditor; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JTable; -import javax.swing.table.TableCellEditor; - -import org.tianocore.common.Tools; - -/** - Editor for table cell with GUID value. - @since PackageEditor 1.0 - **/ -public class GuidEditor extends AbstractCellEditor implements TableCellEditor, ActionListener { - - String currentGuid; - JButton button; - static JFrame frame; - GenGuidDialog dialog; - protected static final String EDIT = "edit"; - - public GuidEditor() { - - button = new JButton(); - button.setActionCommand(EDIT); - button.addActionListener(this); - button.setBorderPainted(false); - - - dialog = new GenGuidDialog(this); - - } - - /* (non-Javadoc) - * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) - */ - public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) { - // TODO Auto-generated method stub - currentGuid = (String)arg1; - return button; - } - - /* (non-Javadoc) - * @see javax.swing.CellEditor#getCellEditorValue() - */ - public Object getCellEditorValue() { - // TODO Auto-generated method stub - return currentGuid; - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - public void actionPerformed(ActionEvent arg0) { - // TODO Auto-generated method stub - if (EDIT.equals(arg0.getActionCommand())) { - //The user has clicked the cell, so - //bring up the dialog. - button.setText(currentGuid); - dialog.setGuid(currentGuid); - dialog.setVisible(true); - - //Make the renderer reappear. - fireEditingStopped(); - } - else { //User pressed dialog's "OK" button. - currentGuid = dialog.getGuid(); - - } - - } - -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/ManifestContents.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/ManifestContents.java deleted file mode 100644 index 7bebc627a2..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/ManifestContents.java +++ /dev/null @@ -1,74 +0,0 @@ -/** @file - Java class ManifestContents is used to deal with FDPManifest.xml file related - operations. - -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.packaging; - -import org.apache.xmlbeans.XmlException; - -import org.tianocore.*; -import java.io.*; - -/** - This class operates on FDPManifest.xml file - - @since PackageEditor 1.0 -**/ -public class ManifestContents { - - /// - /// it is more convenient to get input stream from Jar entry of to-be-installed package file. - /// so i use InputStream instead of File - /// - private InputStream manIs = null; - - FrameworkDevPkgManifestDocument manDoc = null; - - HeaderDocument hdr = null; - - FrameworkDevPkgManifestDocument.FrameworkDevPkgManifest manRoot = null; - - public ManifestContents(InputStream fis) throws XmlException, IOException { - - manIs = fis; - manDoc = FrameworkDevPkgManifestDocument.Factory.parse(manIs); - manRoot = manDoc.getFrameworkDevPkgManifest(); - - } - - /** - Get package name from manifest file header. - - @return String - **/ - public String getBaseName() { - return manRoot.getHeader().getPackageName().getStringValue(); - } - - /** - Get package version from manifest file header. - - @return String - **/ - public String getVersion() { - return manRoot.getHeader().getVersion(); - } - - /** - Get package GUID from manifest file header. - - @return String - **/ - public String getGuid() { - return manRoot.getHeader().getGuid().getStringValue(); - } -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/ModalFrameUtil.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/ModalFrameUtil.java deleted file mode 100644 index a748a82f76..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/ModalFrameUtil.java +++ /dev/null @@ -1,107 +0,0 @@ -/** @file - Java class ModalFrameUtil is used to show modal frame. - -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.packaging; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -/** - This class is used to show modal frame. - - @since PackageEditor 1.0 -**/ -public class ModalFrameUtil { - /** - Invocation handler for event threads - - @since PackageEditor 1.0 - **/ - static class EventPump implements InvocationHandler { - Frame frame; - - public EventPump(Frame frame) { - this.frame = frame; - } - - /** - Invocation handler invoked by Method.invoke - **/ - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - // - // return frame showing status for Conditional.evaluate() - // - return frame.isShowing() ? Boolean.TRUE : Boolean.FALSE; - } - - public void start() throws Exception { - Class clazz = Class.forName("java.awt.Conditional"); - // - // Conditional proxy instance will invoke "this" InvocationHandler.invoke when calling its methods - // - Object conditional = Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, this); - // - // EventDisaptchThread.pumpEvents will be called under Conditional "conditional" - // - Method pumpMethod = Class.forName("java.awt.EventDispatchThread").getDeclaredMethod("pumpEvents", - new Class[] { clazz }); - pumpMethod.setAccessible(true); - // - // pumpEvents when conditional.evaluate() == true (frame.isShowing() in EventPump.invoke) - // - pumpMethod.invoke(Thread.currentThread(), new Object[] { conditional }); - } - } - - /** - Show modal frame, return only when frame closed. - - @param frame Frame to be modal - @param owner Parent Frame - **/ - public static void showAsModal(final Frame frame, final Frame owner) { - frame.addWindowListener(new WindowAdapter() { - public void windowOpened(WindowEvent e) { - owner.setEnabled(false); - } - - public void windowClosed(WindowEvent e) { - owner.setEnabled(true); - owner.setVisible(true); - owner.removeWindowListener(this); - } - }); - - owner.addWindowListener(new WindowAdapter() { - public void windowActivated(WindowEvent e) { - if (frame.isShowing()) { - frame.setExtendedState(JFrame.NORMAL); - frame.toFront(); - } else { - owner.removeWindowListener(this); - } - } - }); - - frame.setVisible(true); - try { - new EventPump(frame).start(); - } catch (Throwable throwable) { - throw new RuntimeException(throwable); - } - } -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java deleted file mode 100644 index 03e1607626..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageAction.java +++ /dev/null @@ -1,352 +0,0 @@ -/** @file - Java class PackageAction is GUI for create spd file. - -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.packaging; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JFrame; -import java.awt.GridLayout; -import java.io.File; - -import javax.swing.JButton; -import javax.swing.filechooser.FileFilter; - -/** - GUI for create spd file - - @since PackageEditor 1.0 -**/ -public class PackageAction extends JFrame { - - static JFrame frame; - - private JPanel jContentPane = null; - - private JButton jButton = null; - - private JButton jButton1 = null; - - private JButton jButton2 = null; - - private JButton jButton3 = null; - - private JButton jButton4 = null; - - private JButton jButton5 = null; - - private JButton jButton6 = null; - - private JButton jButton7 = null; - - /// - /// SpdFileContents object passed from main - /// - private SpdFileContents sfc = null; - - private JFrame pThis = null; // @jve:decl-index=0:visual-constraint="304,10" - - private JButton jButton8 = null; - - private JButton jButton9 = null; // @jve:decl-index=0:visual-constraint="116,388" - - /** - This is the default constructor - **/ - public PackageAction(SpdFileContents sfc) { - super(); - initialize(); - this.sfc = sfc; - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(305, 385); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setContentPane(getJContentPane()); - this.setTitle("Please Choose an Action"); - this.centerWindow(); - this.pThis = this; - - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - GridLayout gridLayout = new GridLayout(); - gridLayout.setRows(10); - gridLayout.setColumns(1); - jContentPane = new JPanel(); - jContentPane.setPreferredSize(new java.awt.Dimension(200,300)); - jContentPane.setLayout(gridLayout); - jContentPane.add(getJButton8(), null); - jContentPane.add(getJButton7(), null); - jContentPane.add(getJButton6(), null); - jContentPane.add(getJButton5(), null); - jContentPane.add(getJButton4(), null); - jContentPane.add(getJButton3(), null); - jContentPane.add(getJButton2(), null); - jContentPane.add(getJButton1(), null); - jContentPane.add(getJButton(), null); - jContentPane.add(getJButton9(), null); - } - return jContentPane; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - final FileFilter filter = new PkgFileFilter("spd"); - - if (jButton == null) { - jButton = new JButton(); - jButton.setText("Save"); - jButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - // - // save sfc contents to file - // - JFileChooser chooser = new JFileChooser(PackagingMain.dirForNewSpd); - chooser.setMultiSelectionEnabled(false); - chooser.setFileFilter(filter); - - int retval = chooser.showSaveDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - try { - File theFile = chooser.getSelectedFile(); - if (theFile.exists()) { - int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to replace the exising one?", "File Exists", - JOptionPane.YES_NO_OPTION); - if (retVal == JOptionPane.NO_OPTION) { - return; - } - } - sfc.saveAs(theFile); - - } catch (Exception ee) { - System.out.println(ee.toString()); - } -// pThis.dispose(); - } - - } - }); - } - return jButton; - } - - /** - This method initializes jButton1 - - @return javax.swing.JButton - **/ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setText("Add PCD Information"); - jButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - // - // Add PCD frame show modal - // - ModalFrameUtil.showAsModal(new PackagePCD(sfc), pThis); - } - }); - } - return jButton1; - } - - /** - This method initializes jButton2 - - @return javax.swing.JButton - **/ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setText("Add PPI Declarations"); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - // - // Add PPI frame show modal - // - ModalFrameUtil.showAsModal(new PackagePpi(sfc), pThis); - } - }); - } - return jButton2; - } - - /** - This method initializes jButton3 - - @return javax.swing.JButton - **/ - private JButton getJButton3() { - if (jButton3 == null) { - jButton3 = new JButton(); - jButton3.setText("Add Protocol Declarations"); - jButton3.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new PackageProtocols(sfc), pThis); - } - }); - } - return jButton3; - } - - /** - This method initializes jButton4 - - @return javax.swing.JButton - **/ - private JButton getJButton4() { - if (jButton4 == null) { - jButton4 = new JButton(); - jButton4.setText("Add GUID Declarations"); - jButton4.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new PackageGuids(sfc), pThis); - } - }); - } - return jButton4; - } - - /** - This method initializes jButton5 - - @return javax.swing.JButton - **/ - private JButton getJButton5() { - if (jButton5 == null) { - jButton5 = new JButton(); - jButton5.setText("Add Package Headers"); - jButton5.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new PackagePkgHeader(sfc), pThis); - } - }); - } - return jButton5; - } - - /** - This method initializes jButton6 - - @return javax.swing.JButton - **/ - private JButton getJButton6() { - if (jButton6 == null) { - jButton6 = new JButton(); - jButton6.setText("Add MSA Files"); - jButton6.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new PackageMsaFile(sfc), pThis); - } - }); - } - return jButton6; - } - - /** - This method initializes jButton7 - - @return javax.swing.JButton - **/ - private JButton getJButton7() { - if (jButton7 == null) { - jButton7 = new JButton(); - jButton7.setText("Add Library Classes"); - jButton7.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new PackageLibraryClass(sfc), pThis); - } - }); - } - return jButton7; - } - - /** - This method initializes jButton8 - - @return javax.swing.JButton - **/ - private JButton getJButton8() { - if (jButton8 == null) { - jButton8 = new JButton(); - jButton8.setText("Add SPD Header"); - jButton8.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new PackageNew(sfc), pThis); - } - }); - } - return jButton8; - } - - /** - This method initializes jButton9 - - @return javax.swing.JButton - **/ - private JButton getJButton9() { - if (jButton9 == null) { - jButton9 = new JButton(); - jButton9.setText("Done"); - jButton9.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - // - // quit current frame - // - pThis.dispose(); - - } - }); - } - return jButton9; - } - -} // @jve:decl-index=0:visual-constraint="104,41" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageGuids.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageGuids.java deleted file mode 100644 index 6562a2772f..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageGuids.java +++ /dev/null @@ -1,354 +0,0 @@ -/** @file - Java class PackageGuids is GUI for create GUID elements of spd file. - -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.packaging; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.DefaultListModel; -import javax.swing.JPanel; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JRadioButton; -import javax.swing.JComboBox; -import javax.swing.JButton; -import javax.swing.JFrame; - -import javax.swing.JScrollPane; -import javax.swing.JList; - -import org.tianocore.common.Tools; -import org.tianocore.packaging.common.ui.StarLabel; - -/** - GUI for create GUID elements of spd file - - @since PackageEditor 1.0 -**/ -public class PackageGuids extends JFrame implements ActionListener { - - private SpdFileContents sfc = null; - - private static String separator = "::"; - - private JPanel jContentPane = null; - - private JLabel jLabelC_Name = null; - - private JTextField jTextFieldC_Name = null; - - private JLabel jLabelGuidValue = null; - - private JTextField jTextFieldGuidValue = null; - - private JLabel jLabelHelpText = null; - - private JTextField jTextFieldName = null; - - private JLabel jLabelEnableFeature = null; - - private JRadioButton jRadioButtonEnableFeature = null; - - private JRadioButton jRadioButtonDisableFeature = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private JButton jButtonGenerateGuid = null; - - private StarLabel starLabel = null; - - private StarLabel starLabel1 = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setTitle("Guid Declarations"); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jTextFieldC_Name - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldC_Name() { - if (jTextFieldC_Name == null) { - jTextFieldC_Name = new JTextField(); - jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - } - return jTextFieldC_Name; - } - - /** - This method initializes jTextFieldGuidValsue - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldGuidValsue() { - if (jTextFieldGuidValue == null) { - jTextFieldGuidValue = new JTextField(); - jTextFieldGuidValue.setBounds(new java.awt.Rectangle(160, 35, 240, 20)); - } - return jTextFieldGuidValue; - } - - /** - This method initializes jTextFieldName - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldName() { - if (jTextFieldName == null) { - jTextFieldName = new JTextField(); - jTextFieldName.setBounds(new java.awt.Rectangle(160, 70, 320, 20)); - } - return jTextFieldName; - } - - /** - This method initializes jRadioButtonEnableFeature - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonEnableFeature() { - if (jRadioButtonEnableFeature == null) { - jRadioButtonEnableFeature = new JRadioButton(); - jRadioButtonEnableFeature.setText("Enable"); - jRadioButtonEnableFeature.setBounds(new java.awt.Rectangle(160, 104, 90, 20)); - jRadioButtonEnableFeature.setEnabled(false); - jRadioButtonEnableFeature.setSelected(true); - } - return jRadioButtonEnableFeature; - } - - /** - This method initializes jRadioButtonDisableFeature - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonDisableFeature() { - if (jRadioButtonDisableFeature == null) { - jRadioButtonDisableFeature = new JRadioButton(); - jRadioButtonDisableFeature.setText("Disable"); - jRadioButtonDisableFeature.setEnabled(false); - jRadioButtonDisableFeature.setBounds(new java.awt.Rectangle(250, 104, 90, 20)); - } - return jRadioButtonDisableFeature; - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("OK"); - jButtonOk.setBounds(new java.awt.Rectangle(300, 240, 75, 20)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 240, 74, 20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButtonGenerateGuid - - @return javax.swing.JButton - **/ - private JButton getJButtonGenerateGuid() { - if (jButtonGenerateGuid == null) { - jButtonGenerateGuid = new JButton(); - jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 35, 75, 20)); - jButtonGenerateGuid.setText("GEN"); - jButtonGenerateGuid.addActionListener(this); - } - return jButtonGenerateGuid; - } - - /** - This is the default constructor - **/ - public PackageGuids(SpdFileContents sfc) { - super(); - initialize(); - init(); - this.setVisible(true); - this.sfc = sfc; - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setSize(500, 300); - this.setContentPane(getJContentPane()); - this.setTitle("Add Guids"); - this.centerWindow(); - initFrame(); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - starLabel1 = new StarLabel(); - starLabel1.setBounds(new java.awt.Rectangle(5, 34, 10, 20)); - starLabel = new StarLabel(); - starLabel.setBounds(new java.awt.Rectangle(6, 10, 10, 20)); - jLabelEnableFeature = new JLabel(); - jLabelEnableFeature.setText("Enable Feature"); - jLabelEnableFeature.setEnabled(false); - jLabelEnableFeature.setBounds(new java.awt.Rectangle(15, 104, 140, 20)); - jLabelHelpText = new JLabel(); - jLabelHelpText.setText("Name"); - jLabelHelpText.setBounds(new java.awt.Rectangle(15, 70, 140, 20)); - jLabelGuidValue = new JLabel(); - jLabelGuidValue.setText("Guid Value"); - jLabelGuidValue.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("C_Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJTextFieldC_Name(), null); - jContentPane.add(jLabelGuidValue, null); - jContentPane.add(getJTextFieldGuidValsue(), null); - - jContentPane.add(jLabelHelpText, null); - jContentPane.add(getJTextFieldName(), null); - jContentPane.add(jLabelEnableFeature, null); - jContentPane.add(getJRadioButtonEnableFeature(), null); - jContentPane.add(getJRadioButtonDisableFeature(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButtonGenerateGuid(), null); - - jContentPane.add(starLabel, null); - jContentPane.add(starLabel1, null); - - initFrame(); - - } - return jContentPane; - } - - /** - This method initializes events groups and usage type - - **/ - private void initFrame() { - - } - - public void actionPerformed(ActionEvent arg0) { - // - // save and exit - // - if (arg0.getSource() == jButtonOk) { - - this.save(); - this.dispose(); - } - // - // exit - // - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - } - // - // generate a new GUID - // - if (arg0.getSource() == jButtonGenerateGuid) { - jTextFieldGuidValue.setText(Tools.generateUuidString()); - } - - if (arg0.getSource() == jRadioButtonEnableFeature) { - if (jRadioButtonEnableFeature.isSelected()) { - jRadioButtonDisableFeature.setSelected(false); - } - if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) { - jRadioButtonEnableFeature.setSelected(true); - } - } - - if (arg0.getSource() == jRadioButtonDisableFeature) { - if (jRadioButtonDisableFeature.isSelected()) { - jRadioButtonEnableFeature.setSelected(false); - } - if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) { - jRadioButtonDisableFeature.setSelected(true); - } - } - } - - /** - Add GUID entry to SpdFileContents object with element values from jTextFields* - **/ - protected void save() { - try { - String strName = jTextFieldName.getText(); - String strCName = jTextFieldC_Name.getText(); - String strGuid = jTextFieldGuidValue.getText(); - sfc.genSpdGuidDeclarations(strName, strCName, strGuid, null); - - } catch (Exception e) { - System.out.println(e.toString()); - } - } -} // @jve:decl-index=0:visual-constraint="10,10" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java deleted file mode 100644 index bf8c70b3df..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageLibraryClass.java +++ /dev/null @@ -1,560 +0,0 @@ -/** @file - Java class PackageLibraryClass is GUI for create library definition elements of spd file. - -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.packaging; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.Vector; - -import javax.swing.DefaultListModel; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JScrollPane; -import javax.swing.JButton; -import javax.swing.JFrame; - -/** - GUI for create library definition elements of spd file. - - @since PackageEditor 1.0 -**/ -public class PackageLibraryClass extends JFrame implements ActionListener { - static JFrame frame; - - private static String Separator = "::"; - - private DefaultListModel listItem = new DefaultListModel(); - - private SpdFileContents sfc = null; - - private JPanel jContentPane = null; - - private JRadioButton jRadioButtonAdd = null; - - private JRadioButton jRadioButtonSelect = null; - - private JTextField jTextFieldAdd = null; - - private JComboBox jComboBoxSelect = null; - - private JLabel jLabelUsage = null; - - private JComboBox jComboBoxUsage = null; - - private JScrollPane jScrollPane = null; - - private JList jListLibraryClassDefinitions = null; - - private JButton jButtonAdd = null; - - private JButton jButtonRemove = null; - - private JButton jButtonClearAll = null; - - private JButton jButtonCancel = null; - - private JButton jButtonOk = null; - - private JLabel jLabel = null; - - private JTextField jTextField = null; - - private JButton jButtonBrowse = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setTitle("Library Declarations"); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jRadioButtonAdd - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonAdd() { - if (jRadioButtonAdd == null) { - jRadioButtonAdd = new JRadioButton(); - jRadioButtonAdd.setBounds(new java.awt.Rectangle(10, 35, 205, 20)); - jRadioButtonAdd.setText("Add a new Library Class"); - jRadioButtonAdd.addActionListener(this); - jRadioButtonAdd.setSelected(false); - } - return jRadioButtonAdd; - } - - /** - This method initializes jRadioButtonSelect - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonSelect() { - if (jRadioButtonSelect == null) { - jRadioButtonSelect = new JRadioButton(); - jRadioButtonSelect.setBounds(new java.awt.Rectangle(10, 10, 205, 20)); - jRadioButtonSelect.setText("Select Existing Library Class"); - jRadioButtonSelect.addActionListener(this); - jRadioButtonSelect.setSelected(true); - } - return jRadioButtonSelect; - } - - /** - This method initializes jTextFieldAdd - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldAdd() { - if (jTextFieldAdd == null) { - jTextFieldAdd = new JTextField(); - jTextFieldAdd.setBounds(new java.awt.Rectangle(220, 35, 260, 20)); - jTextFieldAdd.setEnabled(false); - } - return jTextFieldAdd; - } - - /** - This method initializes jComboBoxSelect - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBoxSelect() { - if (jComboBoxSelect == null) { - jComboBoxSelect = new JComboBox(); - jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20)); - jComboBoxSelect.setEnabled(true); - } - return jComboBoxSelect; - } - - /** - This method initializes jComboBoxUsage - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBoxUsage() { - if (jComboBoxUsage == null) { - jComboBoxUsage = new JComboBox(); - jComboBoxUsage.setBounds(new java.awt.Rectangle(220, 60, 260, 20)); - jComboBoxUsage.setEnabled(false); - } - return jComboBoxUsage; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(10,149,350,146)); - jScrollPane.setViewportView(getJListLibraryClassDefinitions()); - } - return jScrollPane; - } - - /** - This method initializes jListLibraryClassDefinitions - - @return javax.swing.JList - **/ - private JList getJListLibraryClassDefinitions() { - if (jListLibraryClassDefinitions == null) { - jListLibraryClassDefinitions = new JList(listItem); - } - return jListLibraryClassDefinitions; - } - - /** - This method initializes jButtonAdd - - @return javax.swing.JButton - **/ - private JButton getJButtonAdd() { - if (jButtonAdd == null) { - jButtonAdd = new JButton(); - jButtonAdd.setBounds(new java.awt.Rectangle(375,152,90,20)); - jButtonAdd.setText("Add"); - jButtonAdd.addActionListener(this); - } - return jButtonAdd; - } - - /** - This method initializes jButtonRemove - - @return javax.swing.JButton - **/ - private JButton getJButtonRemove() { - if (jButtonRemove == null) { - jButtonRemove = new JButton(); - jButtonRemove.setBounds(new java.awt.Rectangle(375, 230, 90, 20)); - jButtonRemove.setText("Remove"); - jButtonRemove.addActionListener(this); - } - return jButtonRemove; - } - - /** - This method initializes jButtonRemoveAll - - @return javax.swing.JButton - **/ - private JButton getJButtonClearAll() { - if (jButtonClearAll == null) { - jButtonClearAll = new JButton(); - jButtonClearAll.setBounds(new java.awt.Rectangle(375, 260, 90, 20)); - jButtonClearAll.setText("Clear All"); - jButtonClearAll.addActionListener(this); - } - return jButtonClearAll; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20)); - jButtonCancel.setLocation(new java.awt.Point(390, 305)); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(90, 20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setSize(new java.awt.Dimension(90, 20)); - jButtonOk.setText("OK"); - jButtonOk.setLocation(new java.awt.Point(290, 305)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This is the default constructor - **/ - public PackageLibraryClass(SpdFileContents sfc) { - super(); - initialize(); - init(); - this.sfc = sfc; - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setContentPane(getJContentPane()); - this.setTitle("Library Class Declarations"); - this.setBounds(new java.awt.Rectangle(0, 0, 500, 370)); - this.centerWindow(); - initFrame(); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(14, 85, 201, 22)); - jLabel.setText("Include Header for Selected Class"); - jLabelUsage = new JLabel(); - jLabelUsage.setBounds(new java.awt.Rectangle(15, 60, 200, 20)); - jLabelUsage.setEnabled(false); - jLabelUsage.setText("Usage"); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJRadioButtonAdd(), null); - jContentPane.add(getJRadioButtonSelect(), null); - jContentPane.add(getJTextFieldAdd(), null); - jContentPane.add(getJComboBoxSelect(), null); - jContentPane.add(jLabelUsage, null); - jContentPane.add(getJComboBoxUsage(), null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonAdd(), null); - jContentPane.add(getJButtonRemove(), null); - jContentPane.add(getJButtonClearAll(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(jLabel, null); - jContentPane.add(getJTextField(), null); - jContentPane.add(getJButtonBrowse(), null); - } - return jContentPane; - } - - /** - fill ComboBoxes with pre-defined contents - **/ - private void initFrame() { - jComboBoxSelect.addItem("BaseCpuICacheFlush"); - jComboBoxSelect.addItem("BaseDebugLibNull"); - jComboBoxSelect.addItem("BaseDebugLibReportStatusCode"); - jComboBoxSelect.addItem("BaseIoLibIntrinsic"); - jComboBoxSelect.addItem("BaseLib"); - jComboBoxSelect.addItem("BaseMemoryLib"); - jComboBoxSelect.addItem("BaseMemoryLibMmx"); - jComboBoxSelect.addItem("BaseMemoryLibSse2"); - jComboBoxSelect.addItem("BasePeCoffGetEntryPointLib"); - jComboBoxSelect.addItem("BasePeCoffLib"); - jComboBoxSelect.addItem("BasePrintLib"); - jComboBoxSelect.addItem("BaseReportStatusCodeLibNull"); - jComboBoxSelect.addItem("CommonPciCf8Lib"); - jComboBoxSelect.addItem("CommonPciExpressLib"); - jComboBoxSelect.addItem("CommonPciLibCf8"); - jComboBoxSelect.addItem("CommonPciLibPciExpress"); - jComboBoxSelect.addItem("DxeCoreEntryPoint"); - jComboBoxSelect.addItem("DxeHobLib"); - jComboBoxSelect.addItem("DxeIoLibCpuIo"); - jComboBoxSelect.addItem("DxeLib"); - jComboBoxSelect.addItem("DxePcdLib"); - jComboBoxSelect.addItem("DxeReportStatusCodeLib"); - jComboBoxSelect.addItem("DxeServicesTableLib"); - jComboBoxSelect.addItem("PeiCoreEntryPoint"); - jComboBoxSelect.addItem("PeiMemoryLib"); - jComboBoxSelect.addItem("PeimEntryPoint"); - jComboBoxSelect.addItem("PeiReportStatusCodeLib"); - jComboBoxSelect.addItem("PeiServicesTablePointerLib"); - jComboBoxSelect.addItem("PeiServicesTablePointerLibMm7"); - jComboBoxSelect.addItem("UefiDebugLibConOut"); - jComboBoxSelect.addItem("UefiDebugLibStdErr"); - jComboBoxSelect.addItem("UefiDriverEntryPointMultiple"); - jComboBoxSelect.addItem("UefiDriverEntryPointSingle"); - jComboBoxSelect.addItem("UefiDriverEntryPointSingleUnload"); - jComboBoxSelect.addItem("UefiDriverModelLib"); - jComboBoxSelect.addItem("UefiDriverModelLibNoConfigNoDiag"); - jComboBoxSelect.addItem("UefiLib"); - jComboBoxSelect.addItem("UefiMemoryLib"); - - jComboBoxUsage.addItem("ALWAYS_CONSUMED"); - jComboBoxUsage.addItem("SOMETIMES_CONSUMED"); - jComboBoxUsage.addItem("ALWAYS_PRODUCED"); - jComboBoxUsage.addItem("SOMETIMES_PRODUCED"); - jComboBoxUsage.addItem("DEFAULT"); - jComboBoxUsage.addItem("PRIVATE"); - } - - /* (non-Javadoc) - * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) - */ - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - } - - if (arg0.getSource() == jButtonAdd) { - String strLibClass = ""; - if (jRadioButtonAdd.isSelected()) { - strLibClass = jTextFieldAdd.getText(); - } - if (jRadioButtonSelect.isSelected()) { - strLibClass = jComboBoxSelect.getSelectedItem().toString(); - } - listItem.addElement(jTextField.getText().replace('\\', '/') + this.Separator + strLibClass); - } - // - // remove selected line - // - if (arg0.getSource() == jButtonRemove) { - int intSelected[] = jListLibraryClassDefinitions.getSelectedIndices(); - if (intSelected.length > 0) { - for (int index = intSelected.length - 1; index > -1; index--) { - listItem.removeElementAt(intSelected[index]); - } - } - jListLibraryClassDefinitions.getSelectionModel().clearSelection(); - } - - if (arg0.getSource() == jButtonClearAll) { - listItem.removeAllElements(); - } - - if (arg0.getSource() == jRadioButtonAdd) { - if (jRadioButtonAdd.isSelected()) { - jRadioButtonSelect.setSelected(false); - jTextFieldAdd.setEnabled(true); - jComboBoxSelect.setEnabled(false); - } - if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) { - jRadioButtonAdd.setSelected(true); - jTextFieldAdd.setEnabled(true); - jComboBoxSelect.setEnabled(false); - } - } - - if (arg0.getSource() == jRadioButtonSelect) { - if (jRadioButtonSelect.isSelected()) { - jRadioButtonAdd.setSelected(false); - jTextFieldAdd.setEnabled(false); - jComboBoxSelect.setEnabled(true); - } - if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) { - jRadioButtonSelect.setSelected(true); - jTextFieldAdd.setEnabled(false); - jComboBoxSelect.setEnabled(true); - } - } - } - - /** - Add contents in list to sfc - **/ - protected void save() { - try { - int intLibraryCount = listItem.getSize(); - - if (intLibraryCount > 0) { - - for (int index = 0; index < intLibraryCount; index++) { - String strAll = listItem.get(index).toString(); - String strInclude = strAll.substring(0, strAll.indexOf(Separator)); - String strLibraryClass = strAll.substring(strAll.indexOf(Separator) + Separator.length()); - sfc.genSpdLibClassDeclarations(strLibraryClass, null, strInclude, null, null, null, null, null, - null, null); - } - } else { - - } - - } catch (Exception e) { - System.out.println(e.toString()); - } - } - - /** - This method initializes jTextField - - @return javax.swing.JTextField - **/ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(12,112,346,21)); - } - return jTextField; - } - - /** - This method initializes jButtonBrowse - - @return javax.swing.JButton - **/ - private JButton getJButtonBrowse() { - if (jButtonBrowse == null) { - jButtonBrowse = new JButton(); - jButtonBrowse.setBounds(new java.awt.Rectangle(374,111,92,21)); - jButtonBrowse.setText("Browse"); - jButtonBrowse.setPreferredSize(new java.awt.Dimension(34,20)); - jButtonBrowse.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - // - // Select files from current workspace - // - JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE")); - File theFile = null; - String headerDest = null; - - chooser.setMultiSelectionEnabled(false); - chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - - theFile = chooser.getSelectedFile(); - String file = theFile.getPath(); - if (!file.startsWith(System.getenv("WORKSPACE"))) { - JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!"); - return; - } - - - } - else { - return; - } - - if (!theFile.getPath().startsWith(PackagingMain.dirForNewSpd)) { - // - //ToDo: copy elsewhere header file to new pkg dir, prompt user to chooser a location - // - JOptionPane.showMessageDialog(frame, "You must copy header file into current package directory!"); - return; - } - - headerDest = theFile.getPath(); - int fileIndex = headerDest.indexOf(System.getProperty("file.separator"), PackagingMain.dirForNewSpd.length()); - - jTextField.setText(headerDest.substring(fileIndex + 1).replace('\\', '/')); - - } - }); - } - return jButtonBrowse; - } - -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java deleted file mode 100644 index 824c372d53..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageMsaFile.java +++ /dev/null @@ -1,371 +0,0 @@ -/** @file - Java class PackageMsaFile is GUI for create MsaFile elements of spd file. - -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.packaging; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.Vector; - -import javax.swing.DefaultListModel; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JScrollPane; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.filechooser.FileFilter; - -/** - GUI for create MsaFile elements of spd file - - @since PackageEditor 1.0 -**/ -public class PackageMsaFile extends JFrame implements ActionListener { - static JFrame frame; - - private DefaultListModel listItem = new DefaultListModel(); - - private SpdFileContents sfc = null; - - private JPanel jContentPane = null; - - private JScrollPane jScrollPane = null; - - private JList jListLibraryClassDefinitions = null; - - private JButton jButtonAdd = null; - - private JButton jButtonRemove = null; - - private JButton jButtonClearAll = null; - - private JButton jButtonCancel = null; - - private JButton jButtonOk = null; - - private JLabel jLabel = null; - - private JTextField jTextField = null; - - private JButton jButton = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setTitle("MSA Files"); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(10, 85, 350, 210)); - jScrollPane.setViewportView(getJListLibraryClassDefinitions()); - } - return jScrollPane; - } - - /** - This method initializes jListLibraryClassDefinitions - - @return javax.swing.JList - **/ - private JList getJListLibraryClassDefinitions() { - if (jListLibraryClassDefinitions == null) { - jListLibraryClassDefinitions = new JList(listItem); - } - return jListLibraryClassDefinitions; - } - - /** - This method initializes jButtonAdd - - @return javax.swing.JButton - **/ - private JButton getJButtonAdd() { - if (jButtonAdd == null) { - jButtonAdd = new JButton(); - jButtonAdd.setBounds(new java.awt.Rectangle(375, 132, 90, 20)); - jButtonAdd.setText("Add"); - jButtonAdd.addActionListener(this); - } - return jButtonAdd; - } - - /** - This method initializes jButtonRemove - - @return javax.swing.JButton - **/ - private JButton getJButtonRemove() { - if (jButtonRemove == null) { - jButtonRemove = new JButton(); - jButtonRemove.setBounds(new java.awt.Rectangle(375, 230, 90, 20)); - jButtonRemove.setText("Remove"); - jButtonRemove.addActionListener(this); - } - return jButtonRemove; - } - - /** - This method initializes jButtonRemoveAll - - @return javax.swing.JButton - **/ - private JButton getJButtonClearAll() { - if (jButtonClearAll == null) { - jButtonClearAll = new JButton(); - jButtonClearAll.setBounds(new java.awt.Rectangle(375, 260, 90, 20)); - jButtonClearAll.setText("Clear All"); - jButtonClearAll.addActionListener(this); - } - return jButtonClearAll; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20)); - jButtonCancel.setLocation(new java.awt.Point(390, 305)); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(90, 20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setSize(new java.awt.Dimension(90, 20)); - jButtonOk.setText("OK"); - jButtonOk.setLocation(new java.awt.Point(290, 305)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This is the default constructor - **/ - public PackageMsaFile(SpdFileContents sfc) { - super(); - initialize(); - init(); - this.sfc = sfc; - } - - /** - Start the window at the center of screen - - */ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setContentPane(getJContentPane()); - this.setTitle("Library Class Declarations"); - this.setBounds(new java.awt.Rectangle(0, 0, 500, 370)); - this.centerWindow(); - initFrame(); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(11,20,143,22)); - jLabel.setText("Msa File Path and Name"); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonAdd(), null); - jContentPane.add(getJButtonRemove(), null); - jContentPane.add(getJButtonClearAll(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(jLabel, null); - jContentPane.add(getJTextField(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - private void initFrame() { - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.dispose(); - this.save(); - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - } - - if (arg0.getSource() == jButtonAdd) { - - listItem.addElement(jTextField.getText()); - } - - if (arg0.getSource() == jButtonRemove) { - int intSelected[] = jListLibraryClassDefinitions.getSelectedIndices(); - if (intSelected.length > 0) { - for (int index = intSelected.length - 1; index > -1; index--) { - listItem.removeElementAt(intSelected[index]); - } - } - jListLibraryClassDefinitions.getSelectionModel().clearSelection(); - } - - if (arg0.getSource() == jButtonClearAll) { - listItem.removeAllElements(); - } - - } - - protected void save() { - try { - int intLibraryCount = listItem.getSize(); - - if (intLibraryCount > 0) { - - for (int index = 0; index < intLibraryCount; index++) { - String strAll = listItem.get(index).toString(); - sfc.genSpdMsaFiles(strAll, null); - } - } else { - - } - - } catch (Exception e) { - System.out.println(e.toString()); - } - } - - /** - This method initializes jTextField - - @return javax.swing.JTextField - **/ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(11,44,349,21)); - } - return jTextField; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - final FileFilter filter = new PkgFileFilter("msa"); - - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(377,46,89,20)); - jButton.setText("Browse"); - jButton.setPreferredSize(new java.awt.Dimension(34,20)); - jButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE")); - File theFile = null; - String msaDest = null; - - chooser.setMultiSelectionEnabled(false); - chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - chooser.setFileFilter(filter); - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - - theFile = chooser.getSelectedFile(); - String file = theFile.getPath(); - if (!file.startsWith(System.getenv("WORKSPACE"))) { - JOptionPane.showMessageDialog(frame, "You can only select files in current workspace!"); - return; - } - - } - else { - return; - } - - if (!theFile.getPath().startsWith(PackagingMain.dirForNewSpd)) { - // - //ToDo: copy elsewhere msa to new pkg dir, prompt user to chooser a location - // - JOptionPane.showMessageDialog(frame, "You must copy msa file into current package directory!"); - return; - } - - msaDest = theFile.getPath(); - int fileIndex = msaDest.indexOf(System.getProperty("file.separator"), PackagingMain.dirForNewSpd.length()); - - jTextField.setText(msaDest.substring(fileIndex + 1).replace('\\', '/')); - } - }); - } - return jButton; - } - -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageNew.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageNew.java deleted file mode 100644 index 85676a4b84..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageNew.java +++ /dev/null @@ -1,533 +0,0 @@ -/** @file - Java class PackageNew is the top level GUI for create spd file. - -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.packaging; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; -import javax.swing.JTextArea; -import javax.swing.JScrollPane; -import javax.swing.JComboBox; - -import org.tianocore.common.Tools; -import org.tianocore.packaging.common.ui.StarLabel; - -/** - This class contains GUI components to show various GUIs for creating spd file elements - - @since PackageEditor 1.0 -**/ -public class PackageNew extends JFrame implements ActionListener { - - private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="128,4" - - private JLabel jLabelBaseName = null; - - private JTextField jTextFieldBaseName = null; - - private JLabel jLabelGuid = null; - - private JTextField jTextFieldGuid = null; - - private JLabel jLabelVersion = null; - - private JTextField jTextFieldVersion = null; - - private JButton jButtonGenerateGuid = null; - - private JLabel jLabelLicense = null; - - private JTextArea jTextAreaLicense = null; - - private JLabel jLabelCopyright = null; - - private JTextArea jTextAreaCopyright = null; - - private JLabel jLabelDescription = null; - - private JTextArea jTextAreaDescription = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private JScrollPane jScrollPaneLicense = null; - - private JScrollPane jScrollPaneDescription = null; - - private JLabel jLabelAbstract = null; - - private JTextField jTextFieldAbstract = null; - - private JLabel jLabelModuleType = null; - - private JLabel jLabelCompontentType = null; - - private JComboBox jComboBox1 = null; - - private JComboBox jComboBoxModuleType = null; - - private StarLabel jStarLabel1 = null; - - private StarLabel jStarLabel2 = null; - - private StarLabel jStarLabel3 = null; - - private StarLabel jStarLabel4 = null; - - private StarLabel jStarLabel5 = null; - - private StarLabel jStarLabel6 = null; - - private StarLabel jStarLabel7 = null; - - private StarLabel jStarLabel8 = null; - - private JLabel jLabelURL = null; - - private JTextField jTextFieldAbstractURL = null; - - private JLabel jLabel = null; - - private JComboBox jComboBox = null; - - private SpdFileContents sfc = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jTextFieldBaseName - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldBaseName() { - if (jTextFieldBaseName == null) { - jTextFieldBaseName = new JTextField(); - jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - } - return jTextFieldBaseName; - } - - /** - This method initializes jTextFieldGuid - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldGuid() { - if (jTextFieldGuid == null) { - jTextFieldGuid = new JTextField(); - jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 240, 20)); - } - return jTextFieldGuid; - } - - /** - This method initializes jTextFieldVersion - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldVersion() { - if (jTextFieldVersion == null) { - jTextFieldVersion = new JTextField(); - jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - } - return jTextFieldVersion; - } - - /** - This method initializes jButtonGenerateGuid - - @return javax.swing.JButton - **/ - private JButton getJButtonGenerateGuid() { - if (jButtonGenerateGuid == null) { - jButtonGenerateGuid = new JButton(); - jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 35, 75, 20)); - jButtonGenerateGuid.setText("GEN"); - jButtonGenerateGuid.addActionListener(this); - } - return jButtonGenerateGuid; - } - - /** - This method initializes jTextAreaLicense - - @return javax.swing.JTextArea - **/ - private JTextArea getJTextAreaLicense() { - if (jTextAreaLicense == null) { - jTextAreaLicense = new JTextArea(); - jTextAreaLicense.setText(""); - jTextAreaLicense.setLineWrap(true); - } - return jTextAreaLicense; - } - - /** - This method initializes jTextAreaCopyright - - @return javax.swing.JTextArea - **/ - private JTextArea getJTextAreaCopyright() { - if (jTextAreaCopyright == null) { - jTextAreaCopyright = new JTextArea(); - jTextAreaCopyright.setLineWrap(true); - jTextAreaCopyright.setBounds(new java.awt.Rectangle(160,172,319,20)); - } - return jTextAreaCopyright; - } - - /** - This method initializes jTextAreaDescription - - @return javax.swing.JTextArea - **/ - private JTextArea getJTextAreaDescription() { - if (jTextAreaDescription == null) { - jTextAreaDescription = new JTextArea(); - jTextAreaDescription.setLineWrap(true); - } - return jTextAreaDescription; - } - - /** - This method initializes jButtonNext - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("OK"); - jButtonOk.setBounds(new java.awt.Rectangle(290, 481, 90, 20)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 481, 90, 20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPaneLicense() { - if (jScrollPaneLicense == null) { - jScrollPaneLicense = new JScrollPane(); - jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80)); - jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneLicense.setViewportView(getJTextAreaLicense()); - } - return jScrollPaneLicense; - } - - /** - This method initializes jScrollPane2 - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPaneDescription() { - if (jScrollPaneDescription == null) { - jScrollPaneDescription = new JScrollPane(); - jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 322, 320, 80)); - jScrollPaneDescription.setViewportView(getJTextAreaDescription()); - jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - } - return jScrollPaneDescription; - } - - /** - This method initializes jTextFieldAbstract - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldAbstract() { - if (jTextFieldAbstract == null) { - jTextFieldAbstract = new JTextField(); - jTextFieldAbstract.setBounds(new java.awt.Rectangle(159,218,318,70)); - } - return jTextFieldAbstract; - } - - /** - This method initializes jComboBoxCompontentType - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBox1() { - if (jComboBox1 == null) { - jComboBox1 = new JComboBox(); - jComboBox1.setBounds(new java.awt.Rectangle(160, 465, 91, 20)); - } - return jComboBox1; - } - - /** - This method initializes jComboBoxModuleType - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBoxModuleType() { - if (jComboBoxModuleType == null) { - jComboBoxModuleType = new JComboBox(); - jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 440, 91, 20)); - } - return jComboBoxModuleType; - } - - /** - This method initializes jTextFieldAbstractURL - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldAbstractURL() { - if (jTextFieldAbstractURL == null) { - jTextFieldAbstractURL = new JTextField(); - jTextFieldAbstractURL.setBounds(new java.awt.Rectangle(159, 414, 320, 20)); - } - return jTextFieldAbstractURL; - } - - public PackageNew(SpdFileContents sfc) { - super(); - initialize(); - init(); - this.setVisible(true); - this.sfc = sfc; - - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setSize(500, 560); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setContentPane(getJContentPane()); - this.setTitle("SPD File Header"); - this.centerWindow(); - //this.getRootPane().setDefaultButton(jButtonOk); - initFrame(); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(15, 490, 140, 21)); - jLabel.setText("Re-Package"); - jLabelURL = new JLabel(); - jLabelURL.setBounds(new java.awt.Rectangle(16, 414, 25, 20)); - jLabelURL.setText("URL"); - jLabelCompontentType = new JLabel(); - jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 465, 140, 20)); - jLabelCompontentType.setText("Read Only"); - jLabelModuleType = new JLabel(); - jLabelModuleType.setBounds(new java.awt.Rectangle(15, 440, 140, 20)); - jLabelModuleType.setText("Package Type"); - jLabelAbstract = new JLabel(); - jLabelAbstract.setBounds(new java.awt.Rectangle(15,218,140,20)); - jLabelAbstract.setText("Abstract"); - jLabelDescription = new JLabel(); - jLabelDescription.setText("Description"); - jLabelDescription.setBounds(new java.awt.Rectangle(16, 325, 140, 20)); - jLabelCopyright = new JLabel(); - jLabelCopyright.setText("Copyright"); - jLabelCopyright.setBounds(new java.awt.Rectangle(15, 171, 140, 20)); - jLabelLicense = new JLabel(); - jLabelLicense.setText("License"); - jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); - jLabelVersion = new JLabel(); - jLabelVersion.setText("Version"); - jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); - jLabelGuid = new JLabel(); - jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15)); - jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); - jLabelGuid.setText("Guid"); - jLabelBaseName = new JLabel(); - jLabelBaseName.setText("Package Name"); - jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setLocation(new java.awt.Point(0, 0)); - jContentPane.setSize(new java.awt.Dimension(500, 524)); - jContentPane.add(jLabelBaseName, null); - jContentPane.add(getJTextFieldBaseName(), null); - jContentPane.add(jLabelGuid, null); - jContentPane.add(getJTextFieldGuid(), null); - jContentPane.add(jLabelVersion, null); - jContentPane.add(getJTextFieldVersion(), null); - jContentPane.add(getJButtonGenerateGuid(), null); - jContentPane.add(jLabelLicense, null); - jContentPane.add(jLabelCopyright, null); - jContentPane.add(jLabelDescription, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJScrollPaneLicense(), null); - jContentPane.add(getJScrollPaneDescription(), null); - jContentPane.add(jLabelAbstract, null); - jContentPane.add(getJTextFieldAbstract(), null); - jContentPane.add(jLabelModuleType, null); - jContentPane.add(jLabelCompontentType, null); - jContentPane.add(getJComboBox1(), null); - jContentPane.add(getJComboBoxModuleType(), null); - - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(0, 10)); - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(0, 35)); - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(0, 60)); - jStarLabel4 = new StarLabel(); - jStarLabel4.setLocation(new java.awt.Point(0, 85)); - jStarLabel5 = new StarLabel(); - jStarLabel5.setLocation(new java.awt.Point(0, 171)); - jStarLabel6 = new StarLabel(); - jStarLabel6.setLocation(new java.awt.Point(1, 325)); - jStarLabel7 = new StarLabel(); - jStarLabel7.setLocation(new java.awt.Point(0,218)); - jStarLabel8 = new StarLabel(); - jStarLabel8.setLocation(new java.awt.Point(0, 440)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jStarLabel4, null); - jContentPane.add(jStarLabel5, null); - jContentPane.add(jStarLabel6, null); - jContentPane.add(jStarLabel7, null); - jContentPane.add(jStarLabel8, null); - jContentPane.add(jLabelURL, null); - jContentPane.add(getJTextFieldAbstractURL(), null); - jContentPane.add(jLabel, null); - jContentPane.add(getJComboBox(), null); - jContentPane.add(getJTextAreaCopyright(), null); - } - return jContentPane; - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - } - - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - } - - if (arg0.getSource() == jButtonGenerateGuid) { - jTextFieldGuid.setText(Tools.generateUuidString()); - } - } - - /** - Save all components of Msa Header - if exist, set the value directly - if not exist, new instance first - - **/ - private void save() { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - Date date = new Date(); - sfc.genSpdHeader(jTextFieldBaseName.getText(), jTextFieldGuid.getText(), jTextFieldVersion.getText(), - jTextFieldAbstract.getText(), jTextAreaDescription.getText(), jTextAreaCopyright.getText(), - jTextAreaLicense.getText(), format.format(date), format.format(date), - jTextFieldAbstractURL.getText(), jComboBoxModuleType.getSelectedItem().toString(), - jComboBox1.getSelectedItem().toString(), jComboBox.getSelectedItem().toString(), null, null); - } - - /** - This method initializes module type and compontent type - - **/ - private void initFrame() { - jComboBoxModuleType.addItem("SOURCE"); - jComboBoxModuleType.addItem("BINARY"); - jComboBoxModuleType.addItem("MIXED"); - - jComboBox1.addItem("true"); - jComboBox1.addItem("false"); - - jComboBox.addItem("false"); - jComboBox.addItem("true"); - - } - - /** - This method initializes jComboBox - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBox() { - if (jComboBox == null) { - jComboBox = new JComboBox(); - jComboBox.setBounds(new java.awt.Rectangle(160, 490, 90, 20)); - } - return jComboBox; - } - -} // @jve:decl-index=0:visual-constraint="38,-22" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePCD.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePCD.java deleted file mode 100644 index 910540c4eb..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePCD.java +++ /dev/null @@ -1,321 +0,0 @@ -/** @file - Java class PackagePCD is GUI for create PCD definition elements of spd file. - -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.packaging; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.ButtonGroup; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JComboBox; -import javax.swing.JButton; -import javax.swing.JFrame; - -import org.tianocore.common.Tools; -import org.tianocore.packaging.common.ui.StarLabel; - -/** - GUI for create PCD definition elements of spd file - - @since PackageEditor 1.0 -**/ -public class PackagePCD extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private JLabel jLabelItemType = null; - - private JLabel jLabelC_Name = null; - - private JComboBox jComboBoxItemType = null; - - private JTextField jTextFieldC_Name = null; - - private JLabel jLabelToken = null; - - private JTextField jTextFieldToken = null; - - private JLabel jLabelDataType = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private JComboBox jComboBoxDataType = null; - - private JLabel jLabelOverrideID = null; - - private JTextField jTextFieldOverrideID = null; - - private ButtonGroup bg1 = null; - - private ButtonGroup bg2 = null; - - private ButtonGroup bg3 = null; - - private StarLabel jStarLabel2 = null; - - private StarLabel jStarLabel3 = null; - - private SpdFileContents sfc = null; - - private StarLabel jStarLabel = null; - - private StarLabel jStarLabel1 = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setTitle("PCD Definition"); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jComboBoxItemType - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBoxItemType() { - if (jComboBoxItemType == null) { - jComboBoxItemType = new JComboBox(); - jComboBoxItemType.setBounds(new java.awt.Rectangle(160, 110, 320, 20)); - } - return jComboBoxItemType; - } - - /** - This method initializes jTextFieldC_Name - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldC_Name() { - if (jTextFieldC_Name == null) { - jTextFieldC_Name = new JTextField(); - jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - } - return jTextFieldC_Name; - } - - /** - This method initializes jTextFieldToken - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldToken() { - if (jTextFieldToken == null) { - jTextFieldToken = new JTextField(); - jTextFieldToken.setBounds(new java.awt.Rectangle(160, 135, 320, 20)); - } - return jTextFieldToken; - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("OK"); - jButtonOk.setBounds(new java.awt.Rectangle(279,247,90,20)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setBounds(new java.awt.Rectangle(389,247,90,20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jComboBoxDataType - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBoxDataType() { - if (jComboBoxDataType == null) { - jComboBoxDataType = new JComboBox(); - jComboBoxDataType.setBounds(new java.awt.Rectangle(160, 160, 320, 20)); - } - return jComboBoxDataType; - } - - /** - This method initializes jTextFieldOverrideID - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldOverrideID() { - if (jTextFieldOverrideID == null) { - jTextFieldOverrideID = new JTextField(); - jTextFieldOverrideID.setBounds(new java.awt.Rectangle(159,198,320,20)); - } - return jTextFieldOverrideID; - } - - /** - This is the default constructor - **/ - public PackagePCD(SpdFileContents sfc) { - super(); - init(); - initialize(); - this.sfc = sfc; - } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setSize(500, 450); - this.setContentPane(getJContentPane()); - this.setTitle("Add PCDs"); - this.centerWindow(); - this.getRootPane().setDefaultButton(jButtonOk); - initFrame(); - this.setVisible(true); - } - - /** - Start the window at the center of screen - * - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - * - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - private JPanel getJContentPane() { - if (jContentPane == null) { - jLabelOverrideID = new JLabel(); - jLabelOverrideID.setBounds(new java.awt.Rectangle(14,197,140,20)); - jLabelOverrideID.setText("Default Value"); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("C_Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); - jLabelDataType = new JLabel(); - jLabelDataType.setText("Data Type"); - jLabelDataType.setBounds(new java.awt.Rectangle(15, 160, 140, 20)); - jLabelToken = new JLabel(); - jLabelToken.setText("Token"); - jLabelToken.setBounds(new java.awt.Rectangle(15, 135, 140, 20)); - jLabelItemType = new JLabel(); - jLabelItemType.setText("Item Type"); - jLabelItemType.setBounds(new java.awt.Rectangle(15, 110, 140, 20)); - bg1 = new ButtonGroup(); - bg2 = new ButtonGroup(); - bg3 = new ButtonGroup(); - //bg1.add(getJRadioButtonPCData()); - //bg2.add(getJRadioButtonPcdBuildData()); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - //jContentPane.add(bg1); - jContentPane.add(jLabelItemType, null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJTextFieldC_Name(), null); - jContentPane.add(jLabelToken, null); - jContentPane.add(getJTextFieldToken(), null); - jContentPane.add(jLabelDataType, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJComboBoxItemType(), null); - jContentPane.add(getJComboBoxDataType(), null); - jContentPane.add(jLabelOverrideID, null); - jContentPane.add(getJTextFieldOverrideID(), null); - - jStarLabel = new StarLabel(); - jStarLabel1 = new StarLabel(); - jStarLabel1.setBounds(new java.awt.Rectangle(6, 59, 10, 20)); - jStarLabel2 = new StarLabel(); - jStarLabel3 = new StarLabel(); - jStarLabel.setLocation(new java.awt.Point(6, 110)); - jStarLabel.setLocation(new java.awt.Point(5, 85)); - jStarLabel2.setLocation(new java.awt.Point(5, 134)); - jStarLabel3.setLocation(new java.awt.Point(5, 159)); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jStarLabel, null); - jContentPane.add(jStarLabel1, null); - } - return jContentPane; - } - - /** - This method initializes comboboxes - - **/ - private void initFrame() { - - jComboBoxItemType.addItem("FEATURE_FLAG"); - jComboBoxItemType.addItem("FIXED_AT_BUILD"); - jComboBoxItemType.addItem("PATCHABLE_IN_MODULE"); - jComboBoxItemType.addItem("DYNAMIC"); - jComboBoxItemType.addItem("DYNAMIC_EX"); - - jComboBoxDataType.addItem("UINT8"); - jComboBoxDataType.addItem("UINT16"); - jComboBoxDataType.addItem("UINT32"); - jComboBoxDataType.addItem("UINT64"); - jComboBoxDataType.addItem("VOID*"); - jComboBoxDataType.addItem("BOOLEAN"); - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - save(); - this.dispose(); - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - } - - - } - - protected void save() { - - sfc.genSpdPcdDefinitions(jComboBoxItemType.getSelectedItem().toString(), jTextFieldC_Name.getText(), - jTextFieldToken.getText(), jComboBoxDataType.getSelectedItem().toString(), null, - null, null, null, null, null, jTextFieldOverrideID.getText()); - } -} // @jve:decl-index=0:visual-constraint="22,11" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java deleted file mode 100644 index 8d0eb7dc89..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePkgHeader.java +++ /dev/null @@ -1,454 +0,0 @@ -/** @file - Java class PackagePkgHeader is GUI for create Package header elements of spd file. - -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.packaging; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Vector; - -import javax.swing.DefaultListModel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JScrollPane; -import javax.swing.JButton; -import javax.swing.JFrame; - -import org.tianocore.packaging.common.ui.StarLabel; - -/** - GUI for create Package header elements of spd file - - @since PackageEditor 1.0 -**/ -public class PackagePkgHeader extends JFrame implements ActionListener { - private static String Separator = "::"; - - private DefaultListModel listItem = new DefaultListModel(); - - private SpdFileContents sfc = null; - - private JPanel jContentPane = null; - - private JRadioButton jRadioButtonAdd = null; - - private JRadioButton jRadioButtonSelect = null; - - private JTextField jTextFieldAdd = null; - - private JComboBox jComboBoxSelect = null; - - private JScrollPane jScrollPane = null; - - private JList jListLibraryClassDefinitions = null; - - private JButton jButtonAdd = null; - - private JButton jButtonRemove = null; - - private JButton jButtonClearAll = null; - - private JButton jButtonCancel = null; - - private JButton jButtonOk = null; - - private JLabel jLabel = null; - - private JTextField jTextField = null; - - private StarLabel starLabel = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setTitle("Package Headers"); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jRadioButtonAdd - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonAdd() { - if (jRadioButtonAdd == null) { - jRadioButtonAdd = new JRadioButton(); - jRadioButtonAdd.setBounds(new java.awt.Rectangle(10, 35, 205, 20)); - jRadioButtonAdd.setText("Add a new Module Type"); - jRadioButtonAdd.setEnabled(false); - jRadioButtonAdd.addActionListener(this); - jRadioButtonAdd.setSelected(false); - } - return jRadioButtonAdd; - } - - /** - This method initializes jRadioButtonSelect - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonSelect() { - if (jRadioButtonSelect == null) { - jRadioButtonSelect = new JRadioButton(); - jRadioButtonSelect.setBounds(new java.awt.Rectangle(10, 10, 205, 20)); - jRadioButtonSelect.setText("Select an existed Module Type"); - jRadioButtonSelect.setActionCommand("Select an existed Module Type"); - jRadioButtonSelect.addActionListener(this); - jRadioButtonSelect.setSelected(true); - } - return jRadioButtonSelect; - } - - /** - This method initializes jTextFieldAdd - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldAdd() { - if (jTextFieldAdd == null) { - jTextFieldAdd = new JTextField(); - jTextFieldAdd.setBounds(new java.awt.Rectangle(220, 35, 260, 20)); - jTextFieldAdd.setEditable(false); - jTextFieldAdd.setEnabled(false); - } - return jTextFieldAdd; - } - - /** - This method initializes jComboBoxSelect - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBoxSelect() { - if (jComboBoxSelect == null) { - jComboBoxSelect = new JComboBox(); - jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20)); - jComboBoxSelect.setEnabled(true); - } - return jComboBoxSelect; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(10, 121, 350, 174)); - jScrollPane.setViewportView(getJListLibraryClassDefinitions()); - } - return jScrollPane; - } - - /** - This method initializes jListLibraryClassDefinitions - - @return javax.swing.JList - **/ - private JList getJListLibraryClassDefinitions() { - if (jListLibraryClassDefinitions == null) { - jListLibraryClassDefinitions = new JList(listItem); - } - return jListLibraryClassDefinitions; - } - - /** - This method initializes jButtonAdd - - @return javax.swing.JButton - **/ - private JButton getJButtonAdd() { - if (jButtonAdd == null) { - jButtonAdd = new JButton(); - jButtonAdd.setBounds(new java.awt.Rectangle(375, 132, 90, 20)); - jButtonAdd.setText("Add"); - jButtonAdd.addActionListener(this); - } - return jButtonAdd; - } - - /** - This method initializes jButtonRemove - - @return javax.swing.JButton - **/ - private JButton getJButtonRemove() { - if (jButtonRemove == null) { - jButtonRemove = new JButton(); - jButtonRemove.setBounds(new java.awt.Rectangle(375, 230, 90, 20)); - jButtonRemove.setText("Remove"); - jButtonRemove.addActionListener(this); - } - return jButtonRemove; - } - - /** - This method initializes jButtonRemoveAll - - @return javax.swing.JButton - **/ - private JButton getJButtonClearAll() { - if (jButtonClearAll == null) { - jButtonClearAll = new JButton(); - jButtonClearAll.setBounds(new java.awt.Rectangle(375, 260, 90, 20)); - jButtonClearAll.setText("Clear All"); - jButtonClearAll.addActionListener(this); - } - return jButtonClearAll; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20)); - jButtonCancel.setLocation(new java.awt.Point(390, 305)); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(90, 20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setSize(new java.awt.Dimension(90, 20)); - jButtonOk.setText("OK"); - jButtonOk.setLocation(new java.awt.Point(290, 305)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This is the default constructor - **/ - public PackagePkgHeader(SpdFileContents sfc) { - super(); - initialize(); - init(); - this.sfc = sfc; - } - - /** - Start the window at the center of screen - * - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - * - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - // private void init(LibraryClassDefinitionsDocument.LibraryClassDefinitions inLibraryClassDefinitions) { - // init(); - // this.setLibraryClassDefinitions(inLibraryClassDefinitions); - // int intLibraryCount = this.libraryClassDefinitions.getLibraryClassArray().length; - // if (intLibraryCount > 0) { - // for (int index = 0; index < intLibraryCount; index++) { - // listItem.addElement(this.libraryClassDefinitions.getLibraryClassArray(index).getUsage().toString() + - // this.Separator + - // this.libraryClassDefinitions.getLibraryClassArray(index).getStringValue()); - // this.libraryClassDefinitions.getLibraryClassArray(); - // } - // } - // } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setContentPane(getJContentPane()); - this.setTitle("Library Class Declarations"); - this.setBounds(new java.awt.Rectangle(0, 0, 500, 370)); - this.centerWindow(); - initFrame(); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - starLabel = new StarLabel(); - starLabel.setBounds(new java.awt.Rectangle(5, 85, 10, 20)); - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(14, 85, 201, 22)); - jLabel.setText("Include Header for Selected Type"); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJRadioButtonAdd(), null); - jContentPane.add(getJRadioButtonSelect(), null); - jContentPane.add(getJTextFieldAdd(), null); - jContentPane.add(getJComboBoxSelect(), null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonAdd(), null); - jContentPane.add(getJButtonRemove(), null); - jContentPane.add(getJButtonClearAll(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(jLabel, null); - jContentPane.add(getJTextField(), null); - jContentPane.add(starLabel, null); - } - return jContentPane; - } - - private void initFrame() { - jComboBoxSelect.addItem("BASE"); - jComboBoxSelect.addItem("SEC"); - jComboBoxSelect.addItem("PEI_CORE"); - jComboBoxSelect.addItem("PEIM"); - jComboBoxSelect.addItem("DXE_CORE"); - jComboBoxSelect.addItem("DXE_DRIVER"); - jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER"); - jComboBoxSelect.addItem("DXE_SAL_DRIVER"); - jComboBoxSelect.addItem("DXE_SMM_DRIVER"); - jComboBoxSelect.addItem("TOOLS"); - jComboBoxSelect.addItem("UEFI_DRIVER"); - jComboBoxSelect.addItem("UEFI_APPLICATION"); - jComboBoxSelect.addItem("USER_DEFINED"); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - } - - if (arg0.getSource() == jButtonAdd) { - String strLibClass = ""; - - if (jRadioButtonAdd.isSelected()) { - strLibClass = jTextFieldAdd.getText(); - } - if (jRadioButtonSelect.isSelected()) { - strLibClass = jComboBoxSelect.getSelectedItem().toString(); - } - - listItem.addElement(jTextField.getText().replace('\\', '/') + Separator + strLibClass); - } - - if (arg0.getSource() == jButtonRemove) { - int intSelected[] = jListLibraryClassDefinitions.getSelectedIndices(); - if (intSelected.length > 0) { - for (int index = intSelected.length - 1; index > -1; index--) { - listItem.removeElementAt(intSelected[index]); - } - } - jListLibraryClassDefinitions.getSelectionModel().clearSelection(); - } - - if (arg0.getSource() == jButtonClearAll) { - listItem.removeAllElements(); - } - - if (arg0.getSource() == jRadioButtonAdd) { - if (jRadioButtonAdd.isSelected()) { - jRadioButtonSelect.setSelected(false); - jTextFieldAdd.setEnabled(true); - jComboBoxSelect.setEnabled(false); - } - if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) { - jRadioButtonAdd.setSelected(true); - jTextFieldAdd.setEnabled(true); - jComboBoxSelect.setEnabled(false); - } - } - - if (arg0.getSource() == jRadioButtonSelect) { - if (jRadioButtonSelect.isSelected()) { - jRadioButtonAdd.setSelected(false); - jTextFieldAdd.setEnabled(false); - jComboBoxSelect.setEnabled(true); - } - if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) { - jRadioButtonSelect.setSelected(true); - jTextFieldAdd.setEnabled(false); - jComboBoxSelect.setEnabled(true); - } - } - } - - private void save() { - try { - int intLibraryCount = listItem.getSize(); - - if (intLibraryCount > 0) { - - for (int index = 0; index < intLibraryCount; index++) { - String strAll = listItem.get(index).toString(); - String strInclude = strAll.substring(0, strAll.indexOf(Separator)); - String strType = strAll.substring(strAll.indexOf(Separator) + Separator.length()); - sfc.genSpdModuleHeaders(strType, strInclude, null, null, null, null, null, null); - } - } else { - - } - - } catch (Exception e) { - System.out.println(e.toString()); - } - } - - /** - This method initializes jTextField - - @return javax.swing.JTextField - **/ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(221, 86, 257, 21)); - } - return jTextField; - } - -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePpi.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePpi.java deleted file mode 100644 index 7b62d804e5..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagePpi.java +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - Java class PackagePpi is GUI for create Ppi definition elements of spd file. - -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.packaging; - -/** - GUI derived from PackageProtocols class, override save() method - - @since PackageEditor 1.0 -**/ -public class PackagePpi extends PackageProtocols { - - private SpdFileContents sfc = null; - - public PackagePpi(SpdFileContents sfc) { - super(sfc); - // TODO Auto-generated constructor stub - this.sfc = sfc; - } - - /** - add ppi definitions from GUI to SpdFileContents object passed in. - **/ - protected void save() { - try { - sfc.genSpdPpiDeclarations(getJTextField().getText(), getJTextFieldC_Name().getText(), - getJTextFieldGuid().getText(), null); - } catch (Exception e) { - System.out.println(e.toString()); - } - } -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageProtocols.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageProtocols.java deleted file mode 100644 index d99d18b4e6..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackageProtocols.java +++ /dev/null @@ -1,377 +0,0 @@ -/** @file - Java class PackageProtocols is GUI for create Protocol definition elements of spd file. - -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.packaging; - -import javax.swing.JPanel; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JComboBox; -import javax.swing.JRadioButton; -import javax.swing.JFrame; - -import org.tianocore.common.Tools; -import org.tianocore.packaging.common.ui.StarLabel; - -/** - GUI for create Protocol definition elements of spd file. - - @since PackageEditor 1.0 -**/ -public class PackageProtocols extends JFrame implements ActionListener { - - private int location = -1; - - private SpdFileContents sfc = null; - - private JPanel jContentPane = null; - - private JLabel jLabelC_Name = null; - - private JTextField jTextFieldC_Name = null; - - private JLabel jLabelGuid = null; - - private JTextField jTextFieldGuid = null; - - private JLabel jLabelFeatureFlag = null; - - private JTextField jTextFieldFeatureFlag = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private JLabel jLabelEnableFeature = null; - - private JRadioButton jRadioButtonEnableFeature = null; - - private JRadioButton jRadioButtonDisableFeature = null; - - private JButton jButtonGenerateGuid = null; - - private StarLabel jStarLabel2 = null; - - private StarLabel starLabel = null; - - private JLabel jLabel = null; - - private JTextField jTextField = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jTextFieldProtocolName - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldProtocolName() { - if (jTextFieldC_Name == null) { - jTextFieldC_Name = new JTextField(); - jTextFieldC_Name.setBounds(new java.awt.Rectangle(160, 35, 320, 20)); - } - return jTextFieldC_Name; - } - - /** - This method initializes jTextFieldGuid - - @return javax.swing.JTextField - **/ - public JTextField getJTextFieldGuid() { - if (jTextFieldGuid == null) { - jTextFieldGuid = new JTextField(); - jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 60, 240, 20)); - } - return jTextFieldGuid; - } - - /** - This method initializes jTextFieldFeatureFlag - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldFeatureFlag() { - if (jTextFieldFeatureFlag == null) { - jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(160, 135, 320, 20)); - jTextFieldFeatureFlag.setEnabled(false); - } - return jTextFieldFeatureFlag; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("OK"); - jButtonOk.setBounds(new java.awt.Rectangle(290, 190, 90, 20)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButton1 - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 190, 90, 20)); - jButtonCancel.setPreferredSize(new Dimension(90, 20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jRadioButtonEnableFeature - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonEnableFeature() { - if (jRadioButtonEnableFeature == null) { - jRadioButtonEnableFeature = new JRadioButton(); - jRadioButtonEnableFeature.setText("Enable"); - jRadioButtonEnableFeature.setBounds(new java.awt.Rectangle(160, 110, 90, 20)); - jRadioButtonEnableFeature.setEnabled(false); - jRadioButtonEnableFeature.addActionListener(this); - jRadioButtonEnableFeature.setSelected(true); - } - return jRadioButtonEnableFeature; - } - - /** - This method initializes jRadioButtonDisableFeature - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonDisableFeature() { - if (jRadioButtonDisableFeature == null) { - jRadioButtonDisableFeature = new JRadioButton(); - jRadioButtonDisableFeature.setText("Disable"); - jRadioButtonDisableFeature.setEnabled(false); - jRadioButtonDisableFeature.setBounds(new java.awt.Rectangle(320, 110, 90, 20)); - jRadioButtonDisableFeature.addActionListener(this); - } - return jRadioButtonDisableFeature; - } - - /** - This method initializes jButtonGenerateGuid - - @return javax.swing.JButton - **/ - private JButton getJButtonGenerateGuid() { - if (jButtonGenerateGuid == null) { - jButtonGenerateGuid = new JButton(); - jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 60, 75, 20)); - jButtonGenerateGuid.setText("GEN"); - jButtonGenerateGuid.addActionListener(this); - } - return jButtonGenerateGuid; - } - - /** - This is the default constructor - **/ - public PackageProtocols(SpdFileContents sfc) { - super(); - initialize(); - init(); - this.setVisible(true); - this.sfc = sfc; - } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setSize(500, 250); - this.setName("JFrame"); - this.setContentPane(getJContentPane()); - this.setTitle("Add Protocols"); - this.centerWindow(); - //this.getRootPane().setDefaultButton(jButtonOk); - initFrame(); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(16, 10, 138, 16)); - jLabel.setText("Name"); - starLabel = new StarLabel(); - starLabel.setBounds(new java.awt.Rectangle(0, 9, 10, 20)); - jLabelEnableFeature = new JLabel(); - jLabelEnableFeature.setText("Enable Feature"); - jLabelEnableFeature.setEnabled(false); - jLabelEnableFeature.setBounds(new java.awt.Rectangle(15, 110, 140, 20)); - jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setText("Feature Flag"); - jLabelFeatureFlag.setEnabled(false); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 135, 140, 20)); - jLabelGuid = new JLabel(); - jLabelGuid.setText("Guid"); - jLabelGuid.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); - jLabelC_Name = new JLabel(); - jLabelC_Name.setText("C_Name"); - jLabelC_Name.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(jLabelC_Name, null); - jContentPane.add(getJTextFieldProtocolName(), null); - jContentPane.add(jLabelGuid, null); - jContentPane.add(getJTextFieldGuid(), null); - jContentPane.add(jLabelFeatureFlag, null); - jContentPane.add(getJTextFieldFeatureFlag(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(jLabelEnableFeature, null); - jContentPane.add(getJRadioButtonEnableFeature(), null); - jContentPane.add(getJRadioButtonDisableFeature(), null); - jContentPane.add(getJButtonGenerateGuid(), null); - - jStarLabel2 = new StarLabel(); - jStarLabel2.setBounds(new java.awt.Rectangle(0, 35, 10, 20)); - - jContentPane.add(jStarLabel2, null); - jContentPane.add(starLabel, null); - jContentPane.add(jLabel, null); - jContentPane.add(getJTextField(), null); - } - return jContentPane; - } - - /** - This method initializes protocol usage type - - **/ - private void initFrame() { - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - - this.save(); - this.dispose(); - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - } - - if (arg0.getSource() == jRadioButtonEnableFeature) { - if (jRadioButtonEnableFeature.isSelected()) { - jRadioButtonDisableFeature.setSelected(false); - } - if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) { - jRadioButtonEnableFeature.setSelected(true); - } - } - - if (arg0.getSource() == jRadioButtonDisableFeature) { - if (jRadioButtonDisableFeature.isSelected()) { - jRadioButtonEnableFeature.setSelected(false); - } - if (!jRadioButtonDisableFeature.isSelected() && !jRadioButtonEnableFeature.isSelected()) { - jRadioButtonDisableFeature.setSelected(true); - } - } - - if (arg0.getSource() == jButtonGenerateGuid) { - jTextFieldGuid.setText(Tools.generateUuidString()); - } - } - - protected void save() { - try { - sfc.genSpdProtocolDeclarations(jTextField.getText(), jTextFieldC_Name.getText(), jTextFieldGuid.getText(), - null); - } catch (Exception e) { - System.out.println(e.toString()); - } - } - - /** - This method initializes jTextField - - @return javax.swing.JTextField - **/ - public JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(160, 8, 319, 23)); - } - return jTextField; - } - - public JTextField getJTextFieldC_Name() { - return jTextFieldC_Name; - } - - public void setJTextFieldC_Name(JTextField textFieldC_Name) { - jTextFieldC_Name = textFieldC_Name; - } - - public void setJTextField(JTextField textField) { - jTextField = textField; - } - - public void setJTextFieldGuid(JTextField textFieldGuid) { - jTextFieldGuid = textFieldGuid; - } -} // @jve:decl-index=0:visual-constraint="10,10" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java deleted file mode 100644 index 7d4654ab00..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PackagingMain.java +++ /dev/null @@ -1,330 +0,0 @@ -/** @file - Java class PackagingMain is top level GUI for PackageEditor. - -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.packaging; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JFrame; -import java.awt.FlowLayout; -import javax.swing.JButton; -import java.awt.GridLayout; -import java.io.File; -import java.io.FileOutputStream; -import java.util.jar.JarOutputStream; - -/** - GUI for show various GUI wizards for create, update spd file; install, remove package; - create distributable package file. - - @since PackageEditor 1.0 -**/ -public class PackagingMain extends JFrame { - - static JFrame frame; - - static String dirForNewSpd = null; - - private JPanel jContentPane = null; - - private JButton jButton = null; - - private JButton jButton1 = null; - - private JButton jButton2 = null; - - private JButton jButton3 = null; - - private JButton jButton4 = null; - - private JButton jButton5 = null; - - private JFrame pThis = null; - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setEnabled(true); - jButton.setText("Exit"); - jButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - pThis.dispose(); - } - }); - } - return jButton; - } - - /** - This method initializes jButton1 - - @return javax.swing.JButton - **/ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setText("Create an Installable Package"); - jButton1.setEnabled(true); - jButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - File theFile = null; - JFileChooser chooser = new JFileChooser(); - // - // select the directory that contains files to be distribute - // - chooser.setMultiSelectionEnabled(false); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - try { - theFile = chooser.getSelectedFile(); - // - // find the FDPManifest.xml file that should exist - // in the root directory of package - // - String[] list = theFile.list(); - boolean manifestExists = false; - for (int i = 0; i < list.length; i++) { - if (list[i].equals("FDPManifest.xml")) { - manifestExists = true; - break; - } - } - if (!manifestExists) { - JOptionPane.showMessageDialog(frame, - "Please Put the FDPManifest.xml File under the Directory You Selected!"); - return; - } - // - // create the distribute package .fdp file in the same directory with - // the package root directory selected above. - // - JarOutputStream jos = new JarOutputStream(new FileOutputStream(theFile.getPath() + ".fdp")); - CreateFdp.create(theFile, jos, theFile.getPath()); - jos.close(); - JOptionPane.showMessageDialog(frame, - "FDP File Created Successfully!"); - - - } catch (Exception ee) { - System.out.println(ee.toString()); - } - } else { - return; - } - } - }); - } - return jButton1; - } - - /** - This method initializes jButton2 - - @return javax.swing.JButton - **/ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setText("Remove Package"); - jButton2.setEnabled(true); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new GuiPkgUninstall(), pThis); - } - }); - } - return jButton2; - } - - /** - This method initializes jButton3 - - @return javax.swing.JButton - **/ - private JButton getJButton3() { - if (jButton3 == null) { - jButton3 = new JButton(); - jButton3.setText("Install Package"); - jButton3.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new GuiPkgInstall(), pThis); - } - }); - } - return jButton3; - } - - /** - This method initializes jButton4 - - @return javax.swing.JButton - **/ - private JButton getJButton4() { - if (jButton4 == null) { - jButton4 = new JButton(); - jButton4.setText("Update Package Description File"); - jButton4.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - File theFile = null; - JFileChooser chooser = new JFileChooser(); - // - // select the spd file to be updated first - // - chooser.setMultiSelectionEnabled(false); - chooser.setFileFilter(new PkgFileFilter("spd")); - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - try { - theFile = chooser.getSelectedFile(); - if (!theFile.isFile()) { - JOptionPane.showMessageDialog(frame, "Please Select one Spd File!"); - return; - } - - } catch (Exception ee) { - System.out.println(ee.toString()); - } - } else { - return; - } - // - // create a SpdFileContents for this file and pass it to GUI - // - SpdFileContents sfc = new SpdFileContents(theFile); - ModalFrameUtil.showAsModal(new UpdateAction(sfc), pThis); - } - }); - } - return jButton4; - } - - /** - This method initializes jButton5 - - @return javax.swing.JButton - **/ - private JButton getJButton5() { - if (jButton5 == null) { - jButton5 = new JButton(); - jButton5.setText("Create Package Description File"); - jButton5.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - JFileChooser chooser = new JFileChooser(System.getenv("WORKSPACE")); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - chooser.setMultiSelectionEnabled(false); - chooser.setDialogTitle("Please specify where to save the new spd file"); - - int retval = chooser.showSaveDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - try { - File theFile = chooser.getSelectedFile(); - PackagingMain.dirForNewSpd = theFile.getPath(); - - } catch (Exception ee) { - System.out.println(ee.toString()); - } -// pThis.dispose(); - } - else { - return; - } - SpdFileContents sfc = new SpdFileContents(); - ModalFrameUtil.showAsModal(new PackageAction(sfc), pThis); - } - }); - } - return jButton5; - } - - /** - Main for all package editor - - @param args - **/ - public static void main(String[] args) { - // TODO Auto-generated method stub - new PackagingMain().setVisible(true); - } - - /** - This is the default constructor - **/ - public PackagingMain() { - super(); - initialize(); - pThis = this; - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(300, 357); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Packaging"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - GridLayout gridLayout = new GridLayout(); - gridLayout.setRows(6); - gridLayout.setColumns(1); - jContentPane = new JPanel(); - jContentPane.setLayout(gridLayout); - jContentPane.add(getJButton5(), null); - jContentPane.add(getJButton4(), null); - jContentPane.add(getJButton3(), null); - jContentPane.add(getJButton2(), null); - jContentPane.add(getJButton1(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - -} // @jve:decl-index=0:visual-constraint="125,31" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PkgInstallTypeChooser.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/PkgInstallTypeChooser.java deleted file mode 100644 index 099c55ae40..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/PkgInstallTypeChooser.java +++ /dev/null @@ -1,373 +0,0 @@ -/** @file - Java class PkgInstallTypeChooser is GUI for upgrade package installation. - -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.packaging; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.io.File; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; - -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JDialog; -import javax.swing.JRadioButton; -import javax.swing.JButton; - -import org.tianocore.PackageListDocument; -import javax.swing.JList; -import javax.swing.JTextField; -import javax.swing.JScrollPane; - -/** - GUI for speicial circumstances of package installation. - - @since PackageEditor 1.0 -**/ -public class PkgInstallTypeChooser extends JFrame implements MouseListener { - - final static long serialVersionUID = 0; - - static JFrame frame; - - private JPanel jContentPane = null; - - private JRadioButton jRadioButton = null; - - private JRadioButton jRadioButton1 = null; - - private JButton jButton = null; - - private JButton jButton1 = null; - - private String pn = null; - - /// - /// list of package info from db file - /// - private List dd = null; - - private String wk = null; - - private JList jList = null; - - private JScrollPane jScrollPane = null; - - private JTextField jTextField = null; - - private JButton jButton2 = null; - - private JFileChooser chooser = null; - - /** - This is the default constructor - **/ - public PkgInstallTypeChooser(String pkgName, String wkSpace, List destDir) { - super(); - pn = pkgName; - dd = destDir; - wk = wkSpace; - initialize(); - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(359, 328); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Chooser Installation Type"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - this.insertList(); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - initialize jList with package info. from db file - **/ - private void insertList() { - - Vector v = new Vector(); - - ListIterator lpi = dd.listIterator(); - while (lpi.hasNext()) { - PackageListDocument.PackageList.Package p = (PackageListDocument.PackageList.Package) lpi.next(); - v.addElement(p.getPackageNameArray(0).getStringValue() + " " + p.getVersionArray(0) + " " - + p.getGuidArray(0).getStringValue()); - } - jList.setListData(v); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJRadioButton(), null); - jContentPane.add(getJRadioButton1(), null); - jContentPane.add(getJButton(), null); - jContentPane.add(getJButton1(), null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJTextField(), null); - jContentPane.add(getJButton2(), null); - } - return jContentPane; - } - - - private JRadioButton getJRadioButton() { - if (jRadioButton == null) { - jRadioButton = new JRadioButton(); - jRadioButton.setBounds(new java.awt.Rectangle(17, 39, 186, 21)); - jRadioButton.setSelected(true); - jRadioButton.setText("Reinstall Existing Package"); - jRadioButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - if (jRadioButton.isSelected()) { - jRadioButton1.setSelected(false); - jButton2.setEnabled(false); - jTextField.setEnabled(false); - jList.setEnabled(true); - return; - } - if (jRadioButton1.isSelected()) { - jRadioButton.setSelected(true); - jRadioButton1.setSelected(false); - jList.setEnabled(true); - return; - } - - } - }); - } - return jRadioButton; - } - - private JRadioButton getJRadioButton1() { - if (jRadioButton1 == null) { - jRadioButton1 = new JRadioButton(); - jRadioButton1.setBounds(new java.awt.Rectangle(17, 155, 176, 21)); - jRadioButton1.setText("Install to Directory"); - jRadioButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - if (jRadioButton1.isSelected()) { - jRadioButton.setSelected(false); - jList.setEnabled(false); - jButton2.setEnabled(true); - jTextField.setEnabled(true); - return; - } - if (jRadioButton.isSelected()) { - jRadioButton1.setSelected(true); - jRadioButton.setSelected(false); - jButton2.setEnabled(true); - jTextField.setEnabled(true); - return; - } - } - }); - } - return jRadioButton1; - } - - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setPreferredSize(new java.awt.Dimension(34, 20)); - jButton.setSize(new java.awt.Dimension(76, 20)); - jButton.setText("Ok"); - jButton.setLocation(new java.awt.Point(141, 241)); - jButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - try { - int i = -1; - // - // user selects replace existing package - // - if (jRadioButton.isSelected()) { - int j = jList.getSelectedIndex(); - if (j == -1) { - JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), - "Please Select One Package to Replace!"); - return; - } - // - // the sequence of jList is the same with List - // - String destDir = dd.get(j).getPathArray(0).getStringValue(); - ForceInstallPkg f = new ForceInstallPkg(pn, wk); - // - // record the package info. to be replaced - // - f.setOldVersion(dd.get(j).getVersionArray(0)); - f.setOldGuid(dd.get(j).getGuidArray(0).getStringValue()); - i = f.install(wk + System.getProperty("file.separator") + destDir); - } else { - // - // user selects install to another directory - // - File f = new File(wk + System.getProperty("file.separator") + FrameworkPkg.dbConfigFile); - if (new DbFileContents(f).checkDir(jTextField.getText().substring(wk.length() + 1)) != 0) { - throw new DirSame(); - } - i = new ForceInstallPkg(pn, wk).install(jTextField.getText()); - } - if (i == 0) { - JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Package " + pn - + " Installed Successfully!"); - } - } catch (DirSame ds) { - System.out.println(ds.toString()); - JOptionPane.showMessageDialog(frame, - "Another Package Exists There, Please Select Another Directory!"); - } catch (Exception ee) { - System.out.println(ee.toString()); - } - } - }); - } - return jButton; - } - - /** - * This method initializes jButton1 - * - * @return javax.swing.JButton - */ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setBounds(new java.awt.Rectangle(238, 241, 78, 20)); - jButton1.setText("Cancel"); - jButton1.setPreferredSize(new java.awt.Dimension(34, 20)); - jButton1.addMouseListener(this); - } - return jButton1; - } - - public void mouseClicked(MouseEvent arg0) { - // TODO Auto-generated method stub - this.dispose(); - } - - 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 - - } - - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(22, 68, 318, 58)); - jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPane.setViewportView(getJList()); - } - return jScrollPane; - } - - private JList getJList() { - if (jList == null) { - jList = new JList(); - - jList.setBounds(new java.awt.Rectangle(22, 68, 318, 58)); - - } - return jList; - } - - /** - * This method initializes jTextField - * - * @return javax.swing.JTextField - */ - private JTextField getJTextField() { - if (jTextField == null) { - jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(22, 184, 224, 20)); - jTextField.setEnabled(false); - jTextField.setText(wk); - } - return jTextField; - } - - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setLocation(new java.awt.Point(259, 183)); - jButton2.setText("Browse"); - jButton2.setEnabled(false); - jButton2.setSize(new java.awt.Dimension(81, 20)); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - if (chooser == null) { - chooser = new JFileChooser(wk); - } - chooser.setMultiSelectionEnabled(false); - chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); - - int retval = chooser.showOpenDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - jTextField.setText(chooser.getSelectedFile().getPath()); - - } - - } - }); - } - return jButton2; - } - -} // @jve:decl-index=0:visual-constraint="134,45" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java deleted file mode 100644 index d8b69e8d2f..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java +++ /dev/null @@ -1,1282 +0,0 @@ -/** @file - Java class SpdFileContents is used to parse spd xml file. - -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.packaging; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.ListIterator; -import java.math.*; -import org.apache.xmlbeans.XmlObject; -import org.apache.xmlbeans.XmlOptions; -import org.apache.xmlbeans.XmlCursor; - -import org.tianocore.AbstractDocument; -import org.tianocore.GuidDeclarationsDocument; -import org.tianocore.GuidDocument; -import org.tianocore.IncludeHeaderDocument; -import org.tianocore.LibraryClassDeclarationDocument; -import org.tianocore.LibraryClassDeclarationsDocument; -import org.tianocore.LibraryClassDocument; -import org.tianocore.LibraryUsage; -import org.tianocore.LicenseDocument; -import org.tianocore.ModuleTypeDef; -import org.tianocore.MsaFilesDocument; -import org.tianocore.OutputDirectoryDocument; -import org.tianocore.PackageDependenciesDocument; -import org.tianocore.PackageHeadersDocument; -import org.tianocore.PackageNameDocument; -import org.tianocore.PackageSurfaceAreaDocument; -import org.tianocore.PackageType; -import org.tianocore.PackageUsage; -import org.tianocore.PcdDataTypes; -import org.tianocore.PcdDefinitionsDocument; -import org.tianocore.PcdItemTypes; -import org.tianocore.PpiDeclarationsDocument; -import org.tianocore.ProtocolDeclarationsDocument; -import org.tianocore.SpdHeaderDocument; -import org.tianocore.SpecificationDocument; -import org.tianocore.GuidDeclarationsDocument.GuidDeclarations; - -/** - This class processes spd file contents such as add remove xml elements. - - @since PackageEditor 1.0 -**/ -public class SpdFileContents { - - private File file = null; - - private PackageSurfaceAreaDocument psad = null; - - private PackageSurfaceAreaDocument.PackageSurfaceArea psaRoot = null; - - private SpdHeaderDocument.SpdHeader spdHdr = null; - - private String spdHdrPkgName = null; - - private GuidDocument.Guid spdHdrGuid = null; - - private LicenseDocument.License spdHdrLicense = null; - - private OutputDirectoryDocument.OutputDirectory spdHdrOutDir = null; - - private LibraryClassDeclarationsDocument.LibraryClassDeclarations spdLibClassDeclarations = null; - - private PackageDependenciesDocument.PackageDependencies spdPkgDeps = null; - - private MsaFilesDocument.MsaFiles spdMsaFiles = null; - - private PackageHeadersDocument.PackageHeaders spdModHdrs = null; - - private GuidDeclarationsDocument.GuidDeclarations spdGuidDeclarations = null; - - private ProtocolDeclarationsDocument.ProtocolDeclarations spdProtocolDeclarations = null; - - private PpiDeclarationsDocument.PpiDeclarations spdPpiDeclarations = null; - - private PcdDefinitionsDocument.PcdDefinitions spdPcdDefinitions = null; - - /** - Constructor to create a new spd file - **/ - public SpdFileContents() { - - psad = PackageSurfaceAreaDocument.Factory.newInstance(); - psaRoot = psad.addNewPackageSurfaceArea(); - - } - - /** - Constructor based on an existing spd file - - @param f Existing spd file - **/ - public SpdFileContents(File f) { - try { - psad = PackageSurfaceAreaDocument.Factory.parse(f); - psaRoot = psad.getPackageSurfaceArea(); - file = f; - } catch (Exception e) { - System.out.println(e.toString()); - } - } - - /** - Remove existing pcd definitions elements using XmlCursor - **/ - public void removeSpdPcdDefinition() { - XmlObject o = psaRoot.getPcdDefinitions(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - spdPcdDefinitions = null; - } - - /** - Remove existing ppi declarations using XmlCursor - **/ - public void removeSpdPpiDeclaration() { - XmlObject o = psaRoot.getPpiDeclarations(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - spdPpiDeclarations = null; - } - - /** - Remove existing protocols declarations using XmlCursor - **/ - public void removeSpdProtocolDeclaration() { - XmlObject o = psaRoot.getProtocolDeclarations(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - spdProtocolDeclarations = null; - } - - /** - Remove existing GUID declarations using XmlCursor - **/ - public void removeSpdGuidDeclaration() { - XmlObject o = psaRoot.getGuidDeclarations(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - spdGuidDeclarations = null; - } - - /** - Remove existing spd package include files using XmlCursor - **/ - public void removeSpdPkgHeader() { - XmlObject o = psaRoot.getPackageHeaders(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - spdModHdrs = null; - } - - /** - Remove existing msa files using XmlCursor - **/ - public void removeSpdMsaFile() { - XmlObject o = psaRoot.getMsaFiles(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - spdMsaFiles = null; - } - - /** - Remove existing library class declarations using XmlCursor - **/ - public void removeSpdLibClass() { - XmlObject o = psaRoot.getLibraryClassDeclarations(); - if (o == null) - return; - XmlCursor cursor = o.newCursor(); - cursor.removeXml(); - spdLibClassDeclarations = null; - } - - /** - Get spd file header contents into String array - - @param s Caller allocated String array - **/ - public void getSpdHdrDetails(String[] s) { - if (getSpdHdr() == null) { - spdHdr = psaRoot.addNewSpdHeader(); - } - s[0] = getSpdHdrPkgName(); - s[1] = getSpdHdrGuid().getStringValue(); - s[2] = getSpdHdrVer(); - s[3] = getSpdHdrAbs(); - s[4] = getSpdHdr().getDescription(); - s[5] = getSpdHdr().getCopyright(); - s[6] = getSpdHdrLicense().getStringValue(); - s[7] = getSpdHdr().getCreated(); - s[8] = getSpdHdr().getURL(); - if (getSpdHdr().getPackageType() != null) { - s[9] = getSpdHdr().getPackageType().toString(); - } - // - // convert boolean to String by adding empty String "" - // - s[10] = getSpdHdr().getReadOnly() + ""; - s[11] = getSpdHdr().getReadOnly() + ""; - } - - /** - Get the number of library class declarations from the size of List - - @return int - **/ - public int getSpdLibClassDeclarationCount() { - if (psaRoot.getLibraryClassDeclarations() == null - || psaRoot.getLibraryClassDeclarations().getLibraryClassDeclarationList() == null) { - return 0; - } - return psaRoot.getLibraryClassDeclarations().getLibraryClassDeclarationList().size(); - } - - /** - Get available library class declaration into String array - @param libClass Caller allocated two-dimentional String array - **/ - public void getSpdLibClassDeclarations(String[][] libClass) { - if (psaRoot.getLibraryClassDeclarations() == null){ - return; - } - List l = psaRoot.getLibraryClassDeclarations() - .getLibraryClassDeclarationList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - LibraryClassDeclarationDocument.LibraryClassDeclaration lcd = (LibraryClassDeclarationDocument.LibraryClassDeclaration) li - .next(); - if (lcd.getLibraryClass() != null) { - libClass[i][0] = lcd.getLibraryClass().getStringValue(); - } - if (lcd.getIncludeHeader() != null) { - libClass[i][1] = lcd.getIncludeHeader().getStringValue(); - } - - i++; - } - - } - - /** - Get the number of Msa files from the size of List - - @return int - **/ - public int getSpdMsaFileCount() { - if (psaRoot.getMsaFiles() == null || psaRoot.getMsaFiles().getMsaFileList() == null) { - return 0; - } - return psaRoot.getMsaFiles().getMsaFileList().size(); - } - - /** - Get available Msa file into String array - - @param msaFile Caller allocated two-dimentional String array - **/ - public void getSpdMsaFiles(String[][] msaFile) { - if (psaRoot.getMsaFiles() == null) { - return; - } - List l = psaRoot.getMsaFiles().getMsaFileList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - MsaFilesDocument.MsaFiles.MsaFile m = (MsaFilesDocument.MsaFiles.MsaFile) li.next(); - if (m.getFilename() != null) { - msaFile[i][0] = m.getFilename().getStringValue(); - } - - i++; - } - } - - /** - Get the number of include header files in PackageHeaders from the size of List - - @return int - **/ - public int getSpdPackageHeaderCount() { - if (psaRoot.getPackageHeaders() == null || psaRoot.getPackageHeaders().getIncludeHeaderList() == null) { - return 0; - } - return psaRoot.getPackageHeaders().getIncludeHeaderList().size(); - } - - /** - Get available package header contents into String array - - @param pkgHeader Caller allocated two-dimentional String array - **/ - public void getSpdPackageHeaders(String[][] pkgHeader) { - if (psaRoot.getPackageHeaders() == null) { - return; - } - - List l = psaRoot.getPackageHeaders().getIncludeHeaderList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - IncludeHeaderDocument.IncludeHeader ih = (IncludeHeaderDocument.IncludeHeader) li.next(); - if (ih.getModuleType() != null) { - pkgHeader[i][0] = ih.getModuleType().toString(); - } - - pkgHeader[i][1] = ih.getStringValue(); - i++; - } - } - - /** - Get the number of GUID declarations from the size of List - - @return int - **/ - public int getSpdGuidDeclarationCount() { - if (psaRoot.getGuidDeclarations() == null || psaRoot.getGuidDeclarations().getEntryList() == null) { - return 0; - } - return psaRoot.getGuidDeclarations().getEntryList().size(); - } - - /** - Get available Guid declaration contents into String array - - @param guid Caller allocated two-dimentional String array - **/ - public void getSpdGuidDeclarations(String[][] guid) { - if (psaRoot.getGuidDeclarations() == null) { - return; - } - - List l = psaRoot.getGuidDeclarations().getEntryList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - GuidDeclarationsDocument.GuidDeclarations.Entry e = (GuidDeclarationsDocument.GuidDeclarations.Entry) li - .next(); - guid[i][0] = e.getName(); - guid[i][1] = e.getCName(); - if (e.getGuid() != null) { - guid[i][2] = e.getGuid().getStringValue(); - } - i++; - } - } - - /** - Get the number of protocol declarations from the size of List - - @return int - **/ - public int getSpdProtocolDeclarationCount() { - if (psaRoot.getProtocolDeclarations() == null || psaRoot.getProtocolDeclarations().getEntryList() == null) { - return 0; - } - return psaRoot.getProtocolDeclarations().getEntryList().size(); - } - - /** - Get available protocol declaration contents into String array - - @param protocol Caller allocated two-dimentional String array - **/ - public void getSpdProtocolDeclarations(String[][] protocol) { - if (psaRoot.getProtocolDeclarations() == null) { - return; - } - - List l = psaRoot.getProtocolDeclarations() - .getEntryList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - ProtocolDeclarationsDocument.ProtocolDeclarations.Entry e = (ProtocolDeclarationsDocument.ProtocolDeclarations.Entry) li - .next(); - protocol[i][0] = e.getName(); - protocol[i][1] = e.getCName(); - if (e.getGuid() != null) { - protocol[i][2] = e.getGuid().getStringValue(); - } - i++; - } - } - - /** - Get the number of Ppi declarations from the size of List - - @return int - **/ - public int getSpdPpiDeclarationCount() { - if (psaRoot.getPpiDeclarations() == null || psaRoot.getPpiDeclarations().getEntryList() == null) { - return 0; - } - return psaRoot.getPpiDeclarations().getEntryList().size(); - } - - /** - Get available Ppi declaration contents into String array - - @param ppi Caller allocated two-dimentional String array - **/ - public void getSpdPpiDeclarations(String[][] ppi) { - if (psaRoot.getPpiDeclarations() == null) { - return; - } - - List l = psaRoot.getPpiDeclarations().getEntryList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - PpiDeclarationsDocument.PpiDeclarations.Entry e = (PpiDeclarationsDocument.PpiDeclarations.Entry) li.next(); - ppi[i][0] = e.getName(); - ppi[i][1] = e.getCName(); - if (e.getGuid() != null) { - ppi[i][2] = e.getGuid().getStringValue(); - } - - i++; - } - } - - /** - Get the number of Pcd definitions from the size of List - - @return int - **/ - public int getSpdPcdDefinitionCount() { - if (psaRoot.getPcdDefinitions() == null || psaRoot.getPcdDefinitions().getPcdEntryList() == null) { - return 0; - } - return psaRoot.getPcdDefinitions().getPcdEntryList().size(); - } - - /** - Get available Pcd definition contents into String array - - @param pcd Caller allocated two-dimentional String array - **/ - public void getSpdPcdDefinitions(String[][] pcd) { - if (psaRoot.getPcdDefinitions() == null) { - return; - } - - List l = psaRoot.getPcdDefinitions().getPcdEntryList(); - int i = 0; - ListIterator li = l.listIterator(); - while (li.hasNext()) { - PcdDefinitionsDocument.PcdDefinitions.PcdEntry e = (PcdDefinitionsDocument.PcdDefinitions.PcdEntry) li - .next(); - if (e.getItemType() != null) { - pcd[i][0] = e.getItemType().toString(); - } - - pcd[i][1] = e.getCName(); - pcd[i][2] = e.getToken(); - if (e.getDatumType() != null) { - pcd[i][3] = e.getDatumType().toString(); - } - - if (e.getDefaultValue() != null) { - pcd[i][4] = e.getDefaultValue().toString(); - } - - i++; - } - } - - /** - Save the processed xml contents to file - - @param spdFile The file to save xml contents - @throws IOException Exceptions during file operation - **/ - public void saveAs(File spdFile) throws IOException { - - XmlOptions options = new XmlOptions(); - - options.setCharacterEncoding("UTF-8"); - options.setSavePrettyPrint(); - options.setSavePrettyPrintIndent(2); - try { - psad.save(spdFile, options); - } catch (IOException e) { - e.printStackTrace(); - } - - } - - /** - Generate SpdHeader contents using parameters passed in. - - @param pkgName PackageName - @param pkgGuid Guid - @param pkgVer Version - @param pkgAbs Abstract - @param pkgDes Description - @param pkgCpRight Copyright - @param pkgLicense License - @param pkgCreateDate Created - @param pkgUpdateDate Updated - @param pkgURL URL - @param pkgType PackageType - @param pkgRdOnly ReadOnly - @param pkgRePkg RePackage - @param pkgSpec Reserved - @param pkgOutDir Reserved - **/ - public void genSpdHeader(String pkgName, String pkgGuid, String pkgVer, String pkgAbs, String pkgDes, - String pkgCpRight, String pkgLicense, String pkgCreateDate, String pkgUpdateDate, - String pkgURL, String pkgType, String pkgRdOnly, String pkgRePkg, String pkgSpec, - String pkgOutDir) { - if (getSpdHdr() == null) { - spdHdr = psaRoot.addNewSpdHeader(); - } - - setSpdHdrPkgName(pkgName); - setSpdHdrGuid(pkgGuid); - setSpdHdrVer(pkgVer); - setSpdHdrAbs(pkgAbs); - setSpdHdrDes(pkgDes); - setSpdHdrCpRit(pkgCpRight); - setSpdHdrLicense(pkgLicense); - setSpdHdrCreateDate(pkgCreateDate); - setSpdHdrUpdateDate(pkgUpdateDate); - setSpdHdrURL(pkgURL); - setSpdHdrPkgType(pkgType); - setSpdHdrRdOnly(pkgRdOnly); - setSpdHdrRePkg(pkgRePkg); - setSpdHdrSpec(pkgSpec); - setSpdHdrOutDir(pkgOutDir); - } - - /** - Generate library class declaration element using parameters passed in - - @param libClassBaseName LibraryClass element value - @param libClassUsage Reserved - @param incHdrFileName IncludeHeader element value - @param incHdrAttribGuid Reserved - @param incHdrAttribArch Reserved - @param incHdrAttribPath Reserved - @param incHdrAttribClass Reserved - @param incHdrAttribVer Reserved - @param incHdrAttribOverrideID Reserved - @param incHdrAttribModuleType Reserved - **/ - public void genSpdLibClassDeclarations(String libClassBaseName, String libClassUsage, String incHdrFileName, - String incHdrAttribGuid, String incHdrAttribArch, String incHdrAttribPath, - String incHdrAttribClass, String incHdrAttribVer, - String incHdrAttribOverrideID, String incHdrAttribModuleType) { - if (getSpdLibClassDeclarations() == null) { - spdLibClassDeclarations = psaRoot.addNewLibraryClassDeclarations(); - } - // - // add contents under LibraryClassDeclarations tag - // - setSpdLibClassDeclaration(libClassBaseName, libClassUsage, incHdrFileName, incHdrAttribGuid, incHdrAttribArch, - incHdrAttribPath, incHdrAttribClass, incHdrAttribVer, incHdrAttribOverrideID, - incHdrAttribModuleType, spdLibClassDeclarations); - } - - /** - Set library class declaration contents under parent tag - - @param clsName LibraryClass element value - @param clsUsage Reserved - @param hdrFile IncludeHeader element value - @param hdrAttribGuid Reserved - @param hdrAttribArch Reserved - @param hdrAttribPath Reserved - @param hdrAttribClass Reserved - @param hdrAttribVer Reserved - @param hdrAttribOverID Reserved - @param hdrAttribModType Reserved - @param parent The tag under which library class declaration goes to - **/ - public void setSpdLibClassDeclaration(String clsName, String clsUsage, String hdrFile, String hdrAttribGuid, - String hdrAttribArch, String hdrAttribPath, String hdrAttribClass, - String hdrAttribVer, String hdrAttribOverID, String hdrAttribModType, - XmlObject parent) { - - LibraryClassDeclarationDocument.LibraryClassDeclaration lcd = ((LibraryClassDeclarationsDocument.LibraryClassDeclarations) parent) - .addNewLibraryClassDeclaration(); - - setSpdLibraryClass(clsName, clsUsage, lcd); - - setSpdIncludeHeader(null, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass, hdrAttribVer, - hdrAttribOverID, lcd); - } - - /** - Set the contents of LibraryClass under parent element - - @param clsName LibraryClass element value - @param clsUsage Reserved - @param parent The tag under which library class declaration goes to - **/ - public void setSpdLibraryClass(String clsName, String clsUsage, XmlObject parent) { - LibraryClassDeclarationDocument.LibraryClassDeclaration.LibraryClass lc = ((LibraryClassDeclarationDocument.LibraryClassDeclaration) parent).addNewLibraryClass(); - lc.setStringValue(clsName); - } - - /** - Set contents of IncludeHeader under parent element - - @param modType Reserved - @param hdrFile IncludeHeader element value - @param hdrAttribGuid Reserved - @param hdrAttribArch Reserved - @param hdrAttribPath Reserved - @param hdrAttribClass Reserved - @param hdrAttribVer Reserved - @param hdrAttribOverID Reserved - @param parent The tag under which library class declaration goes to - **/ - public void setSpdIncludeHeader(String modType, String hdrFile, String hdrAttribGuid, String hdrAttribArch, - String hdrAttribPath, String hdrAttribClass, String hdrAttribVer, - String hdrAttribOverID, XmlObject parent) { - IncludeHeaderDocument.IncludeHeader ih = null; - if (parent instanceof LibraryClassDeclarationDocument.LibraryClassDeclaration) { - ih = ((LibraryClassDeclarationDocument.LibraryClassDeclaration) parent).addNewIncludeHeader(); - } else if (parent instanceof PackageHeadersDocument.PackageHeaders) { - ih = ((PackageHeadersDocument.PackageHeaders) parent).addNewIncludeHeader(); - } else { - return; - } - - ih.setStringValue(hdrFile); - if (hdrAttribGuid != null) { - ih.setGuid(hdrAttribGuid); - } - if (hdrAttribPath != null) { - ih.setPath(hdrAttribPath); - } - if (hdrAttribClass != null) { - ih.setClass1(hdrAttribClass); - } - if (hdrAttribVer != null) { - ih.setVersion(hdrAttribVer); - } - if (hdrAttribOverID != null) { - ih.setOverrideID(Integer.parseInt(hdrAttribOverID)); - } - if (modType != null) { - ih.setModuleType(ModuleTypeDef.Enum.forString(modType)); - - } - - } - - /** - Reserved method - - @param pkgDepPkgName - @param pkgDepPkgAttribGuid - @param pkgDepPkgAttribVer - @param pkgDepPkgAttribType - @param pkgDepPkgAttribUsage - @param pkgDepPkgAttribInstallDate - @param pkgDepPkgAttribUpdateDate - @param pkgDepPkgAttribPath - **/ - public void genSpdPackageDependencies(String pkgDepPkgName, String pkgDepPkgAttribGuid, String pkgDepPkgAttribVer, - String pkgDepPkgAttribType, String pkgDepPkgAttribUsage, - String pkgDepPkgAttribInstallDate, String pkgDepPkgAttribUpdateDate, - String pkgDepPkgAttribPath) { - if (spdPkgDeps == null) { - spdPkgDeps = psaRoot.addNewPackageDependencies(); - } - - setSpdPackageName(pkgDepPkgName, pkgDepPkgAttribGuid, pkgDepPkgAttribVer, pkgDepPkgAttribType, - pkgDepPkgAttribUsage, pkgDepPkgAttribInstallDate, pkgDepPkgAttribUpdateDate, - pkgDepPkgAttribPath, spdPkgDeps); - } - - /** - Reserved method - - @param pkgName - @param pkgAttribGuid - @param pkgAttribVer - @param pkgAttribType - @param pkgAttribUsage - @param pkgAttribInstallDate - @param pkgAttribUpdateDate - @param pkgAttribPath - @param parent - **/ - public void setSpdPackageName(String pkgName, String pkgAttribGuid, String pkgAttribVer, String pkgAttribType, - String pkgAttribUsage, String pkgAttribInstallDate, String pkgAttribUpdateDate, - String pkgAttribPath, XmlObject parent) { - - PackageNameDocument.PackageName pn = ((PackageDependenciesDocument.PackageDependencies) parent) - .addNewPackageName(); - pn.setStringValue(pkgName); - pn.setPackageType(PackageType.Enum.forString(pkgAttribType)); - pn.setUsage(PackageUsage.Enum.forString(pkgAttribUsage)); - pn.setUpdatedDate(pkgAttribUpdateDate); - } - - /** - Generate MsaFile element. - - @param msaFileName MsaFile element value - @param archType Reserved - **/ - public void genSpdMsaFiles(String msaFileName, String archType) { - if (getSpdMsaFiles() == null) { - spdMsaFiles = psaRoot.addNewMsaFiles(); - } - setSpdMsaFile(msaFileName, spdMsaFiles); - - } - - /** - Set MsaFile contents under parent element. - - @param msaFileName MsaFile element value - @param parent Element under which MsaFile goes to - **/ - public void setSpdMsaFile(String msaFileName, XmlObject parent) { - - ((MsaFilesDocument.MsaFiles) parent).addNewMsaFile().addNewFilename().setStringValue(msaFileName); - } - - /** - Generate PackageHeader element using parameters passed in. - - @param ModHdrModType ModuleType attribute of IncludeHeader element - @param hdrFile IncludeHeader element value - @param hdrAttribGuid Reserved - @param hdrAttribArch Reserved - @param hdrAttribPath Reserved - @param hdrAttribClass Reserved - @param hdrAttribVer Reserved - @param hdrAttribOverID Reserved - **/ - public void genSpdModuleHeaders(String ModHdrModType, String hdrFile, String hdrAttribGuid, String hdrAttribArch, - String hdrAttribPath, String hdrAttribClass, String hdrAttribVer, - String hdrAttribOverID) { - if (getSpdModHdrs() == null) { - spdModHdrs = psaRoot.addNewPackageHeaders(); - } - - // - // add IncludeHeader under PackageHeaders element - // - setSpdIncludeHeader(ModHdrModType, hdrFile, hdrAttribGuid, hdrAttribArch, hdrAttribPath, hdrAttribClass, - hdrAttribVer, hdrAttribOverID, spdModHdrs); - } - - /** - Generate GUID declaration element using parameters passed in. - - @param guidDeclEntryName Name attribute of Entry element - @param guidDeclCName CName element value - @param guidDeclGuid Guid element value - @param guidDeclFeatureFlag Reserved - **/ - public void genSpdGuidDeclarations(String guidDeclEntryName, String guidDeclCName, String guidDeclGuid, - String guidDeclFeatureFlag) { - if (getSpdGuidDeclarations() == null) { - spdGuidDeclarations = psaRoot.addNewGuidDeclarations(); - } - - setSpdEntry(guidDeclEntryName, guidDeclCName, guidDeclGuid, guidDeclFeatureFlag, spdGuidDeclarations); - } - - /** - Generate protocol declaration element using parameters passed in. - - @param protocolDeclEntryName Name attribute of Entry element - @param protocolDeclCName CName element value - @param protocolDeclGuid Guid element value - @param protocolDeclFeatureFlag Reserved - **/ - public void genSpdProtocolDeclarations(String protocolDeclEntryName, String protocolDeclCName, - String protocolDeclGuid, String protocolDeclFeatureFlag) { - if (getSpdProtocolDeclarations() == null) { - spdProtocolDeclarations = psaRoot.addNewProtocolDeclarations(); - } - - setSpdEntry(protocolDeclEntryName, protocolDeclCName, protocolDeclGuid, protocolDeclFeatureFlag, - spdProtocolDeclarations); - } - - /** - Generate PPI declaration element using parameters passed in. - - @param ppiDeclEntryName Name attribute of Entry element - @param ppiDeclCName CName element value - @param ppiDeclGuid Guid element value - @param ppiDeclFeatureFlag Reserved - **/ - public void genSpdPpiDeclarations(String ppiDeclEntryName, String ppiDeclCName, String ppiDeclGuid, - String ppiDeclFeatureFlag) { - if (getSpdPpiDeclarations() == null) { - spdPpiDeclarations = psaRoot.addNewPpiDeclarations(); - } - - setSpdEntry(ppiDeclEntryName, ppiDeclCName, ppiDeclGuid, ppiDeclFeatureFlag, spdPpiDeclarations); - } - - /** - Set Entry contents using parameters passed in - - @param entryName Name attribute of Entry element - @param cName CName element value - @param guid Guid element value - @param featureFlag Reserved - @param parent The tag under which Entry element goes to - **/ - public void setSpdEntry(String entryName, String cName, String guid, String featureFlag, XmlObject parent) { - - if (parent instanceof GuidDeclarationsDocument.GuidDeclarations) { - GuidDeclarationsDocument.GuidDeclarations.Entry e = ((GuidDeclarations) parent).addNewEntry(); - e.setName(entryName); - e.setCName(cName); - e.addNewGuid().setStringValue(guid); - - return; - } - if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) { - ProtocolDeclarationsDocument.ProtocolDeclarations.Entry pe = ((ProtocolDeclarationsDocument.ProtocolDeclarations) parent) - .addNewEntry(); - pe.setName(entryName); - pe.setCName(cName); - pe.addNewGuid().setStringValue(guid); - - } - if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) { - PpiDeclarationsDocument.PpiDeclarations.Entry ppe = ((PpiDeclarationsDocument.PpiDeclarations) parent) - .addNewEntry(); - ppe.setName(entryName); - ppe.setCName(cName); - ppe.addNewGuid().setStringValue(guid); - - return; - } - - return; - - } - - /** - Generate Pcd definition using parameters passed in - - @param pcdItemTypes ItemType attribute of PcdEntry element - @param cName C_Name element value - @param token Token element value - @param dataType DatumType element value - @param skuEnable Reserved - @param sku Reserved - @param maxSku Reserved - @param hiiEnable Reserved - @param varGuid Reserved - @param varName Reserved - @param defaultString DefaultString element value - **/ - public void genSpdPcdDefinitions(String pcdItemTypes, String cName, String token, String dataType, - String skuEnable, String sku, String maxSku, String hiiEnable, String varGuid, - String varName, String defaultString) { - if (getSpdPcdDefinitions() == null) { - spdPcdDefinitions = psaRoot.addNewPcdDefinitions(); - } - - setSpdPcdEntry(pcdItemTypes, cName, token, dataType, skuEnable, sku, maxSku, hiiEnable, varGuid, varName, - defaultString, spdPcdDefinitions); - } - - /** - Set Pcd entry contents under parent tag - - @param pcdItemTypes ItemType attribute of PcdEntry element - @param cName C_Name element value - @param token Token element value - @param dataType DatumType element value - @param skuEnable Reserved - @param sku Reserved - @param maxSku Reserved - @param hiiEnable Reserved - @param varGuid Reserved - @param varName Reserved - @param defaultString DefaultString element value - @param parent Tag under which PcdEntry goes to - **/ - public void setSpdPcdEntry(String pcdItemTypes, String cName, String token, String dataType, String skuEnable, - String sku, String maxSku, String hiiEnable, String varGuid, String varName, - String defaultString, XmlObject parent) { - - PcdDefinitionsDocument.PcdDefinitions.PcdEntry pe = ((PcdDefinitionsDocument.PcdDefinitions) parent) - .addNewPcdEntry(); - pe.setItemType(PcdItemTypes.Enum.forString(pcdItemTypes)); - pe.setCName(cName); - pe.setToken(token); - pe.setDatumType(PcdDataTypes.Enum.forString(dataType)); - pe.setDefaultValue(defaultString); - - } - - /** - Get PpiDeclarations element - - @return PpiDeclarationsDocument.PpiDeclarations - **/ - public PpiDeclarationsDocument.PpiDeclarations getSpdPpiDeclarations() { - if (spdPpiDeclarations == null) { - spdPpiDeclarations = psaRoot.getPpiDeclarations(); - } - return spdPpiDeclarations; - } - - /** - Get ProtocolDeclarations element - - @return ProtocolDeclarationsDocument.ProtocolDeclarations - **/ - public ProtocolDeclarationsDocument.ProtocolDeclarations getSpdProtocolDeclarations() { - if (spdProtocolDeclarations == null) { - spdProtocolDeclarations = psaRoot.getProtocolDeclarations(); - } - return spdProtocolDeclarations; - } - - /** - Get GuidDeclarations element - - @return GuidDeclarationsDocument.GuidDeclarations - **/ - public GuidDeclarationsDocument.GuidDeclarations getSpdGuidDeclarations() { - if (spdGuidDeclarations == null) { - spdGuidDeclarations = psaRoot.getGuidDeclarations(); - } - return spdGuidDeclarations; - } - - /** - Get PcdDefinitions element - - @return PcdDefinitionsDocument.PcdDefinitions - **/ - public PcdDefinitionsDocument.PcdDefinitions getSpdPcdDefinitions() { - if (spdPcdDefinitions == null) { - spdPcdDefinitions = psaRoot.getPcdDefinitions(); - } - return spdPcdDefinitions; - } - - /** - Get PackageHeaders element - - @return PackageHeadersDocument.PackageHeaders - **/ - public PackageHeadersDocument.PackageHeaders getSpdModHdrs() { - if (spdModHdrs == null) { - spdModHdrs = psaRoot.getPackageHeaders(); - } - return spdModHdrs; - } - - /** - Get MsaFiles element - - @return MsaFilesDocument.MsaFiles - **/ - public MsaFilesDocument.MsaFiles getSpdMsaFiles() { - if (spdMsaFiles == null) { - spdMsaFiles = psaRoot.getMsaFiles(); - } - return spdMsaFiles; - } - - /** - Get LibraryClassDeclarations element - - @return LibraryClassDeclarationsDocument.LibraryClassDeclarations - **/ - public LibraryClassDeclarationsDocument.LibraryClassDeclarations getSpdLibClassDeclarations() { - if (spdLibClassDeclarations == null) { - spdLibClassDeclarations = psaRoot.getLibraryClassDeclarations(); - } - return spdLibClassDeclarations; - } - - /** - Get SpdHeader element - - @return SpdHeaderDocument.SpdHeader - **/ - public SpdHeaderDocument.SpdHeader getSpdHdr() { - if (spdHdr == null) { - spdHdr = psaRoot.getSpdHeader(); - } - return spdHdr; - } - - /** - Get Abstract element under tag SpdHeader - - @return AbstractDocument.Abstract - **/ - public String getSpdHdrAbs() { - - return getSpdHdr().getAbstract(); - } - - /** - Set value to Abstract element - - @param abs The value set to Abstract element - **/ - public void setSpdHdrAbs(String abs) { - getSpdHdr().setAbstract(abs); - } - - /** - Set value to Copyright element - - @param cpRit The value set to Copyright element - **/ - public void setSpdHdrCpRit(String cpRit) { - - getSpdHdr().setCopyright(cpRit); - - } - - /** - Set value to Created element - - @param createDate The value set to Created element - **/ - public void setSpdHdrCreateDate(String createDate) { - - getSpdHdr().setCreated(createDate); - - } - - /** - Set value to Description element - - @param des The value set to Description element - **/ - public void setSpdHdrDes(String des) { - getSpdHdr().setDescription(des); - } - - /** - Get Guid element under SpdHdr - - @return GuidDocument.Guid - **/ - public GuidDocument.Guid getSpdHdrGuid() { - if (spdHdrGuid == null) { - spdHdrGuid = getSpdHdr().getGuid(); - } - return spdHdrGuid; - } - - /** - Set value to Guid element - - @param guid The value set to Guid element - **/ - public void setSpdHdrGuid(String guid) { - if (getSpdHdrGuid() != null) { - getSpdHdrGuid().setStringValue(guid); - } else { - spdHdrGuid = getSpdHdr().addNewGuid(); - spdHdrGuid.setStringValue(guid); - } - } - - /** - Get Version element under SpdHdr - - @return String - **/ - public String getSpdHdrVer() { - if (spdHdr != null) - return spdHdr.getVersion() + ""; - else - return null; - } - - /** - Set value to Version element - - @param ver The value set to Version element - **/ - public void setSpdHdrVer(String ver) { - if (spdHdr != null) { - spdHdr.setVersion(ver); - } - - } - - /** - Get License element under SpdHdr - - @return LicenseDocument.License - **/ - public LicenseDocument.License getSpdHdrLicense() { - if (spdHdrLicense == null) { - spdHdrLicense = getSpdHdr().getLicense(); - } - return spdHdrLicense; - } - - /** - Set value to License element - - @param license The value set to License element - **/ - public void setSpdHdrLicense(String license) { - if (getSpdHdrLicense() != null) { - getSpdHdrLicense().setStringValue(license); - } else { - spdHdrLicense = getSpdHdr().addNewLicense(); - spdHdrLicense.setStringValue(license); - } - } - - /** - Reserved method - - @return - **/ - public OutputDirectoryDocument.OutputDirectory getSpdHdrOutDir() { - return spdHdrOutDir; - } - - /** - Reserved method - - @param outdir - **/ - public void setSpdHdrOutDir(String outdir) { - if (outdir == null) { - return; - } - if (getSpdHdrOutDir() != null) { - getSpdHdrOutDir().setStringValue(outdir); - } else { - spdHdrOutDir = getSpdHdr().addNewOutputDirectory(); - spdHdrOutDir.setStringValue(outdir); - } - } - - /** - Get PackageName element under SpdHdr - - @return PackageNameDocument.PackageName - **/ - public String getSpdHdrPkgName() { - if (spdHdrPkgName == null) { - spdHdrPkgName = getSpdHdr().getPackageName(); - } - return spdHdrPkgName; - } - - /** - Set value to PackageName element - - @param pkgName The value set to PackageName element - **/ - public void setSpdHdrPkgName(String pkgName) { - - if (getSpdHdrPkgName() != null) { - getSpdHdr().setPackageName(pkgName); - } else { - getSpdHdr().setPackageName(pkgName); - } - } - - - /** - Reserved method - - @param spec - **/ - public void setSpdHdrSpec(String spec) { - if (spec == null) { - return; - } - - getSpdHdr().setSpecification(spec); - - } - - /** - Set value to PackageType element - - @param pkgType The value set to PackageType element - **/ - public void setSpdHdrPkgType(String pkgType) { - getSpdHdr().setPackageType(PackageType.Enum.forString(pkgType)); - } - - /** - Set value to ReadOnly element - - @param rdOnly The value set to ReadOnly element - **/ - public void setSpdHdrRdOnly(String rdOnly) { - - getSpdHdr().setReadOnly(new Boolean(rdOnly)); - } - - /** - Set value to RePackage element - - @param rePkg The value set to RePackage element - **/ - public void setSpdHdrRePkg(String rePkg) { - - getSpdHdr().setRePackage(new Boolean(rePkg)); - } - - /** - Set value to Updated element - - @param updateDate The value set to Updated element - **/ - public void setSpdHdrUpdateDate(String updateDate) { - getSpdHdr().setUpdated(updateDate); - } - - /** - Set value to URL element - - @param url The value set to URL element - **/ - public void setSpdHdrURL(String url) { - getSpdHdr().setURL(url); - } - - /** - Get xml file - - @return File - **/ - public File getFile() { - return file; - } - - /** - Set file - - @param file File with xml format - **/ - public void setFile(File file) { - this.file = file; - } - -} diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateAction.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateAction.java deleted file mode 100644 index a7ff0160e4..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateAction.java +++ /dev/null @@ -1,328 +0,0 @@ -/** @file - Java class UpdateAction is GUI for update spd file. - -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.packaging; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; - -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JFrame; -import java.awt.GridLayout; -import java.io.File; - -import javax.swing.JButton; - -/** -GUI for update spd file - -@since PackageEditor 1.0 -**/ -public class UpdateAction extends JFrame { - - static JFrame frame; - - private JPanel jContentPane = null; - - private JButton jButton = null; - - private JButton jButton1 = null; - - private JButton jButton2 = null; - - private JButton jButton3 = null; - - private JButton jButton4 = null; - - private JButton jButton5 = null; - - private JButton jButton6 = null; - - private JButton jButton7 = null; - - private SpdFileContents sfc = null; - - private JFrame pThis = null; // @jve:decl-index=0:visual-constraint="322,10" - - private JButton jButton8 = null; - - private JButton jButton9 = null; - - /** - This is the default constructor - **/ - public UpdateAction(SpdFileContents sfc) { - super(); - initialize(); - this.sfc = sfc; - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(300, 333); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setContentPane(getJContentPane()); - this.setTitle("Please Choose an Action"); - this.centerWindow(); - this.pThis = this; - pThis.setSize(new java.awt.Dimension(316,399)); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - GridLayout gridLayout = new GridLayout(); - gridLayout.setRows(10); - gridLayout.setColumns(1); - jContentPane = new JPanel(); - jContentPane.setLayout(gridLayout); - jContentPane.add(getJButton8(), null); - jContentPane.add(getJButton7(), null); - jContentPane.add(getJButton6(), null); - jContentPane.add(getJButton5(), null); - jContentPane.add(getJButton4(), null); - jContentPane.add(getJButton3(), null); - jContentPane.add(getJButton2(), null); - jContentPane.add(getJButton1(), null); - jContentPane.add(getJButton(), null); - jContentPane.add(getJButton9(), null); - } - return jContentPane; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setText("Save"); - jButton.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - JFileChooser chooser = new JFileChooser(sfc.getFile()); - chooser.setMultiSelectionEnabled(false); - - int retval = chooser.showSaveDialog(frame); - if (retval == JFileChooser.APPROVE_OPTION) { - try { - File theFile = chooser.getSelectedFile(); - if (theFile.exists()) { - int retVal = JOptionPane.showConfirmDialog(frame, "Are you sure to replace the exising one?", "File Exists", - JOptionPane.YES_NO_OPTION); - if (retVal == JOptionPane.NO_OPTION) { - return; - } - } - sfc.saveAs(theFile); - - } catch (Exception ee) { - System.out.println(ee.toString()); - } -// pThis.dispose(); - } - - } - }); - } - return jButton; - } - - /** - This method initializes jButton1 - - @return javax.swing.JButton - **/ - private JButton getJButton1() { - if (jButton1 == null) { - jButton1 = new JButton(); - jButton1.setText("Update PCD Information"); - jButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdatePCD(sfc), pThis); - } - }); - } - return jButton1; - } - - /** - This method initializes jButton2 - - @return javax.swing.JButton - **/ - private JButton getJButton2() { - if (jButton2 == null) { - jButton2 = new JButton(); - jButton2.setText("Update PPI Declarations"); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdatePpi(sfc), pThis); - } - }); - } - return jButton2; - } - - /** - This method initializes jButton3 - - @return javax.swing.JButton - **/ - private JButton getJButton3() { - if (jButton3 == null) { - jButton3 = new JButton(); - jButton3.setText("Update Protocol Declarations"); - jButton3.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdateProtocols(sfc), pThis); - } - }); - } - return jButton3; - } - - /** - This method initializes jButton4 - - @return javax.swing.JButton - **/ - private JButton getJButton4() { - if (jButton4 == null) { - jButton4 = new JButton(); - jButton4.setText("Update GUID Declarations"); - jButton4.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdateGuids(sfc), pThis); - } - }); - } - return jButton4; - } - - /** - This method initializes jButton5 - - @return javax.swing.JButton - **/ - private JButton getJButton5() { - if (jButton5 == null) { - jButton5 = new JButton(); - jButton5.setText("Update Package Headers"); - jButton5.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdatePkgHeader(sfc), pThis); - } - }); - } - return jButton5; - } - - /** - This method initializes jButton6 - - @return javax.swing.JButton - **/ - private JButton getJButton6() { - if (jButton6 == null) { - jButton6 = new JButton(); - jButton6.setText("Update MSA Files"); - jButton6.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdateMsaFile(sfc), pThis); - } - }); - } - return jButton6; - } - - /** - This method initializes jButton7 - - @return javax.swing.JButton - **/ - private JButton getJButton7() { - if (jButton7 == null) { - jButton7 = new JButton(); - jButton7.setText("Update Library Classes"); - jButton7.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdateLibraryClass(sfc), pThis); - } - }); - } - return jButton7; - } - - /** - This method initializes jButton8 - - @return javax.swing.JButton - **/ - private JButton getJButton8() { - if (jButton8 == null) { - jButton8 = new JButton(); - jButton8.setText("Update SPD Header"); - jButton8.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - ModalFrameUtil.showAsModal(new UpdateNew(sfc), pThis); - } - }); - } - return jButton8; - } - - private JButton getJButton9() { - if (jButton9 == null) { - jButton9 = new JButton(); - jButton9.setText("Done"); - jButton9.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent e) { - - pThis.dispose(); - - } - }); - } - return jButton9; - } - -} // @jve:decl-index=0:visual-constraint="104,41" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java deleted file mode 100644 index 6193073473..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java +++ /dev/null @@ -1,249 +0,0 @@ -/** @file - Java class UpdateGuids is GUI for update GUID declarations in spd file. - -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.packaging; - -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; - -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.*; - -import org.tianocore.common.Tools; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; - -/** - GUI for update GUID declarations in spd file - - @since PackageEditor 1.0 -**/ -public class UpdateGuids extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private SpdFileContents sfc = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private DefaultTableModel model = null; - - private JButton jButton = null; - - /** - This is the default constructor - **/ - public UpdateGuids(SpdFileContents sfc) { - super(); - this.sfc = sfc; - initialize(); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - if (arg0.getSource() == jButton) { - String[] o = { "", "", "" }; - model.addRow(o); - } - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(669, 568); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Update GUID Declarations"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(38,45,586,315)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable() { - if (jTable == null) { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("Name"); - model.addColumn("C_Name"); - model.addColumn("GUID"); - if (sfc.getSpdGuidDeclarationCount() == 0) { - return jTable; - } - // - // initialize table using SpdFileContents object - // - String[][] saa = new String[sfc.getSpdGuidDeclarationCount()][3]; - sfc.getSpdGuidDeclarations(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - - jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor()); - } - return jTable; - } - - /** - Remove original GUID declarations before saving updated ones - **/ - protected void save() { - if (jTable.isEditing()) { - jTable.getCellEditor().stopCellEditing(); - } - sfc.removeSpdGuidDeclaration(); - int rowCount = model.getRowCount(); - int i = 0; - - while (i < rowCount) { - String name = null; - if (model.getValueAt(i, 0) != null) { - name = model.getValueAt(i, 0).toString(); - } - String cName = null; - if (model.getValueAt(i, 1) != null) { - cName = model.getValueAt(i, 1).toString(); - } - String guid = null; - if (model.getValueAt(i, 2) != null) { - guid = model.getValueAt(i, 2).toString(); - } - sfc.genSpdGuidDeclarations(name, cName, guid, null); - i++; - } - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setSize(new java.awt.Dimension(84, 20)); - jButtonOk.setLocation(new java.awt.Point(316, 486)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(82, 20)); - jButtonCancel.setLocation(new java.awt.Point(411, 486)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(219, 487, 78, 18)); - jButton.setText("Insert"); - jButton.addActionListener(this); - } - return jButton; - } - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } -} // @jve:decl-index=0:visual-constraint="11,7" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java deleted file mode 100644 index 4bd6a13630..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java +++ /dev/null @@ -1,243 +0,0 @@ -/** @file - Java class UpdateLibraryClass is GUI for update library class in spd file. - -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.packaging; - -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; - -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.*; - -import org.tianocore.common.Tools; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; - -/** - GUI for update library class in spd file - - @since PackageEditor 1.0 -**/ -public class UpdateLibraryClass extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private SpdFileContents sfc = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private DefaultTableModel model = null; - - private JButton jButton = null; - - /** - This is the default constructor - **/ - public UpdateLibraryClass(SpdFileContents sfc) { - super(); - this.sfc = sfc; - initialize(); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - - if (arg0.getSource() == jButton) { - String[] o = { "", "" }; - model.addRow(o); - } - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(604, 553); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Update Library Class Declarations"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable() { - if (jTable == null) { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("LibraryClass"); - model.addColumn("IncludeHeader"); - if (sfc.getSpdLibClassDeclarationCount() == 0) { - return jTable; - } - // - // initialize table using SpdFileContents object - // - String[][] saa = new String[sfc.getSpdLibClassDeclarationCount()][2]; - sfc.getSpdLibClassDeclarations(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - - } - return jTable; - } - - /** - Remove original library classes before saving updated ones - **/ - protected void save() { - if (jTable.isEditing()) { - jTable.getCellEditor().stopCellEditing(); - } - sfc.removeSpdLibClass(); - int rowCount = model.getRowCount(); - int i = 0; - while (i < rowCount) { - String libClass = null; - if (model.getValueAt(i, 0) != null) { - libClass = model.getValueAt(i, 0).toString(); - } - String headerFile = null; - if (model.getValueAt(i, 1) != null) { - headerFile = model.getValueAt(i, 1).toString(); - } - sfc.genSpdLibClassDeclarations(libClass, null, headerFile, null, null, null, null, null, null, null); - i++; - } - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setSize(new java.awt.Dimension(84, 20)); - jButtonOk.setLocation(new java.awt.Point(316, 486)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(82, 20)); - jButtonCancel.setLocation(new java.awt.Point(411, 486)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(221, 486, 79, 19)); - jButton.setText("Insert"); - jButton.addActionListener(this); - } - return jButton; - } -} // @jve:decl-index=0:visual-constraint="11,7" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java deleted file mode 100644 index 4327fd565d..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java +++ /dev/null @@ -1,237 +0,0 @@ -/** @file - Java class UpdateLibraryClass is GUI for msa files in spd file. - -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.packaging; - -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; - -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.*; - -import org.tianocore.common.Tools; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -/** - GUI for msa files in spd file - - @since PackageEditor 1.0 -**/ -public class UpdateMsaFile extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private SpdFileContents sfc = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private DefaultTableModel model = null; - - private JButton jButton = null; - - /** - This is the default constructor - **/ - public UpdateMsaFile(SpdFileContents sfc) { - super(); - this.sfc = sfc; - initialize(); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - if (arg0.getSource() == jButton) { - String[] o = { "" }; - model.addRow(o); - } - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(604, 553); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Update MSA Files"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable() { - if (jTable == null) { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("MSA File"); - - if (sfc.getSpdMsaFileCount() == 0) { - return jTable; - } - // - // initialize table using SpdFileContents object - // - String[][] saa = new String[sfc.getSpdMsaFileCount()][1]; - sfc.getSpdMsaFiles(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - } - return jTable; - } - - /** - Remove original Msa files before saving updated ones - **/ - protected void save() { - if (jTable.isEditing()) { - jTable.getCellEditor().stopCellEditing(); - } - sfc.removeSpdMsaFile(); - int rowCount = jTable.getRowCount(); - int i = 0; - while (i < rowCount) { - String msaFile = null; - if (jTable.getValueAt(i, 0) != null) { - msaFile = jTable.getValueAt(i, 0).toString(); - } - sfc.genSpdMsaFiles(msaFile, null); - i++; - } - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setSize(new java.awt.Dimension(84, 20)); - jButtonOk.setLocation(new java.awt.Point(316, 486)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(82, 20)); - jButtonCancel.setLocation(new java.awt.Point(411, 486)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(219, 486, 79, 19)); - jButton.setText("Insert"); - jButton.addActionListener(this); - } - return jButton; - } - -} // @jve:decl-index=0:visual-constraint="11,7" - diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateNew.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateNew.java deleted file mode 100644 index 46ba748784..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateNew.java +++ /dev/null @@ -1,573 +0,0 @@ -/** @file - Java class UpdateNew is GUI for SpdHeader in spd file. - -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.packaging; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.text.SimpleDateFormat; -import java.util.Date; - -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; -import javax.swing.JTextArea; -import javax.swing.JScrollPane; - -import javax.swing.JComboBox; - -import org.tianocore.common.Tools; -import org.tianocore.packaging.common.ui.StarLabel; - -/** - GUI for update SpdHeader contents - - @since PackageEditor 1.0 -**/ -public class UpdateNew extends JFrame implements ActionListener { - - private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="128,4" - - private JLabel jLabelBaseName = null; - - private JTextField jTextFieldBaseName = null; - - private JLabel jLabelGuid = null; - - private JTextField jTextFieldGuid = null; - - private JLabel jLabelVersion = null; - - private JTextField jTextFieldVersion = null; - - private JButton jButtonGenerateGuid = null; - - private JLabel jLabelLicense = null; - - private JTextArea jTextAreaLicense = null; - - private JLabel jLabelCopyright = null; - - private JTextArea jTextAreaCopyright = null; - - private JLabel jLabelDescription = null; - - private JTextArea jTextAreaDescription = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private JScrollPane jScrollPaneLicense = null; - - private JScrollPane jScrollPaneCopyright = null; - - private JScrollPane jScrollPaneDescription = null; - - private JLabel jLabelAbstract = null; - - private JTextField jTextFieldAbstract = null; - - private JLabel jLabelModuleType = null; - - private JLabel jLabelCompontentType = null; - - private JComboBox jComboBox1 = null; - - private JComboBox jComboBoxModuleType = null; - - private StarLabel jStarLabel1 = null; - - private StarLabel jStarLabel2 = null; - - private StarLabel jStarLabel3 = null; - - private StarLabel jStarLabel4 = null; - - private StarLabel jStarLabel5 = null; - - private StarLabel jStarLabel6 = null; - - private StarLabel jStarLabel7 = null; - - private StarLabel jStarLabel8 = null; - - private JLabel jLabelURL = null; - - private JTextField jTextFieldAbstractURL = null; - - private JLabel jLabel = null; - - private JComboBox jComboBox = null; - - private SpdFileContents sfc = null; - - private String createTime = null; - - /** - This method initializes this - - **/ - private void initialize() { - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - } - - /** - This method initializes jTextFieldBaseName - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldBaseName() { - if (jTextFieldBaseName == null) { - jTextFieldBaseName = new JTextField(); - jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 320, 20)); - } - return jTextFieldBaseName; - } - - /** - This method initializes jTextFieldGuid - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldGuid() { - if (jTextFieldGuid == null) { - jTextFieldGuid = new JTextField(); - jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 240, 20)); - } - return jTextFieldGuid; - } - - /** - This method initializes jTextFieldVersion - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldVersion() { - if (jTextFieldVersion == null) { - jTextFieldVersion = new JTextField(); - jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 320, 20)); - } - return jTextFieldVersion; - } - - /** - This method initializes jButtonGenerateGuid - - @return javax.swing.JButton - **/ - private JButton getJButtonGenerateGuid() { - if (jButtonGenerateGuid == null) { - jButtonGenerateGuid = new JButton(); - jButtonGenerateGuid.setBounds(new java.awt.Rectangle(405, 35, 75, 20)); - jButtonGenerateGuid.setText("GEN"); - jButtonGenerateGuid.addActionListener(this); - } - return jButtonGenerateGuid; - } - - /** - This method initializes jTextAreaLicense - - @return javax.swing.JTextArea - **/ - private JTextArea getJTextAreaLicense() { - if (jTextAreaLicense == null) { - jTextAreaLicense = new JTextArea(); - jTextAreaLicense.setText(""); - jTextAreaLicense.setLineWrap(true); - } - return jTextAreaLicense; - } - - /** - This method initializes jTextAreaCopyright - - @return javax.swing.JTextArea - **/ - private JTextArea getJTextAreaCopyright() { - if (jTextAreaCopyright == null) { - jTextAreaCopyright = new JTextArea(); - jTextAreaCopyright.setLineWrap(true); - } - return jTextAreaCopyright; - } - - /** - This method initializes jTextAreaDescription - - @return javax.swing.JTextArea - **/ - private JTextArea getJTextAreaDescription() { - if (jTextAreaDescription == null) { - jTextAreaDescription = new JTextArea(); - jTextAreaDescription.setLineWrap(true); - } - return jTextAreaDescription; - } - - /** - This method initializes jButtonNext - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("OK"); - jButtonOk.setBounds(new java.awt.Rectangle(290, 481, 90, 20)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 481, 90, 20)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPaneLicense() { - if (jScrollPaneLicense == null) { - jScrollPaneLicense = new JScrollPane(); - jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 85, 320, 80)); - jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - jScrollPaneLicense.setViewportView(getJTextAreaLicense()); - } - return jScrollPaneLicense; - } - - /** - This method initializes jScrollPane1 - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPaneCopyright() { - if (jScrollPaneCopyright == null) { - jScrollPaneCopyright = new JScrollPane(); - jScrollPaneCopyright.setBounds(new java.awt.Rectangle(160,170,320,26)); - jScrollPaneCopyright.setViewportView(getJTextAreaCopyright()); - jScrollPaneCopyright.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - } - return jScrollPaneCopyright; - } - - /** - This method initializes jScrollPane2 - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPaneDescription() { - if (jScrollPaneDescription == null) { - jScrollPaneDescription = new JScrollPane(); - jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 322, 320, 80)); - jScrollPaneDescription.setViewportView(getJTextAreaDescription()); - jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - } - return jScrollPaneDescription; - } - - /** - This method initializes jTextFieldAbstract - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldAbstract() { - if (jTextFieldAbstract == null) { - jTextFieldAbstract = new JTextField(); - jTextFieldAbstract.setBounds(new java.awt.Rectangle(161,216,318,73)); - } - return jTextFieldAbstract; - } - - /** - This method initializes jComboBoxCompontentType - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBox1() { - if (jComboBox1 == null) { - jComboBox1 = new JComboBox(); - jComboBox1.setBounds(new java.awt.Rectangle(160, 465, 91, 20)); - } - return jComboBox1; - } - - /** - This method initializes jComboBoxModuleType - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBoxModuleType() { - if (jComboBoxModuleType == null) { - jComboBoxModuleType = new JComboBox(); - jComboBoxModuleType.setBounds(new java.awt.Rectangle(160, 440, 91, 20)); - } - return jComboBoxModuleType; - } - - /** - This method initializes jTextFieldAbstractURL - - @return javax.swing.JTextField - **/ - private JTextField getJTextFieldAbstractURL() { - if (jTextFieldAbstractURL == null) { - jTextFieldAbstractURL = new JTextField(); - jTextFieldAbstractURL.setBounds(new java.awt.Rectangle(159, 414, 320, 20)); - } - return jTextFieldAbstractURL; - } - - public UpdateNew(SpdFileContents sfc) { - super(); - initialize(); - init(); - this.setVisible(true); - this.sfc = sfc; - initShow(); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - - /** - This method initializes this - - @return void - **/ - private void init() { - this.setSize(500, 560); - this.setContentPane(getJContentPane()); - this.setTitle("SPD File Header"); - this.centerWindow(); - //this.getRootPane().setDefaultButton(jButtonOk); - initFrame(); - } - - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jLabel = new JLabel(); - jLabel.setBounds(new java.awt.Rectangle(15, 490, 140, 21)); - jLabel.setText("Re-Package"); - jLabelURL = new JLabel(); - jLabelURL.setBounds(new java.awt.Rectangle(16, 414, 25, 20)); - jLabelURL.setText("URL"); - jLabelCompontentType = new JLabel(); - jLabelCompontentType.setBounds(new java.awt.Rectangle(15, 465, 140, 20)); - jLabelCompontentType.setText("Read Only"); - jLabelModuleType = new JLabel(); - jLabelModuleType.setBounds(new java.awt.Rectangle(15, 440, 140, 20)); - jLabelModuleType.setText("Package Type"); - jLabelAbstract = new JLabel(); - jLabelAbstract.setBounds(new java.awt.Rectangle(17,216,140,20)); - jLabelAbstract.setText("Abstract"); - jLabelDescription = new JLabel(); - jLabelDescription.setText("Description"); - jLabelDescription.setBounds(new java.awt.Rectangle(16, 325, 140, 20)); - jLabelCopyright = new JLabel(); - jLabelCopyright.setText("Copyright"); - jLabelCopyright.setBounds(new java.awt.Rectangle(15, 171, 140, 20)); - jLabelLicense = new JLabel(); - jLabelLicense.setText("License"); - jLabelLicense.setBounds(new java.awt.Rectangle(15, 85, 140, 20)); - jLabelVersion = new JLabel(); - jLabelVersion.setText("Version"); - jLabelVersion.setBounds(new java.awt.Rectangle(15, 60, 140, 20)); - jLabelGuid = new JLabel(); - jLabelGuid.setPreferredSize(new java.awt.Dimension(25, 15)); - jLabelGuid.setBounds(new java.awt.Rectangle(15, 35, 140, 20)); - jLabelGuid.setText("Guid"); - jLabelBaseName = new JLabel(); - jLabelBaseName.setText("Package Name"); - jLabelBaseName.setBounds(new java.awt.Rectangle(15, 10, 140, 20)); - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.setLocation(new java.awt.Point(0, 0)); - jContentPane.setSize(new java.awt.Dimension(500, 524)); - jContentPane.add(jLabelBaseName, null); - jContentPane.add(getJTextFieldBaseName(), null); - jContentPane.add(jLabelGuid, null); - jContentPane.add(getJTextFieldGuid(), null); - jContentPane.add(jLabelVersion, null); - jContentPane.add(getJTextFieldVersion(), null); - jContentPane.add(getJButtonGenerateGuid(), null); - jContentPane.add(jLabelLicense, null); - jContentPane.add(jLabelCopyright, null); - jContentPane.add(jLabelDescription, null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJScrollPaneLicense(), null); - jContentPane.add(getJScrollPaneCopyright(), null); - jContentPane.add(getJScrollPaneDescription(), null); - jContentPane.add(jLabelAbstract, null); - jContentPane.add(getJTextFieldAbstract(), null); - jContentPane.add(jLabelModuleType, null); - jContentPane.add(jLabelCompontentType, null); - jContentPane.add(getJComboBox1(), null); - jContentPane.add(getJComboBoxModuleType(), null); - - jStarLabel1 = new StarLabel(); - jStarLabel1.setLocation(new java.awt.Point(0, 10)); - jStarLabel2 = new StarLabel(); - jStarLabel2.setLocation(new java.awt.Point(0, 35)); - jStarLabel3 = new StarLabel(); - jStarLabel3.setLocation(new java.awt.Point(0, 60)); - jStarLabel4 = new StarLabel(); - jStarLabel4.setLocation(new java.awt.Point(0, 85)); - jStarLabel5 = new StarLabel(); - jStarLabel5.setLocation(new java.awt.Point(0, 171)); - jStarLabel6 = new StarLabel(); - jStarLabel6.setLocation(new java.awt.Point(1, 325)); - jStarLabel7 = new StarLabel(); - jStarLabel7.setLocation(new java.awt.Point(2,216)); - jStarLabel8 = new StarLabel(); - jStarLabel8.setLocation(new java.awt.Point(0, 440)); - - jContentPane.add(jStarLabel1, null); - jContentPane.add(jStarLabel2, null); - jContentPane.add(jStarLabel3, null); - jContentPane.add(jStarLabel4, null); - jContentPane.add(jStarLabel5, null); - jContentPane.add(jStarLabel6, null); - jContentPane.add(jStarLabel7, null); - jContentPane.add(jStarLabel8, null); - jContentPane.add(jLabelURL, null); - jContentPane.add(getJTextFieldAbstractURL(), null); - jContentPane.add(jLabel, null); - jContentPane.add(getJComboBox(), null); - } - return jContentPane; - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - if (arg0.getSource() == jButtonGenerateGuid) { - jTextFieldGuid.setText(Tools.generateUuidString()); - } - } - - /** - Save all components of Msa Header, update time modified. - - **/ - private void save() { - // sfc.removeSpdHdr(); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - Date date = new Date(); - sfc.genSpdHeader(jTextFieldBaseName.getText(), jTextFieldGuid.getText(), jTextFieldVersion.getText(), - jTextFieldAbstract.getText(), jTextAreaDescription.getText(), jTextAreaCopyright.getText(), - jTextAreaLicense.getText(), createTime, format.format(date), jTextFieldAbstractURL.getText(), - jComboBoxModuleType.getSelectedItem().toString(), jComboBox1.getSelectedItem().toString(), - jComboBox.getSelectedItem().toString(), null, null); - // ModalFrameUtil.showAsModal(new PackageAction(sfc), pThis); - } - - /** - This method initializes module type and compontent type - - **/ - private void initFrame() { - jComboBoxModuleType.addItem("SOURCE"); - jComboBoxModuleType.addItem("BINARY"); - jComboBoxModuleType.addItem("MIXED"); - - jComboBox1.addItem("true"); - jComboBox1.addItem("false"); - - jComboBox.addItem("false"); - jComboBox.addItem("true"); - - } - - /** - Display original SpdHeader contents during init - **/ - private void initShow() { - String[] s = new String[12]; - - sfc.getSpdHdrDetails(s); - jTextFieldBaseName.setText(s[0]); - jTextFieldGuid.setText(s[1]); - jTextFieldVersion.setText(s[2]); - jTextFieldAbstract.setText(s[3]); - jTextAreaDescription.setText(s[4]); - jTextAreaCopyright.setText(s[5]); - jTextAreaLicense.setText(s[6]); - createTime = s[7]; - jTextFieldAbstractURL.setText(s[8]); - jComboBoxModuleType.setSelectedItem(s[9]); - jComboBox1.setSelectedIndex(s[10].equals("true") ? 0 : 1); - jComboBox.setSelectedIndex(s[11].equals("true") ? 0 : 1); - - } - - /** - This method initializes jComboBox - - @return javax.swing.JComboBox - **/ - private JComboBox getJComboBox() { - if (jComboBox == null) { - jComboBox = new JComboBox(); - jComboBox.setBounds(new java.awt.Rectangle(160, 490, 90, 20)); - } - return jComboBox; - } - -} // @jve:decl-index=0:visual-constraint="38,-22" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java deleted file mode 100644 index 765e331432..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java +++ /dev/null @@ -1,277 +0,0 @@ -/** @file - Java class UpdatePCD is GUI for update PCD definitions in spd file. - -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.packaging; - -import javax.swing.DefaultCellEditor; -import javax.swing.JComboBox; -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; - -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.*; - -import org.tianocore.common.Tools; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; - -/** - GUI for update PCD definitions in spd file - - @since PackageEditor 1.0 -**/ -public class UpdatePCD extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private SpdFileContents sfc = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private DefaultTableModel model = null; - - private String[][] saa = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private JButton jButton = null; - - /** - This is the default constructor - **/ - public UpdatePCD(SpdFileContents sfc) { - super(); - this.sfc = sfc; - initialize(); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - if (arg0.getSource() == jButton) { - String[] o = { "FEATURE_FLAG", "", "", "UINT8", "0" }; - model.addRow(o); - } - - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(916, 486); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Update PCD Definitions"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - /** - Remove original Pcd definitions before saving updated ones - **/ - protected void save() { - if (jTable.isEditing()) { - jTable.getCellEditor().stopCellEditing(); - } - sfc.removeSpdPcdDefinition(); - int rowCount = model.getRowCount(); - int i = 0; - while (i < rowCount) { - String cName = null; - if (model.getValueAt(i, 1) != null) { - cName = model.getValueAt(i, 1).toString(); - } - String token = null; - if (model.getValueAt(i, 2) != null) { - token = model.getValueAt(i, 2).toString(); - } - String defaultVal = null; - if (model.getValueAt(i, 4) != null) { - defaultVal = model.getValueAt(i, 4).toString(); - } - sfc.genSpdPcdDefinitions(model.getValueAt(i, 0).toString(), cName, token, - model.getValueAt(i, 3).toString(), null, null, null, null, null, null, defaultVal); - i++; - } - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setSize(new java.awt.Dimension(84, 20)); - jButtonOk.setLocation(new java.awt.Point(605, 404)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(82, 20)); - jButtonCancel.setLocation(new java.awt.Point(712, 404)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jScrollPane.setBounds(new java.awt.Rectangle(51, 62, 782, 304)); - jScrollPane.setViewportView(getJTable2()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable2() { - if (jTable == null) { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("ItemType"); - model.addColumn("C_Name"); - model.addColumn("Token"); - model.addColumn("DataType"); - model.addColumn("DefaultValue"); - // - // Using combobox to display ItemType in table - // - JComboBox jComboBoxItemType = new JComboBox(); - jComboBoxItemType.addItem("FEATURE_FLAG"); - jComboBoxItemType.addItem("FIXED_AT_BUILD"); - jComboBoxItemType.addItem("PATCHABLE_IN_MODULE"); - jComboBoxItemType.addItem("DYNAMIC"); - jComboBoxItemType.addItem("DYNAMIC_EX"); - TableColumn itemTypeColumn = jTable.getColumnModel().getColumn(0); - itemTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxItemType)); - // - // Using combobox to display data type in table - // - JComboBox jComboBoxDataType = new JComboBox(); - jComboBoxDataType.addItem("UINT8"); - jComboBoxDataType.addItem("UINT16"); - jComboBoxDataType.addItem("UINT32"); - jComboBoxDataType.addItem("UINT64"); - jComboBoxDataType.addItem("VOID*"); - jComboBoxDataType.addItem("BOOLEAN"); - TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3); - dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType)); - - if (sfc.getSpdPcdDefinitionCount() == 0) { - - return jTable; - } - saa = new String[sfc.getSpdPcdDefinitionCount()][5]; - sfc.getSpdPcdDefinitions(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - - } - return jTable; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(499, 404, 77, 20)); - jButton.setText("Insert"); - jButton.addActionListener(this); - } - return jButton; - } -} // @jve:decl-index=0:visual-constraint="11,7" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java deleted file mode 100644 index 5f9356cf8d..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java +++ /dev/null @@ -1,257 +0,0 @@ -/** @file - Java class UpdatePkgHeader is GUI for update Package Header in spd file. - -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.packaging; - -import javax.swing.DefaultCellEditor; -import javax.swing.JComboBox; -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; - -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.*; - -import org.tianocore.common.Tools; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; - -/** - GUI for update Package Header in spd file - - @since PackageEditor 1.0 -**/ -public class UpdatePkgHeader extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private SpdFileContents sfc = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private DefaultTableModel model = null; - - private JButton jButton = null; - - /** - This is the default constructor - **/ - public UpdatePkgHeader(SpdFileContents sfc) { - super(); - this.sfc = sfc; - initialize(); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - - if (arg0.getSource() == jButton) { - String[] o = { "BASE", "" }; - model.addRow(o); - } - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(604, 553); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Update Package Headers"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable() { - if (jTable == null) { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("ModuleType"); - model.addColumn("IncludeHeader"); - // - // Using combobox to display ModuleType in table - // - TableColumn typeColumn = jTable.getColumnModel().getColumn(0); - JComboBox jComboBoxSelect = new JComboBox(); - jComboBoxSelect.addItem("BASE"); - jComboBoxSelect.addItem("SEC"); - jComboBoxSelect.addItem("PEI_CORE"); - jComboBoxSelect.addItem("PEIM"); - jComboBoxSelect.addItem("DXE_CORE"); - jComboBoxSelect.addItem("DXE_DRIVER"); - jComboBoxSelect.addItem("DXE_RUNTIME_DRIVER"); - jComboBoxSelect.addItem("DXE_SAL_DRIVER"); - jComboBoxSelect.addItem("DXE_SMM_DRIVER"); - jComboBoxSelect.addItem("TOOLS"); - jComboBoxSelect.addItem("UEFI_DRIVER"); - jComboBoxSelect.addItem("UEFI_APPLICATION"); - jComboBoxSelect.addItem("USER_DEFINED"); - typeColumn.setCellEditor(new DefaultCellEditor(jComboBoxSelect)); - - if (sfc.getSpdPackageHeaderCount() == 0) { - return jTable; - } - String[][] saa = new String[sfc.getSpdPackageHeaderCount()][2]; - sfc.getSpdPackageHeaders(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - - } - return jTable; - } - - /** - Remove original package headers before saving updated ones - **/ - protected void save() { - if (jTable.isEditing()) { - jTable.getCellEditor().stopCellEditing(); - } - sfc.removeSpdPkgHeader(); - int rowCount = model.getRowCount(); - int i = 0; - while (i < rowCount) { - String headFile = null; - if (model.getValueAt(i, 1) != null) { - headFile = model.getValueAt(i, 1).toString(); - } - sfc.genSpdModuleHeaders(model.getValueAt(i, 0).toString(), headFile, null, null, null, null, null, null); - i++; - } - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setSize(new java.awt.Dimension(84, 20)); - jButtonOk.setLocation(new java.awt.Point(316, 486)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(82, 20)); - jButtonCancel.setLocation(new java.awt.Point(411, 486)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(220, 486, 85, 20)); - jButton.setText("Insert"); - jButton.addActionListener(this); - } - return jButton; - } -} // @jve:decl-index=0:visual-constraint="11,7" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java deleted file mode 100644 index be58e1c848..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java +++ /dev/null @@ -1,248 +0,0 @@ -/** @file - Java class UpdatePpi is GUI for update Ppi declarations in spd file. - -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.packaging; - -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; - -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.*; - -import org.tianocore.common.Tools; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; - -/** - GUI for update Ppi declarations in spd file. - - @since PackageEditor 1.0 -**/ -public class UpdatePpi extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private SpdFileContents sfc = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private DefaultTableModel model = null; - - private JButton jButton = null; - - /** - This is the default constructor - **/ - public UpdatePpi(SpdFileContents sfc) { - super(); - this.sfc = sfc; - initialize(); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - - if (arg0.getSource() == jButton) { - String[] o = { "", "", "" }; - model.addRow(o); - } - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(604, 553); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Update PPI Declarations"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable() { - if (jTable == null) { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("Name"); - model.addColumn("C_Name"); - model.addColumn("GUID"); - // - // initialize table using SpdFileContents object - // - if (sfc.getSpdPpiDeclarationCount() == 0) { - return jTable; - } - String[][] saa = new String[sfc.getSpdPpiDeclarationCount()][3]; - sfc.getSpdPpiDeclarations(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - - jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor()); - } - return jTable; - } - - /** - Remove original ppi declarations before saving updated ones - **/ - protected void save() { - if (jTable.isEditing()) { - jTable.getCellEditor().stopCellEditing(); - } - sfc.removeSpdPpiDeclaration(); - int rowCount = model.getRowCount(); - int i = 0; - while (i < rowCount) { - String name = null; - if (model.getValueAt(i, 0) != null) { - name = model.getValueAt(i, 0).toString(); - } - String cName = null; - if (model.getValueAt(i, 1) != null) { - cName = model.getValueAt(i, 1).toString(); - } - String guid = null; - if (model.getValueAt(i, 2) != null) { - guid = model.getValueAt(i, 2).toString(); - } - sfc.genSpdPpiDeclarations(name, cName, guid, null); - i++; - } - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setSize(new java.awt.Dimension(84, 20)); - jButtonOk.setLocation(new java.awt.Point(316, 486)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(82, 20)); - jButtonCancel.setLocation(new java.awt.Point(411, 486)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(224, 488, 72, 18)); - jButton.setText("Insert"); - jButton.addActionListener(this); - } - return jButton; - } -} // @jve:decl-index=0:visual-constraint="11,7" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java deleted file mode 100644 index 4408ec1ffc..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java +++ /dev/null @@ -1,250 +0,0 @@ -/** @file - Java class UpdateProtocols is GUI for update protocol declarations in spd file. - -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.packaging; - -import javax.swing.JPanel; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.JButton; - -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.table.*; - -import org.tianocore.common.Tools; - -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.*; - -/** - GUI for update protocol declarations in spd file - - @since PackageEditor 1.0 -**/ -public class UpdateProtocols extends JFrame implements ActionListener { - - private JPanel jContentPane = null; - - private JScrollPane jScrollPane = null; - - private JTable jTable = null; - - private SpdFileContents sfc = null; - - private JButton jButtonOk = null; - - private JButton jButtonCancel = null; - - private DefaultTableModel model = null; - - private JButton jButton = null; - - /** - This is the default constructor - **/ - public UpdateProtocols(SpdFileContents sfc) { - super(); - this.sfc = sfc; - initialize(); - - } - - public void actionPerformed(ActionEvent arg0) { - if (arg0.getSource() == jButtonOk) { - this.save(); - this.dispose(); - - } - if (arg0.getSource() == jButtonCancel) { - this.dispose(); - - } - - if (arg0.getSource() == jButton) { - String[] o = { "", "", "" }; - model.addRow(o); - } - } - - /** - This method initializes this - - @return void - **/ - private void initialize() { - this.setSize(604, 553); - this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - this.setTitle("Update Protocol Declarations"); - this.setContentPane(getJContentPane()); - this.centerWindow(); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow(int intWidth, int intHeight) { - Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); - this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); - } - - /** - Start the window at the center of screen - - **/ - protected void centerWindow() { - centerWindow(this.getSize().width, this.getSize().height); - } - /** - This method initializes jContentPane - - @return javax.swing.JPanel - **/ - private JPanel getJContentPane() { - if (jContentPane == null) { - jContentPane = new JPanel(); - jContentPane.setLayout(null); - jContentPane.add(getJScrollPane(), null); - jContentPane.add(getJButtonOk(), null); - jContentPane.add(getJButtonCancel(), null); - jContentPane.add(getJButton(), null); - } - return jContentPane; - } - - /** - This method initializes jScrollPane - - @return javax.swing.JScrollPane - **/ - private JScrollPane getJScrollPane() { - if (jScrollPane == null) { - jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419)); - jScrollPane.setViewportView(getJTable()); - } - return jScrollPane; - } - - /** - This method initializes jTable - - @return javax.swing.JTable - **/ - private JTable getJTable() { - if (jTable == null) { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - model.addColumn("Name"); - model.addColumn("C_Name"); - model.addColumn("GUID"); - // - // initialize table using SpdFileContents object - // - if (sfc.getSpdProtocolDeclarationCount() == 0) { - return jTable; - } - String[][] saa = new String[sfc.getSpdProtocolDeclarationCount()][3]; - sfc.getSpdProtocolDeclarations(saa); - int i = 0; - while (i < saa.length) { - model.addRow(saa[i]); - i++; - } - - jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor()); - - } - return jTable; - } - - /** - Remove original protocol declarations before saving updated ones - **/ - protected void save() { - if (jTable.isEditing()) { - jTable.getCellEditor().stopCellEditing(); - } - sfc.removeSpdProtocolDeclaration(); - int rowCount = model.getRowCount(); - int i = 0; - while (i < rowCount) { - String name = null; - if (model.getValueAt(i, 0) != null) { - name = model.getValueAt(i, 0).toString(); - } - String cName = null; - if (model.getValueAt(i, 1) != null) { - cName = model.getValueAt(i, 1).toString(); - } - String guid = null; - if (model.getValueAt(i, 2) != null) { - guid = model.getValueAt(i, 2).toString(); - } - sfc.genSpdProtocolDeclarations(name, cName, guid, null); - i++; - } - } - - /** - This method initializes jButtonOk - - @return javax.swing.JButton - **/ - private JButton getJButtonOk() { - if (jButtonOk == null) { - jButtonOk = new JButton(); - jButtonOk.setText("Ok"); - jButtonOk.setSize(new java.awt.Dimension(84, 20)); - jButtonOk.setLocation(new java.awt.Point(316, 486)); - jButtonOk.addActionListener(this); - } - return jButtonOk; - } - - /** - This method initializes jButtonCancel - - @return javax.swing.JButton - **/ - private JButton getJButtonCancel() { - if (jButtonCancel == null) { - jButtonCancel = new JButton(); - jButtonCancel.setText("Cancel"); - jButtonCancel.setSize(new java.awt.Dimension(82, 20)); - jButtonCancel.setLocation(new java.awt.Point(411, 486)); - jButtonCancel.addActionListener(this); - } - return jButtonCancel; - } - - /** - This method initializes jButton - - @return javax.swing.JButton - **/ - private JButton getJButton() { - if (jButton == null) { - jButton = new JButton(); - jButton.setBounds(new java.awt.Rectangle(232, 486, 71, 19)); - jButton.setText("Insert"); - jButton.addActionListener(this); - } - return jButton; - } -} // @jve:decl-index=0:visual-constraint="11,7" diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/common/ui/StarLabel.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/common/ui/StarLabel.java deleted file mode 100644 index ad19472e5d..0000000000 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/common/ui/StarLabel.java +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - Java class StarLabel is used to create star label. - -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.packaging.common.ui; - -import javax.swing.JLabel; - -/** - Derived from JLabel class to have a red star on it. - - @since PackageEditor 1.0 -**/ -public class StarLabel extends JLabel{ - /** - * This is the default constructor - */ - public StarLabel() { - super(); - init(); - } - - /** - Create a label with red star * appear on it - **/ - private void init() { - this.setText("*"); - this.setSize(new java.awt.Dimension(10,20)); - this.setForeground(java.awt.Color.red); - this.setFont(new java.awt.Font("DialogInput", java.awt.Font.BOLD, 14)); - this.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - } -} -- cgit v1.2.3