summaryrefslogtreecommitdiff
path: root/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far')
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java86
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java89
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java261
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java54
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java100
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java58
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java21
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java40
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java93
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java60
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java36
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java960
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java40
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java127
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java38
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java334
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java641
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java294
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java349
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java374
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java351
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java362
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java483
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java315
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java417
25 files changed, 0 insertions, 5983 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java
deleted file mode 100644
index b8a6d40b0e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/AggregationOperation.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/** @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.frameworkwizard.far;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class AggregationOperation {
-
- public static synchronized List<PackageIdentification> union(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- result.addAll(list1);
- Iterator<PackageIdentification> iter = list2.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!belongs(item, result)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized List<PackageIdentification> intersection(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list1.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (belongs(item, list2)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized List<PackageIdentification> minus(List<PackageIdentification> list1,
- List<PackageIdentification> list2) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list1.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!belongs(item, list2)) {
- result.add(item);
- }
- }
- return result;
- }
-
- public static synchronized boolean belongs(PackageIdentification o, List<PackageIdentification> list) {
- Iterator<PackageIdentification> iter = list.iterator();
- while (iter.hasNext()) {
- if (iter.next().equalsWithGuid(o)) {
- return true;
- }
- }
- return false;
- }
-
- public static synchronized List<PackageIdentification> getExistedItems(PackageIdentification o,
- List<PackageIdentification> list) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<PackageIdentification> iter = list.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (item.equalsWithGuid(o)) {
- result.add(item);
- }
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java
deleted file mode 100644
index 730e385c74..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/DistributeRule.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
-
- The file is used to distribute Far
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DistributeRule {
- static PackageQuery pkgQ = new PackageQuery();
-
- static WorkspaceTools wsTools = new WorkspaceTools();
-
- static List<PackageIdentification> farPkgList = new ArrayList<PackageIdentification>();
-
- public static List<PackageIdentification> installFarCheck(Far far) {
-
- Far myFar = far;
- List<PackageIdentification> pkgDepList = new ArrayList<PackageIdentification>();
- List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();
- List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();
- //
- // Get Far packages list;
- //
- try {
- farPkgList = myFar.manifest.getPackageList();
- Iterator pkgItems = farPkgList.iterator();
- while (pkgItems.hasNext()) {
- PackageIdentification id = (PackageIdentification) pkgItems.next();
- pkgDepList = myFar.getPackageDependencies(id);
- depResultList = AggregationOperation.union(depResultList, pkgDepList);
- }
- dbPkgList = vectorToList(wsTools.getAllPackages());
-
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
-
- //
- // Check does the dependence meet the requirement.
- //
- List<PackageIdentification> resultList = AggregationOperation.minus(depResultList,
- AggregationOperation.union(farPkgList,
- dbPkgList));
-
- return resultList;
-
- }
-
- // public void installPackgCheck (PackageIdentification pkgId, String pkgPath){
- // List<PackageIdentification> dbPkgList = new ArrayList<PackageIdentification>();
- // dbPkgList = vectorToList(wsTools.getAllPackages());
- // //
- // // Install far's package one by one.
- // //
- // if ((AggregationOperation.getExistItems(pkgId, dbPkgList))){
- //
- // }
- // }
-
- public void UpdatCheck(String orgFar, String destFar) {
-
- }
-
- public static List<PackageIdentification> vectorToList(Vector vec) {
- List<PackageIdentification> set = new ArrayList<PackageIdentification>();
- Iterator vecItem = vec.iterator();
- while (vecItem.hasNext()) {
- set.add((PackageIdentification) vecItem.next());
- }
- return set;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java
deleted file mode 100644
index ad04dc7fcd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Far.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/** @file
-
- The file is used to create far 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.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarOutputStream;
-
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class Far {
- //
- // Class member Manifest
- //
- public Manifest manifest = null;
-
- //
- // Jar file
- //
- private JarFile jf = null;
-
- private File jarFile = null;
-
- //
- // Jar outputStream.
- //
- static public JarOutputStream jos = null;
-
- public Far(File jarFile) {
- this.jarFile = jarFile;
- }
-
- //
- // For install/updat jar
- //
- public Far(JarFile farFile) throws Exception {
- jf = farFile;
- this.manifest = new Manifest(getManifestFile());
- }
-
- public void creatFar(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter, FarHeader fHeader) throws Exception {
- jos = new JarOutputStream(new FileOutputStream(jarFile));
-
- //
- // Generate Manifest and get file lists
- //
- this.manifest = new Manifest();
- this.manifest.setFarHeader(fHeader);
- this.manifest.createManifest(pkgList, plfList, fileFilter);
-
- this.manifest.hibernateToFile();
-
- //
- // Write Mainifest file to JAR.
- //
- if (this.manifest.mfFile != null) {
- writeToJar(this.manifest.mfFile, jos);
- }
-
- //
- // Write all files to JAR
- //
- Set<File> files = this.manifest.files;
- Iterator<File> iter = files.iterator();
- while (iter.hasNext()) {
- writeToJar(iter.next(), jos);
- }
- jos.close();
- }
-
- private void writeToJar(File file, JarOutputStream jos) throws Exception {
- byte[] buffer = new byte[(int) file.length()];
- FileInputStream fInput = new FileInputStream(file);
- JarEntry entry = new JarEntry(
- Tools
- .convertPathToUnixType(Tools
- .getRelativePath(file.getPath(),
- Workspace.getCurrentWorkspace())));
- jos.putNextEntry(entry);
- fInput.read(buffer);
- jos.write(buffer);
- fInput.close();
- }
-
- public void InstallFar(String dir) throws Exception {
- List<FarFileItem> allFile = manifest.getAllFileItem();
- extract(allFile, dir);
- }
-
- public void InstallFar(Map<PlatformIdentification, File> plfMap, Map<PackageIdentification, File> pkgMap)
- throws Exception {
- Set<PlatformIdentification> plfKeys = plfMap.keySet();
- Iterator<PlatformIdentification> plfIter = plfKeys.iterator();
- while (plfIter.hasNext()) {
- PlatformIdentification item = plfIter.next();
- extract(this.manifest.getPlatformContents(item), plfMap.get(item).getPath());
- }
-
- Set<PackageIdentification> pkgKeys = pkgMap.keySet();
- Iterator<PackageIdentification> pkgIter = pkgKeys.iterator();
- while (pkgIter.hasNext()) {
- PackageIdentification item = pkgIter.next();
- installPackage(item, pkgMap.get(item));
- }
- jf.close();
- }
-
- public void installPackage(PackageIdentification packageId, File installPath) throws Exception {
- List<FarFileItem> contents = this.manifest.getPackageContents(packageId);
- extract(contents, installPath.getPath());
- }
-
- public InputStream getManifestFile() throws Exception {
- JarEntry je = null;
- for (Enumeration e = jf.entries(); e.hasMoreElements();) {
- je = (JarEntry) e.nextElement();
- if (je.getName().equalsIgnoreCase(Manifest.mfFileName))
- return jf.getInputStream(je);
- }
- return null;
- }
-
- public void createFar() {
-
- }
-
- public boolean hibernateToFile() {
- return true;
- }
-
- public void extract(List<FarFileItem> allFile, String dir) throws Exception {
-
- Iterator filesItem = allFile.iterator();
- FarFileItem ffItem;
- JarEntry je;
- new File(dir).mkdirs();
- dir += File.separatorChar;
- while (filesItem.hasNext()) {
- try {
- ffItem = (FarFileItem) filesItem.next();
- je = jf.getJarEntry(Tools.convertPathToUnixType(ffItem.getDefaultPath()));
- InputStream entryStream = jf.getInputStream(je);
- File file = new File(dir + ffItem.getRelativeFilename());
- file.getParentFile().mkdirs();
- try {
- //
- // Create the output file (clobbering the file if it
- // exists).
- //
- FileOutputStream outputStream = new FileOutputStream(file);
-
- try {
- //
- // Read the entry data and write it to the output
- // file.
- //
- int fileLen = (int)je.getSize();
- byte[] buffer = new byte[fileLen];
- int len = entryStream.read(buffer);
- if (len < fileLen){
- File tempFile = new File("tempFile");
- FileOutputStream fos = new FileOutputStream(tempFile);
- fos.write(buffer, 0, len);
- while (len < fileLen){
- int tempLen = entryStream.read(buffer);
- len = len + tempLen;
- fos.write(buffer, 0, tempLen);
- }
- fos.close();
- FileInputStream fin = new FileInputStream(tempFile);
- fin.read(buffer);
- tempFile.delete();
- }
- //
- // Check Md5
- //
- if (!ffItem.getMd5Value().equalsIgnoreCase(FarMd5.md5(buffer))){
- throw new Exception (ffItem.getRelativeFilename() + " MD5 Checksum is invaild!");
- }
- outputStream.write(buffer);
- } finally {
- outputStream.close();
- }
- } finally {
- entryStream.close();
- }
-
- } finally {
- }
- }
-
- }
-
- public void addFileToFar(File file, JarOutputStream farOuputStream, String workDir) {
-
- }
-
- /**
- *
- * @param pkgId
- * @return
- */
- public List<PackageIdentification> getPackageDependencies(PackageIdentification pkgId) {
- String[] entry = new String[2];
- PackageQuery pkgQ = new PackageQuery();
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
-
- entry = this.manifest.getPackgeSpd(pkgId);
- if (entry == null) {
- return result;
- }
- if (entry[0] != null) {
- try {
- JarEntry je;
- je = jf.getJarEntry(Tools.convertPathToUnixType(entry[1] + File.separatorChar + entry[0]));
- List<String> masList = pkgQ.getPackageMsaList(jf.getInputStream(je));
- Iterator item = masList.iterator();
- while (item.hasNext()) {
- je = jf.getJarEntry(Tools.convertPathToUnixType(entry[1] + File.separatorChar + item.next()));
- List<PackageIdentification> pkgIdList = pkgQ.getModuleDependencies(jf.getInputStream(je));
- Iterator pkgItem = pkgIdList.iterator();
- while (pkgItem.hasNext()) {
- PackageIdentification id = (PackageIdentification) pkgItem.next();
- if (!AggregationOperation.belongs(id, result)) {
- result.add(id);
- }
- }
- }
- } catch (Exception e) {
- System.out.println(e.getMessage());
- }
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java
deleted file mode 100644
index 0e6cc4a679..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarFileItem.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/** @file
-
- The file is used to save information of <FarFile> item.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarFileItem {
-
- private String relativeFilename;
-
- private String md5Value;
-
- private String defaultPath;
-
- public FarFileItem(String relativeFilename, String md5Value) {
- this.relativeFilename = relativeFilename;
- this.md5Value = md5Value;
- }
-
- public String getMd5Value() {
- return md5Value;
- }
-
- public String getRelativeFilename() {
- return relativeFilename;
- }
-
- public void setMd5Value(String md5Value) {
- this.md5Value = md5Value;
- }
-
- public void setRelativeFilename(String relativeFilename) {
- this.relativeFilename = relativeFilename;
- }
-
- public String getDefaultPath() {
- return defaultPath;
- }
-
- public void setDefaultPath(String defaultPath) {
- this.defaultPath = defaultPath;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java
deleted file mode 100644
index dd4f22690e..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarHeader.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/** @file
-
- The file is used to save <farPackage> information.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarHeader {
- //
- // class member
- //
- private String farName;
-
- private String guidValue;
-
- private String version;
-
- private String abstractStr;
-
- private String description;
-
- private String copyright;
-
- private String license;
-
- private String specification;
-
- public String getAbstractStr() {
- return abstractStr;
- }
-
- public void setAbstractStr(String abstractStr) {
- this.abstractStr = abstractStr;
- }
-
- public String getCopyright() {
- return copyright;
- }
-
- public void setCopyright(String copyright) {
- this.copyright = copyright;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getFarName() {
- return farName;
- }
-
- public void setFarName(String farName) {
- this.farName = farName;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getLicense() {
- return license;
- }
-
- public void setLicense(String license) {
- this.license = license;
- }
-
- public String getSpecification() {
- return specification;
- }
-
- public void setSpecification(String specification) {
- this.specification = specification;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java
deleted file mode 100644
index babc9e3d92..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarIdentification.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/** @file
-
- The file is used to save information of Far item.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-public class FarIdentification {
-
- private String guid;
-
- private String md5Value;
-
- private String path;
-
- public FarIdentification(String guid, String md5Value, String path) {
- this.guid = guid;
- this.md5Value = md5Value;
- this.path = path;
- }
-
- public String getGuid() {
- return guid;
- }
-
- public void setGuid(String guid) {
- this.guid = guid;
- }
-
- public String getMd5Value() {
- return md5Value;
- }
-
- public void setMd5Value(String md5Value) {
- this.md5Value = md5Value;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String toString() {
- return path + " [" + guid + "]";
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java
deleted file mode 100644
index 04a2fb0a35..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarInterface.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.tianocore.frameworkwizard.far;
-
-import java.io.Reader;
-import java.util.Map;
-import java.util.Set;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public interface FarInterface {
-
- public Reader getManifestFile();
-
- public void hibernateToFile();
-
- public boolean extract(Map<PackageIdentification, String> packagePathes,
- Map<PlatformIdentification, String> platformPathes);
-
- public Set<PackageIdentification> getPackageDependencies(PackageIdentification packageId);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java
deleted file mode 100644
index 0269fcf6cd..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarMd5.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
-
- The file is used to caculate file MD5 value.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.security.MessageDigest;
-
-public class FarMd5 {
-
- static public String md5(File file) throws Exception {
- byte[] buffer = new byte[(int) file.length()];
- FileInputStream fInput = new FileInputStream(file);
- fInput.read(buffer);
- fInput.close();
- return md5(buffer);
-
- }
-
- static public String md5(byte[] buffer) throws Exception {
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] md5 = md.digest(buffer);
- return new String(String.format("%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", md5[0], md5[1], md5[2], md5[3], md5[4],
- md5[5], md5[6], md5[7], md5[8], md5[9], md5[10], md5[11], md5[12], md5[13],
- md5[14], md5[15]));
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java
deleted file mode 100644
index aca9041c78..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPackage.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
-
- The file is used to save <farPackage> information.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public class FarPackage {
- //
- // Class member
- //
- private FarFileItem farFile;
-
- private String guidValue;
-
- private String version;
-
- private String defaultPath;
-
- private List<FarPlatformItem> farPlatformList;
-
- private List<FarFileItem> contentList;
-
- public String getDefaultPath() {
- return defaultPath;
- }
-
- public void setDefaultPath(String defaultPath) {
- this.defaultPath = defaultPath;
- }
-
- public FarFileItem getFarFile() {
- return farFile;
- }
-
- public void setFarFile(FarFileItem farFile) {
- this.farFile = farFile;
- }
-
- public List<FarPlatformItem> getFarPlatformList() {
- return farPlatformList;
- }
-
- public void setFarPlatformList(List<FarPlatformItem> farPlatformList) {
- this.farPlatformList = farPlatformList;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public List<FarFileItem> getContentList() {
- return this.contentList;
- }
-
- public void setContentList(List<FarFileItem> contentList) {
- this.contentList = contentList;
- }
-
- public boolean isIdentityPkg(PackageIdentification pkgId) {
- //File file = new File(farFile.getRelativeFilename());
- if (pkgId.getGuid().equalsIgnoreCase(guidValue) && pkgId.getVersion().equalsIgnoreCase(version)) {
- return true;
- }
- return false;
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java
deleted file mode 100644
index e3c2f1c733..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarPlatformItem.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
-
- The file is used to save <farPlatform> information.
-
- Copyright (c) 2006, Intel Corporation
- All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
-
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
- **/
-package org.tianocore.frameworkwizard.far;
-
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public class FarPlatformItem {
- //
- // class member
- //
- private FarFileItem farFile;
-
- private String guidValue;
-
- private String version;
-
- public FarFileItem getFarFile() {
- return farFile;
- }
-
- public void setFarFile(FarFileItem farFile) {
- this.farFile = farFile;
- }
-
- public String getGuidValue() {
- return guidValue;
- }
-
- public void setGuidValue(String guidValue) {
- this.guidValue = guidValue;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public boolean isIdentityPlf(PlatformIdentification plfId) {
- if (plfId.getGuid() == guidValue && plfId.getVersion() == version) {
- return true;
- }
- return false;
-
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java
deleted file mode 100644
index bd1b7942f3..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/FarStringDefinition.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.tianocore.frameworkwizard.far;
-
-public class FarStringDefinition {
-
- ///
- /// Definition for all step's title string
- ///
- public static final String CREATE_STEP_ONE_TITLE =
- "Create Framework Archive(FAR) - Step 1: Set FAR's basic information";
- public static final String CREATE_STEP_TWO_TITLE =
- "Create Framework Archive(FAR) - Step 2: Choose Packages and/or Platforms";
- public static final String CREATE_STEP_THREE_TITLE =
- "Create Framework Archive(FAR) - Step 3: Set file filter";
- public static final String CREATE_STEP_FOUR_TITLE =
- "Create Framework Archive(FAR) - Step 4: Choose target file and finish";
-
- public static final String DELETE_STEP_ONE_TITLE =
- "Delete Framework Archive(FAR) - Step 1: Choose FAR from current WORKSPACE";
- public static final String DELETE_STEP_TWO_TITLE =
- "Delete Framework Archive(FAR) - Step 2: Choose delete mode and finish";
-
- public static final String UPDATE_STEP_ONE_TITLE =
- "Update Framework Archive(FAR) - Step 1: Browse FAR file";
- public static final String UPDATE_STEP_TWO_TITLE =
- "Update Framework Archive(FAR) - Step 2: Summary";
-
- public static final String INSTALL_STEP_ONE_TITLE =
- "Install Framework Archive(FAR) - Step 1: Select FAR file";
- public static final String INSTALL_STEP_TWO_TITLE =
- "Install Framework Archive(FAR) - Step 2: Set path for packages and/or platforms";
-
- ///
- ///
- ///
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java
deleted file mode 100644
index 89fb5b6d42..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/Manifest.java
+++ /dev/null
@@ -1,960 +0,0 @@
-/** @file
-
- The file is used to create Far's manifest 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.frameworkwizard.far;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class Manifest implements ManifestInterface {
- // /
- // / manifest document
- // /
- Document manifestDoc = null;
-
- // /
- // / Manfiest file element name
- // /
- final static String mfFileName = "FrameworkArchiveManifest.xml";
-
- //
- // Header
- //
- final static String farHeader = "FarHeader";
-
- final static String farHeader_FarName = "FarName";
-
- final static String farHeader_Abstract = "Abstract";
-
- final static String farHeader_Description = "Description";
-
- final static String farHeader_CopyRight = "Copyright";
-
- final static String farHeader_License = "License";
-
- final static String farHeader_Specification = "Specification";
-
- //
- // Package list
- //
- final static String farPackageList = "FarPackageList";
-
- final static String farPlatformList = "FarPlatformList";
-
- final static String contents = "Contents";
-
- final static String userExtensions = "UserExtensions";
-
- //
- // Common node name
- //
-
- final static String guidValue = "GuidValue";
-
- final static String version = "Version";
-
- //
- // FarPackage node name
- //
- final static String farPackageList_FarPackage = "FarPackage";
-
- final static String farPackage_FarfileName = "FarFilename";
-
- final static String farPackage_DefaultPath = "DefaultPath";
-
- final static String farPlatformList_FarPlatform = "FarPlatform";
-
- final static String farFileName_FarGuid = "FarGuid";
-
- final static String farFileName_Md5sum = "Md5sum";
-
- //
- // manifest header information.
- //
- FarHeader fhInfo = new FarHeader();
-
- //
- // FarPackage list
- //
- List<FarPackage> fPkgList = new ArrayList<FarPackage>();
-
- //
- // FarPlatform list
- //
- List<FarPlatformItem> fPlfList = new ArrayList<FarPlatformItem>();
-
- Set<File> files = new LinkedHashSet<File>();
-
- //
- // Manifest file
- //
- public File mfFile = null;
-
- public FarHeader getHeader() {
- return fhInfo;
- }
-
- public Manifest() throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- Document document = dombuilder.newDocument();
- this.manifestDoc = document;
-
- }
-
- public Manifest(InputStream manifestInputStream) throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- try {
- if (manifestInputStream != null) {
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- this.manifestDoc = dombuilder.parse(manifestInputStream);
- parseManifest();
- }
-
- } catch (Exception e) {
- //
- // Will change to throw Wizader exception.
- //
- throw new Exception(e.getMessage());
- }
- }
-
- public void setFarHeader(FarHeader fHeader) {
- this.fhInfo = fHeader;
- }
-
- public void createManifest(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter) throws Exception {
-
- //
- // Add Package and it's contents to FarPackageList.
- //
- Iterator<PackageIdentification> pkgItem = pkgList.iterator();
- while (pkgItem.hasNext()) {
- PackageIdentification pkgId = pkgItem.next();
-
- //
- // Add package and it's contents to <FarPackageList>.
- //
- addPkgToPkgList(pkgId, fileFilter);
- }
-
- //
- // Add FarPlatform to this.farPlatformList.
- //
- Iterator<PlatformIdentification> plfItem = plfList.iterator();
- while (plfItem.hasNext()) {
- PlatformIdentification plfId = plfItem.next();
-
- //
- // Add platform to Mainifest.
- //
- addPlatformIdToFarPlatformItemList(plfId);
- }
- }
-
- public void setManifestFile(File manifestFile) throws Exception {
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();
- InputStream is = new FileInputStream(manifestFile);
- this.manifestDoc = dombuilder.parse(is);
- }
-
- public void addPkgToPkgList(PackageIdentification packageId, Set<String> fileFilter) throws Exception {
- files.add(packageId.getSpdFile());
-
- FarPackage farPackage = new FarPackage();
- //
- // Add SPD file to FarPackage
- //
- File spdFile = new File(packageId.getPath());
-
- FarFileItem ffItem = new FarFileItem(spdFile.getName(), FarMd5.md5(spdFile));
- farPackage.setFarFile(ffItem);
-
- //
- // Add package guid value.
- //
- farPackage.setGuidValue(packageId.getGuid());
-
- //
- // Add package version
- //
- farPackage.setVersion(packageId.getVersion());
-
- //
- // Add DefaultPat: Package absoulte path - Workspace absolut
- // path.
- //
- String pkgDir = Tools.getFilePathOnly(packageId.getPath());
- File rootDir = new File(pkgDir);
- farPackage.setDefaultPath(Tools.getRelativePath(rootDir.getPath(), Workspace.getCurrentWorkspace()));
-
- //
- // Get package root dir contains.
- //
- Set<File> fileSet = new LinkedHashSet<File>();
- Set<File> fpdFileSet = new LinkedHashSet<File>();
-
- //
- // Get all files and fpd files
- //
- recursiveDirectory(fileSet, fpdFileSet, rootDir, fileFilter);
-
- //
- // Remove current package's SPD file
- //
- fileSet.remove(packageId.getSpdFile());
-
- files.addAll(fileSet);
-
- Iterator<File> iter = fileSet.iterator();
- List<FarFileItem> contents = new ArrayList<FarFileItem>();
- while (iter.hasNext()) {
- File normalFile = iter.next();
- String fileRelativePath = Tools.getRelativePath(normalFile.getPath(), pkgDir);
- ffItem = new FarFileItem(fileRelativePath, FarMd5.md5(normalFile));
- contents.add(ffItem);
- }
-
- farPackage.setContentList(contents);
-
- // List<FarPlatformItem> fpfList = new ArrayList<FarPlatformItem>();
- //
- // iter = fpdFileSet.iterator();
- //
- // while (iter.hasNext()) {
- // File fpdFile = iter.next();
- // PlatformIdentification platformId = new PlatformIdentification(wsTool
- // .getId(fpdFile.getPath(), OpenFile.openFpdFile(fpdFile
- // .getPath())));
- // addPlatformIdToFarPlatformItemList(fpfList, platformId);
- // }
- // farPackage.setFarPlatformList(fpfList);
- fPkgList.add(farPackage);
- }
-
- private void recursiveDirectory(Set<File> files, Set<File> fpds, File dir, Set<String> fileFilter) {
- if (isFilter(dir, fileFilter)) {
- return;
- }
- File[] allFilesInDir = dir.listFiles();
- for (int i = 0; i < allFilesInDir.length; i++) {
- if (allFilesInDir[i].isFile()) {
- if (isFilter(allFilesInDir[i], fileFilter)) {
- continue;
- }
- // if (allFilesInDir[i].getPath().toLowerCase().endsWith(".fpd")) {
- // fpds.add(allFilesInDir[i]);
- // } else {
- files.add(allFilesInDir[i]);
- // }
- } else {
- recursiveDirectory(files, fpds, allFilesInDir[i], fileFilter);
- }
- }
- }
-
- public void addPlatformIdToFarPlatformItemList(PlatformIdentification platformId) throws Exception {
- files.add(platformId.getFpdFile());
-
- FarPlatformItem fpfItem = new FarPlatformItem();
- FarFileItem ffItem;
- String fpfPath = platformId.getPath();
- File fpfFile = new File(fpfPath);
- //
- // Add farFileName
- //
- ffItem = new FarFileItem(Tools.getRelativePath(fpfFile.getPath(), Workspace.getCurrentWorkspace()),
- FarMd5.md5(fpfFile));
- fpfItem.setFarFile(ffItem);
-
- //
- // Add guid value
- //
- fpfItem.setGuidValue(platformId.getGuid());
-
- //
- // Add version
- //
- fpfItem.setVersion(platformId.getVersion());
-
- fPlfList.add(fpfItem);
- }
-
- /**
- *
- * @param
- * @return Set<PackageIdentification> list of PackageIdentification.
- */
- public List<PackageIdentification> getPackageList() throws Exception {
- //
- // PackageIdentification set.
- //
- List<PackageIdentification> pkgList = new ArrayList<PackageIdentification>();
- //
- //
- //
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- FarPackage fPkg = (FarPackage) pkgItem.next();
- //
- // Get package information from SPD file and create a package
- // identification.
- //
-
- PackageIdentification pkgId = new PackageIdentification(fPkg.getFarFile().getRelativeFilename(),
- fPkg.getGuidValue(), fPkg.getVersion());
- pkgId.setPath(Workspace.getCurrentWorkspace() + File.separatorChar + fPkg.getDefaultPath()
- + File.separatorChar + fPkg.getFarFile().getRelativeFilename());
- // wsTool.getId(
- // Workspace.getCurrentWorkspace() + File.separatorChar
- // + fPkg.getDefaultPath(), OpenFile
- // .openFpdFile(Workspace.getCurrentWorkspace()
- // + File.separatorChar
- // + fPkg.getDefaultPath()
- // + File.separatorChar
- // + fPkg.getFarFile().getRelativeFilename()));
- pkgList.add(pkgId);
- }
- return pkgList;
- }
-
- /**
- *
- */
- public List<PlatformIdentification> getPlatformList() throws Exception, IOException, XmlException {
- //
- // PlatformIdentification set.
- //
- List<PlatformIdentification> plfList = new ArrayList<PlatformIdentification>();
- Iterator plfItem = this.fPlfList.iterator();
- while (plfItem.hasNext()) {
- FarPlatformItem fpfItem = (FarPlatformItem) plfItem.next();
- File file = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + fpfItem.getFarFile().getRelativeFilename());
- //
- // Set platformIdentificaiton's path as absolutly path (include
- // workspace and FPD relatively path)
- //
- PlatformIdentification plfId = new PlatformIdentification(fpfItem.getFarFile().getRelativeFilename(),
- fpfItem.getGuidValue(), fpfItem.getVersion(),
- file.getPath());
-
- // (PlatformIdentification) wsTool
- // .getId(file.getParent(), OpenFile.openFpdFile(Workspace
- // .getCurrentWorkspace()
- // + File.separatorChar
- // + fpfItem.getFarFile().getRelativeFilename()));
- plfList.add(plfId);
- }
- return plfList;
- }
-
- public List<FarFileItem> getPlatformContents(PlatformIdentification platformId) {
- List<FarFileItem> result = new ArrayList<FarFileItem>();
- Iterator<FarPlatformItem> iter = this.fPlfList.iterator();
-
- while (iter.hasNext()) {
- FarPlatformItem item = iter.next();
- if (item.isIdentityPlf(platformId)) {
- FarFileItem farFileItem = item.getFarFile();
- farFileItem.setDefaultPath(farFileItem.getRelativeFilename());
- farFileItem.setRelativeFilename(Tools.getFileNameOnly(farFileItem.getRelativeFilename()));
- result.add(farFileItem);
- break;
- }
- }
- return result;
- }
-
- public List<FarFileItem> getPackageContents(PackageIdentification packageId) {
- List<FarFileItem> farFileList = new ArrayList<FarFileItem>();
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
- if (pkg.isIdentityPkg(packageId)) {
- //
- // Add spd far file to list.
- //
- farFileList.add(pkg.getFarFile());
- //
- // Add all files in contents to list.
- //
- farFileList.addAll(pkg.getContentList());
- //
- // Add all farfiles in <FarPlatformList> to list.
- //
- // List<FarPlatformItem> plfList = pkg.getFarPlatformList();
- // Iterator plfItem = plfList.iterator();
- // while (plfItem.hasNext()) {
- // farFileList.add(((FarPlatformItem) plfItem.next())
- // .getFarFile());
- // }
-
- Iterator<FarFileItem> ffIter = farFileList.iterator();
- while (ffIter.hasNext()) {
- FarFileItem ffItem = ffIter.next();
- ffItem.setDefaultPath(pkg.getDefaultPath() + File.separatorChar + ffItem.getRelativeFilename());
- }
- break;
- }
- }
-
- return farFileList;
- }
-
- /**
- *
- * @param pkgId
- * @return String: return string represent jar file entry;
- */
- public String[] getPackgeSpd(PackageIdentification pkgId) {
- Iterator pkgItem = this.fPkgList.iterator();
- String[] entryStr = new String[2];
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
- if (pkg.isIdentityPkg(pkgId)) {
- entryStr[0] = pkg.getFarFile().getRelativeFilename();
- entryStr[1] = pkg.getDefaultPath();
- return entryStr;
- }
- }
- return null;
- }
-
- public List<FarFileItem> getPackageContents() {
- //
- // In this farFilelist,all FarFileItem's relativeFileName should be
- // set as absolutely path.
- //
- List<FarFileItem> farFileList = new ArrayList<FarFileItem>();
- Iterator pkgItem = this.fPkgList.iterator();
- FarFileItem ffItem = null;
-
- while (pkgItem.hasNext()) {
- FarPackage pkg = (FarPackage) pkgItem.next();
-
- //
- // Add spd far file to list.
- //
- ffItem = pkg.getFarFile();
- //
- // Set farFileItem relativeFileName = absolutePath + file Name.
- //
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separatorChar + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- //
- // Add all files in contents to list.
- //
- Iterator contentsItem = pkg.getContentList().iterator();
- while (contentsItem.hasNext()) {
- ffItem = (FarFileItem) contentsItem.next();
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separator + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- }
- //
- // Add all farfiles in <FarPlatformList> to list.
- //
- List<FarPlatformItem> plfList = pkg.getFarPlatformList();
- Iterator plfItem = plfList.iterator();
- while (plfItem.hasNext()) {
- ffItem = ((FarPlatformItem) plfItem.next()).getFarFile();
- farFileList.add(new FarFileItem(pkg.getDefaultPath() + File.separator + ffItem.getRelativeFilename(),
- ffItem.getMd5Value()));
- }
- }
- return farFileList;
- }
-
- public String getPackageDefaultPath(PackageIdentification packageId) {
- Iterator pkgItr = this.fPkgList.iterator();
- while (pkgItr.hasNext()) {
- FarPackage farPackage = (FarPackage) pkgItr.next();
- if (farPackage.isIdentityPkg(packageId)) {
- return farPackage.getDefaultPath();
- }
- }
- return null;
- }
-
- // public void setPackageInstallPath(PackageIdentification packageId, String path) {
- // Iterator<FarPackage> pkgItr = this.fPkgList.iterator();
- // while (pkgItr.hasNext()) {
- // FarPackage farPackage = pkgItr.next();
- // if (farPackage.isIdentityPkg(packageId)) {
- // farPackage.setDefaultPath(path);
- // return ;
- // }
- // }
- // }
- //
- // public void setPlatformInstallPath(PlatformIdentification platformId, String path) {
- // Iterator<FarPlatformItem> plfItr = this.fPlfList.iterator();
- // while (plfItr.hasNext()) {
- // FarPlatformItem farPlatform = plfItr.next();
- // if (farPlatform.i.isIdentity(platformId)) {
- // farPackage.setDefaultPath(path);
- // return ;
- // }
- // }
- // }
-
- public List<FarFileItem> getAllFileItem() {
- //
- // The farFileName in this list are all abosulte path.
- //
- List<FarFileItem> ffiList = new ArrayList<FarFileItem>();
- //
- // Add far files in <FarPackageList> to list.
- //
- ffiList = this.getPackageContents();
-
- //
- // Add far files in <FarPlatformList> to list
- //
- NodeList elementList = this.manifestDoc.getElementsByTagName(farPlatformList);
- for (int i = 0; i < elementList.getLength(); i++) {
- //
- // Get <farPlatform> node list.
- //
- Node item = elementList.item(i);
- NodeList plfElements = item.getChildNodes();
- for (int j = 0; j < plfElements.getLength(); j++) {
- //
- // Get each <FarPlatform> content.
- //
- NodeList plfChildNode = plfElements.item(i).getChildNodes();
- Node tempNode = null;
- for (int t = 0; t < plfChildNode.getLength(); t++) {
- tempNode = plfChildNode.item(t);
- //
- // Get child node value and set to platformIdentification.
- //
- if (tempNode.getNodeName().equalsIgnoreCase(farPackage_FarfileName)) {
- NamedNodeMap farAttr = tempNode.getAttributes();
- //
- // Change relative path to absolute one
- //
- FarFileItem farFile = new FarFileItem(tempNode.getTextContent(),
- farAttr.getNamedItem(farFileName_Md5sum).getTextContent());
- ffiList.add(farFile);
- }
- }
- }
- }
- return ffiList;
- }
-
- public void hibernateToFile() throws Exception {
- //
- // create manifest root node
- //
- Element rootNode = this.manifestDoc.createElement("FrameworkArchiveManifest");
- this.manifestDoc.appendChild(rootNode);
-
- //
- // create manifest header node
- //
- Element headerNode = this.manifestDoc.createElement(farHeader);
- rootNode.appendChild(headerNode);
- //
- // Add FarHeader to headerNode.
- //
- Element farName = this.manifestDoc.createElement(farHeader_FarName);
- farName.setTextContent(this.fhInfo.getFarName());
- headerNode.appendChild(farName);
-
- Element gv = this.manifestDoc.createElement(guidValue);
- gv.setTextContent(this.fhInfo.getGuidValue());
- headerNode.appendChild(gv);
-
- Element ver = this.manifestDoc.createElement(version);
- ver.setTextContent(this.fhInfo.getVersion());
- headerNode.appendChild(ver);
-
- Element abstra = this.manifestDoc.createElement(farHeader_Abstract);
- abstra.setTextContent(this.fhInfo.getAbstractStr());
- headerNode.appendChild(abstra);
-
- Element descr = this.manifestDoc.createElement(farHeader_Description);
- descr.setTextContent(this.fhInfo.getDescription());
- headerNode.appendChild(descr);
-
- Element copyright = this.manifestDoc.createElement(farHeader_CopyRight);
- copyright.setTextContent(this.fhInfo.getCopyright());
- headerNode.appendChild(copyright);
-
- Element license = this.manifestDoc.createElement(farHeader_License);
- license.setTextContent(this.fhInfo.getLicense());
- headerNode.appendChild(license);
-
- Element spec = this.manifestDoc.createElement(farHeader_Specification);
- spec.setTextContent(this.fhInfo.getSpecification());
- System.out.println(this.fhInfo.getSpecification());
- headerNode.appendChild(spec);
-
- //
- // create manifest FarPackageList node
- //
- Element pkgListNode = this.manifestDoc.createElement(farPackageList);
- rootNode.appendChild(pkgListNode);
-
- //
- // Save each item in farPackage list to <FarPackage>.
- //
- Iterator pkgItem = this.fPkgList.iterator();
- while (pkgItem.hasNext()) {
- pkgToFarPkgNode(pkgListNode, (FarPackage) pkgItem.next());
-
- }
-
- //
- // create manifest FarPlatformList node
- //
- Element plfListNode = this.manifestDoc.createElement(farPlatformList);
- rootNode.appendChild(plfListNode);
-
- //
- // Save farPakcage list info to <FarPackageList> node
- //
- Iterator plfItem = this.fPlfList.iterator();
- while (plfItem.hasNext()) {
- FarPlatformItem plfIterator = (FarPlatformItem) plfItem.next();
- PlfToPlatformNode(plfListNode, plfIterator);
- }
-
- //
- // Write the DOM document to the file
- //
- Transformer xformer = TransformerFactory.newInstance().newTransformer();
- xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
- xformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
- //
- // Prepare the DOM document for writing
- //
- Source source = new DOMSource(this.manifestDoc);
- //
- // Prepare the output file, get the Mainifest file name from <FarHeader>
- // <FarName>.
- //
- this.mfFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar + mfFileName);
- //
- // generate all directory path
- //
- Result result = new StreamResult(this.mfFile);
- xformer.transform(source, result);
- //
- // Close result. Flush file by manual for Jdk1.5.0_04.
- //
- ((StreamResult) result).getOutputStream().close();
- }
-
- public void pkgToFarPkgNode(Element parentNode, FarPackage pkgItem) {
- Element pkgNode = this.manifestDoc.createElement(farPackageList_FarPackage);
- //
- // Add <FarFileName>
- //
- ffiToFfNode(pkgNode, pkgItem.getFarFile());
- //
- // Add <GuidValue>
- //
- setStrItemToNode(pkgNode, pkgItem.getGuidValue(), guidValue);
- //
- // Add <Version>
- //
- setStrItemToNode(pkgNode, pkgItem.getVersion(), version);
- //
- // Add <DefaultPath>
- //
- setStrItemToNode(pkgNode, pkgItem.getDefaultPath(), farPackage_DefaultPath);
-
- //
- // Add <Contents>
- //
- Element contentNode = this.manifestDoc.createElement(contents);
- Iterator iterator = pkgItem.getContentList().iterator();
- while (iterator.hasNext()) {
- ffiToFfNode(contentNode, (FarFileItem) iterator.next());
- }
- pkgNode.appendChild(contentNode);
- parentNode.appendChild(pkgNode);
- }
-
- public void PlfToPlatformNode(Element parentNode, FarPlatformItem fplItem) {
- Element fplNode = this.manifestDoc.createElement(farPlatformList_FarPlatform);
- //
- // Add <FarFileName>
- //
- ffiToFfNode(fplNode, fplItem.getFarFile());
- //
- // Add <GuidValue>
- //
- setStrItemToNode(fplNode, fplItem.getGuidValue(), guidValue);
- //
- // Add <Version>
- //
- setStrItemToNode(fplNode, fplItem.getVersion(), version);
- //
- // Add to <PlatformList>
- //
- parentNode.appendChild(fplNode);
-
- }
-
- public void ffiToFfNode(Element parentNode, FarFileItem ffi) {
- Element farFileName = this.manifestDoc.createElement(farPackage_FarfileName);
- farFileName.setTextContent(ffi.getRelativeFilename());
- System.out.println(farFileName.getTextContent());
- System.out.println(ffi.getRelativeFilename());
- farFileName.setAttribute(farFileName_Md5sum, ffi.getMd5Value());
- parentNode.appendChild(farFileName);
- }
-
- public void setStrItemToNode(Element parentNode, String strValue, String strName) {
- Element node = this.manifestDoc.createElement(strName);
- node.setTextContent(strValue);
- parentNode.appendChild(node);
- }
-
- private void parseManifest() {
-
- //
- // Parse header
- //
- parseMfHeader();
- //
- // parse <farPackageList>
- //
- parseHeaderFarPackageList();
-
- //
- // parse <farPlatformList>
- //
- NodeList ele = this.manifestDoc.getElementsByTagName(farPlatformList);
- Node plfNode;
- if (ele.getLength() > 0) {
- //
- // Only have one <FarPlatformList> node under manifest root node.
- //
- plfNode = ele.item(0);
- parseFarPlatformList(plfNode, this.fPlfList);
- }
- }
-
- private void parseMfHeader() {
- Node headerNode;
- NodeList ele = this.manifestDoc.getElementsByTagName(farHeader);
- if (ele.getLength() > 0) {
- //
- // For manifest file only have one <FarHeader>
- //
- headerNode = ele.item(0);
- } else {
- return;
- }
- NodeList childList = headerNode.getChildNodes();
- Node node = null;
- String nodeName = null;
- for (int i = 0; i < childList.getLength(); i++) {
- node = childList.item(i);
- nodeName = node.getNodeName();
- if (nodeName.equalsIgnoreCase(farHeader_FarName)) {
- String nodeValue = node.getTextContent();
- this.fhInfo.setFarName(nodeValue);
- } else if (nodeName.equalsIgnoreCase(guidValue)) {
- this.fhInfo.setGuidValue(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(version)) {
- this.fhInfo.setVersion(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Abstract)) {
- this.fhInfo.setAbstractStr(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Description)) {
- this.fhInfo.setDescription(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_CopyRight)) {
- this.fhInfo.setCopyright(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_License)) {
- this.fhInfo.setLicense(node.getTextContent());
- } else if (nodeName.equalsIgnoreCase(farHeader_Specification)) {
- this.fhInfo.setSpecification(node.getTextContent());
- }
- }
- }
-
- public void parseHeaderFarPackageList() {
- Node farPkgNode;
- NodeList ele = this.manifestDoc.getElementsByTagName(farPackageList);
- if (ele.getLength() > 0) {
- //
- // For manifest file only have one <FarHeader>
- //
- farPkgNode = ele.item(0);
- } else {
- return;
- }
- NodeList fpnList = farPkgNode.getChildNodes();
- for (int i = 0; i < fpnList.getLength(); i++) {
- if (fpnList.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- FarPackage fpItem = new FarPackage();
- parseFarPackage(fpnList.item(i), fpItem);
- this.fPkgList.add(fpItem);
- }
- }
-
- public void parseFarPackage(Node farPkgNode, FarPackage fpItem) {
- NodeList childList = farPkgNode.getChildNodes();
- Node childNode;
- String childName;
- for (int i = 0; i < childList.getLength(); i++) {
- childNode = childList.item(i);
- childName = childNode.getNodeName();
- if (childName.equalsIgnoreCase(farPackage_FarfileName)) {
- fpItem.setFarFile(parseFarFile(childNode));
- } else if (childName.equalsIgnoreCase(guidValue)) {
- fpItem.setGuidValue(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(version)) {
- fpItem.setVersion(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(farPackage_DefaultPath)) {
- fpItem.setDefaultPath(childNode.getTextContent());
- } else if (childName.equalsIgnoreCase(farPlatformList)) {
- List<FarPlatformItem> plfList = new ArrayList<FarPlatformItem>();
- parseFarPlatformList(childNode, plfList);
- fpItem.setFarPlatformList(plfList);
- } else if (childName.equalsIgnoreCase(contents)) {
- List<FarFileItem> ffList = new ArrayList<FarFileItem>();
- parseContents(childNode, ffList);
- fpItem.setContentList(ffList);
- }
- }
- }
-
- /**
- *
- * @param fpfListNode
- * @param plfList
- */
- public void parseFarPlatformList(Node fpfListNode, List<FarPlatformItem> plfList) {
- //
- // Get <FarPlatform> list.
- //
- NodeList child = fpfListNode.getChildNodes();
- Node farPlfNode;
- for (int i = 0; i < child.getLength(); i++) {
- if (child.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- farPlfNode = child.item(i);
- plfList.add(parseFarPlatform(farPlfNode));
- }
- }
-
- /**
- *
- * @param fpfNode
- * @return
- */
- public FarPlatformItem parseFarPlatform(Node fpfNode) {
- //
- // New FarPlatformItem.
- //
- FarPlatformItem fplItem = new FarPlatformItem();
- //
- // Get <FarPlatform> elements;
- //
- NodeList childList = fpfNode.getChildNodes();
- Node child;
- String nodeName;
- for (int i = 0; i < childList.getLength(); i++) {
- child = childList.item(i);
- nodeName = child.getNodeName();
- if (nodeName.equalsIgnoreCase(farPackage_FarfileName)) {
- fplItem.setFarFile(parseFarFile(child));
- } else if (nodeName.equalsIgnoreCase(guidValue)) {
- fplItem.setGuidValue(child.getTextContent());
- } else if (nodeName.equalsIgnoreCase(version)) {
- fplItem.setVersion(child.getTextContent());
- }
- }
-
- return fplItem;
- }
-
- public void parseContents(Node contentsNode, List<FarFileItem> ffList) {
- NodeList contentList = contentsNode.getChildNodes();
- Node contentNode;
- for (int i = 0; i < contentList.getLength(); i++) {
- if (contentList.item(i).getNodeType() == Node.TEXT_NODE) {
- continue;
- }
- contentNode = contentList.item(i);
- //
- // Parse each <FarFileName>.
- //
- ffList.add(parseFarFile(contentNode));
- }
- }
-
- public FarFileItem parseFarFile(Node farFileNode) {
- String ffName = farFileNode.getTextContent();
- NamedNodeMap attr = farFileNode.getAttributes();
- FarFileItem ffItem = new FarFileItem(ffName, attr.getNamedItem(farFileName_Md5sum).getTextContent());
- return ffItem;
- }
-
- public boolean isFilter(File file, Set<String> fileter) {
- Iterator<String> iter = fileter.iterator();
- while (iter.hasNext()) {
- Pattern pattern = Pattern.compile(iter.next());
- Matcher matcher = pattern.matcher(file.getName());
-
- if (matcher.find()) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java
deleted file mode 100644
index 28af114a5b..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/ManifestInterface.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @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.frameworkwizard.far;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.xmlbeans.XmlException;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-
-public interface ManifestInterface {
-
- public void createManifest(List<PackageIdentification> pkgList, List<PlatformIdentification> plfList,
- Set<String> fileFilter) throws Exception;
-
- public void setManifestFile(File manifestFile) throws Exception;
-
- public List<PackageIdentification> getPackageList() throws Exception;
-
- public List<PlatformIdentification> getPlatformList() throws Exception, IOException, XmlException;
-
- public List<FarFileItem> getPackageContents(PackageIdentification packageId);
-
- public String getPackageDefaultPath(PackageIdentification packageId);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java
deleted file mode 100644
index f76af054ba..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQuery.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/** @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.frameworkwizard.far;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.apache.xmlbeans.XmlObject;
-import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PackageDependenciesDocument;
-import org.tianocore.PackageSurfaceAreaDocument;
-import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
-import org.tianocore.frameworkwizard.common.OpenFile;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class PackageQuery implements PackageQueryInterface {
-
- public PackageIdentification getPackageIdentification(File spdFile) {
- PackageIdentification packageId = null;
- try {
- String path = spdFile.getPath();
- packageId = Tools.getId(path, OpenFile.openSpdFile(path));
- } catch (Exception e) {
- e.printStackTrace();
- }
- return packageId;
- }
-
- public List<String> getPackageMsaList(InputStream spdInput) {
- List<String> result = new ArrayList<String>();
- try {
- PackageSurfaceAreaDocument spd = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdInput);
- result = spd.getPackageSurfaceArea().getMsaFiles().getFilenameList();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public List<PackageIdentification> getModuleDependencies(InputStream msaInput) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- try {
- ModuleSurfaceAreaDocument msa = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaInput);
- ModuleSurfaceAreaDocument.ModuleSurfaceArea sa = msa.getModuleSurfaceArea();
- if (sa == null) {
- return result;
- }
- PackageDependenciesDocument.PackageDependencies pkgDep = sa.getPackageDependencies();
- if (pkgDep == null) {
- return result;
- }
- List<PackageDependenciesDocument.PackageDependencies.Package> list = pkgDep.getPackageList();
- Iterator<PackageDependenciesDocument.PackageDependencies.Package> iter = list.iterator();
- while (iter.hasNext()) {
- PackageDependenciesDocument.PackageDependencies.Package item = iter.next();
- PackageIdentification packageId = new PackageIdentification(null, item.getPackageGuid(),
- item.getPackageVersion());
- result.add(packageId);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- public List<File> getPackageMsaList(File spdFile) {
- List<File> result = new Vector<File>();
- WorkspaceTools wt = new WorkspaceTools();
- List<String> v = wt.getAllModulesOfPackage(spdFile.getPath());
- Iterator<String> iter = v.iterator();
- while (iter.hasNext()) {
- result.add(new File(iter.next()));
- }
- return result;
- }
-
- public List<PackageIdentification> getPackageDependencies(File spdFile) {
- List<File> msaFiles = getPackageMsaList(spdFile);
- return getPackageDependencies(msaFiles);
- }
-
- public List<PackageIdentification> getPackageDependencies(List<File> msaFiles) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- Iterator<File> iter = msaFiles.iterator();
- while (iter.hasNext()) {
- result = AggregationOperation.union(result, getModuleDependencies(iter.next()));
- }
- return result;
- }
-
- public List<PackageIdentification> getModuleDependencies(File msaFile) {
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- try {
- ModuleSurfaceArea msa = OpenFile.openMsaFile(msaFile.getPath());
- List<PackageDependenciesDocument.PackageDependencies.Package> p = msa.getPackageDependencies()
- .getPackageList();
- Iterator<PackageDependenciesDocument.PackageDependencies.Package> iter = p.iterator();
- while (iter.hasNext()) {
- PackageDependenciesDocument.PackageDependencies.Package item = iter.next();
- PackageIdentification packageId = new PackageIdentification(null, item.getPackageGuid(),
- item.getPackageVersion());
- if (!AggregationOperation.belongs(packageId, result)) {
- result.add(packageId);
- }
- }
- } catch (Exception e) {
- }
- return result;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java
deleted file mode 100644
index e8644ebbf7..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/** @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.frameworkwizard.far;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.List;
-
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-
-public interface PackageQueryInterface {
-
- public PackageIdentification getPackageIdentification(File spdFile);
-
- public List<File> getPackageMsaList(File spdFile);
-
- public List<String> getPackageMsaList(InputStream spdInput);
-
- public List<PackageIdentification> getPackageDependencies(File spdFile);
-
- public List<PackageIdentification> getPackageDependencies(List<File> msaFiles);
-
- public List<PackageIdentification> getModuleDependencies(InputStream msaInput);
-
- public List<PackageIdentification> getModuleDependencies(File msaFile);
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java
deleted file mode 100644
index ab2ffd07ee..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/** @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.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IDefaultTableModel;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.far.PackageQuery;
-import org.tianocore.frameworkwizard.far.PackageQueryInterface;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-public class CreateStepFour extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -7397213364965470902L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextAreaInstruction = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel2 = null;
-
- private JTextField jTextFieldSaveToFile = null;
-
- private JButton jButtonBrowser = null;
-
- // private JScrollPane jScrollPane = null;
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private IDefaultTableModel model = null;
-
- private CreateStepThree stepThree = null;
-
- // private JTable jTable = null;
- public CreateStepFour(IDialog iDialog, boolean modal, CreateStepThree stepThree) {
- this(iDialog, modal);
- this.stepThree = stepThree;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextAreaInstruction == null) {
- jTextAreaInstruction = new JTextArea();
- jTextAreaInstruction.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextAreaInstruction.setText("Step 4: Choose a file \n");
- jTextAreaInstruction.setEditable(false);
- }
- return jTextAreaInstruction;
- }
-
- /**
- * This method initializes jTextField1
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField1() {
- if (jTextFieldSaveToFile == null) {
- jTextFieldSaveToFile = new JTextField();
- jTextFieldSaveToFile.setBounds(new java.awt.Rectangle(147,70,412,20));
- }
- return jTextFieldSaveToFile;
- }
-
- /**
- * This method initializes jButtonBrowser
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrower() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 70, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- // private JScrollPane getJScrollPane() {
- // if (jScrollPane == null) {
- // jScrollPane = new JScrollPane();
- // jScrollPane.setBounds(new java.awt.Rectangle(139,85,500,100));
- // jScrollPane.setViewportView(getJTable());
- // }
- // return jScrollPane;
- // }
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- jButtonPrevious.setVisible(true);
- }
- return jButtonPrevious;
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepFour(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_FOUR_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(30,70,111,18));
- jLabel2.setText("File to Save: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(29,108,320,20));
- jLabel.setText("This FAR will depend on the following packages: ");
- jLabel.setVisible(false);
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- // jContentPane.add(getJScrollPane(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(getJTextField1(), null);
- jContentPane.add(getJButtonBrower(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonFinish) {
- //
- // Add some logic process here
- // Guid Check, File Check etc.
- //
- if (this.jTextFieldSaveToFile.getText() == null) {
- Log.wrn("Create far", "Please input the Far name!");
- }
- try {
- //
- // Create an output stream for JAR
- //
-
- Far far = new Far(new File(this.jTextFieldSaveToFile.getText()));
-
- far.creatFar(this.getPreviousStep().getPreviousStep().getSelectedPackages(),
- this.getPreviousStep().getPreviousStep().getSelectedPlatforms(), this.getPreviousStep()
- .getFileFilter(),
- this.getPreviousStep().getPreviousStep().getPreviousStep().getFarHeader());
- } catch (Exception exp) {
- Log.wrn("Create far", exp.getMessage());
- Log.err("Create far", exp.getMessage());
- return;
- }
- getPreviousStep().getPreviousStep().getPreviousStep().returnType = DataType.RETURN_TYPE_OK;
- getPreviousStep().getPreviousStep().dispose();
- getPreviousStep().dispose();
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showSaveDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldSaveToFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepThree.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public CreateStepThree getPreviousStep() {
- return stepThree;
- }
-
- public void prepareTable() {
- model.setRowCount(0);
-
- List<PackageIdentification> packageList = new ArrayList<PackageIdentification>();
- //
- // Change here to get packages and platforms from FAR
- //
- List<PackageIdentification> selectedPackages = getPreviousStep().getPreviousStep().getSelectedPackages();
- PackageQueryInterface pq = new PackageQuery();
-
- Iterator<PackageIdentification> iter = selectedPackages.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- List<PackageIdentification> list = pq.getPackageDependencies(item.getSpdFile());
- packageList = AggregationOperation.union(list, packageList);
- }
-
- packageList = AggregationOperation.minus(packageList, selectedPackages);
-
- iter = packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[3];
- PackageIdentification item = iter.next();
- str[2] = item.getName();
- str[1] = item.getVersion();
- str[0] = item.getGuid();
- model.addRow(str);
- }
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java
deleted file mode 100644
index 0126b96f38..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java
+++ /dev/null
@@ -1,641 +0,0 @@
-/** @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.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataValidation;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.common.ui.StarLabel;
-import org.tianocore.frameworkwizard.far.FarHeader;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-
-public class CreateStepOne extends IDialog implements MouseListener {
-
- // /
- // / Define class Serial Version UID
- // /
- private static final long serialVersionUID = -8152099582923006900L;
-
- //
- // Define class members
- //
- private JPanel jContentPane = null;
-
- 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 JLabel jLabelDescription = null;
-
- private JTextArea jTextAreaDescription = null;
-
- private JLabel jLabelSpecification = null;
-
- private JTextField jTextFieldSpecification = null;
-
- private JButton jButtonOk = null;
-
- private JScrollPane jScrollPaneLicense = null;
-
- private JScrollPane jScrollPaneDescription = null;
-
- private JLabel jLabelAbstract = null;
-
- private JTextField jTextFieldAbstract = null;
-
- private StarLabel jStarLabel1 = null;
-
- private StarLabel jStarLabel4 = null;
-
- private StarLabel jStarLabel5 = null;
-
- private StarLabel jStarLabel6 = null;
-
- private StarLabel jStarLabel7 = null;
-
- private StarLabel jStarLabel8 = null;
-
- private StarLabel jStarLabel10 = null;
-
- private StarLabel jStarLabel12 = null;
-
- private JLabel jLabelURL = null;
-
- private JTextField jTextFieldURL = null;
-
- private JScrollPane jScrollPane = null;
-
- private CreateStepTwo stepTwo = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private FarHeader farHeader = new FarHeader();
-
- private JScrollPane jScrollPaneCopyright = null;
-
- private JTextArea jTextAreaCopyright = null;
-
- /**
- * This method initializes jTextFieldBaseName
- *
- * @return javax.swing.JTextField jTextFieldBaseName
- *
- */
- private JTextField getJTextFieldBaseName() {
- if (jTextFieldBaseName == null) {
- jTextFieldBaseName = new JTextField();
- jTextFieldBaseName.setBounds(new java.awt.Rectangle(160, 10, 520, 20));
- jTextFieldBaseName.setToolTipText("A brief Identifier, such as USB I/O Drivers, of the Framework Archive.");
- }
- return jTextFieldBaseName;
- }
-
- /**
- * This method initializes jTextFieldGuid
- *
- * @return javax.swing.JTextField jTextFieldGuid
- *
- */
- private JTextField getJTextFieldGuid() {
- if (jTextFieldGuid == null) {
- jTextFieldGuid = new JTextField();
- jTextFieldGuid.setBounds(new java.awt.Rectangle(160, 35, 410, 20));
- jTextFieldGuid.setToolTipText("Guaranteed Unique Identification Number (8-4-4-4-12)");
- }
- return jTextFieldGuid;
- }
-
- /**
- * This method initializes jTextFieldVersion
- *
- * @return javax.swing.JTextField jTextFieldVersion
- *
- */
- private JTextField getJTextFieldVersion() {
- if (jTextFieldVersion == null) {
- jTextFieldVersion = new JTextField();
- jTextFieldVersion.setBounds(new java.awt.Rectangle(160, 60, 520, 20));
- jTextFieldVersion.setToolTipText("A Version Number, 1.0, 1, 1.01");
- }
- return jTextFieldVersion;
- }
-
- /**
- * This method initializes jButtonGenerateGuid
- *
- * @return javax.swing.JButton jButtonGenerateGuid
- *
- */
- private JButton getJButtonGenerateGuid() {
- if (jButtonGenerateGuid == null) {
- jButtonGenerateGuid = new JButton();
- jButtonGenerateGuid.setBounds(new java.awt.Rectangle(590, 35, 90, 20));
- jButtonGenerateGuid.setText("Generate");
- jButtonGenerateGuid.addMouseListener(this);
- }
- return jButtonGenerateGuid;
- }
-
- /**
- * This method initializes jTextAreaLicense
- *
- * @return javax.swing.JTextArea jTextAreaLicense
- *
- */
- private JTextArea getJTextAreaLicense() {
- if (jTextAreaLicense == null) {
- jTextAreaLicense = new JTextArea();
- jTextAreaLicense.setText("");
- jTextAreaLicense.setLineWrap(true);
- jTextAreaLicense.setWrapStyleWord(true);
- jTextAreaLicense.setToolTipText("The License for this FAR file.");
- }
- return jTextAreaLicense;
- }
-
- /**
- * This method initializes jTextAreaDescription
- *
- * @return javax.swing.JTextArea jTextAreaDescription
- *
- */
- private JTextArea getJTextAreaDescription() {
- if (jTextAreaDescription == null) {
- jTextAreaDescription = new JTextArea();
- jTextAreaDescription.setLineWrap(true);
- jTextAreaDescription.setWrapStyleWord(true);
- jTextAreaDescription.setToolTipText("A verbose description of the FAR contents.");
- }
- return jTextAreaDescription;
- }
-
- /**
- * This method initializes jTextFieldSpecification
- *
- * @return javax.swing.JTextField jTextFieldSpecification
- *
- */
- private JTextField getJTextFieldSpecification() {
- if (jTextFieldSpecification == null) {
- jTextFieldSpecification = new JTextField();
- jTextFieldSpecification.setText("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
- jTextFieldSpecification.setBounds(new java.awt.Rectangle(160, 310, 520, 20));
- jTextFieldSpecification.setEditable(false);
- }
- return jTextFieldSpecification;
- }
-
- /**
- * This method initializes jScrollPaneLicense
- *
- * @return javax.swing.JScrollPane jScrollPaneLicense
- *
- */
- private JScrollPane getJScrollPaneLicense() {
- if (jScrollPaneLicense == null) {
- jScrollPaneLicense = new JScrollPane();
- jScrollPaneLicense.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneLicense.setBounds(new java.awt.Rectangle(160, 220, 520, 60));
- jScrollPaneLicense.setViewportView(getJTextAreaLicense());
- }
- return jScrollPaneLicense;
- }
-
- /**
- * This method initializes jScrollPaneDescription
- *
- * @return javax.swing.JScrollPane jScrollPaneDescription
- *
- */
- private JScrollPane getJScrollPaneDescription() {
- if (jScrollPaneDescription == null) {
- jScrollPaneDescription = new JScrollPane();
- jScrollPaneDescription.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
- jScrollPaneDescription.setBounds(new java.awt.Rectangle(160, 110, 520, 60));
- jScrollPaneDescription.setViewportView(getJTextAreaDescription());
- }
- return jScrollPaneDescription;
- }
-
- /**
- * This method initializes jTextFieldAbstract
- *
- * @return javax.swing.JTextField jTextFieldAbstract
- *
- */
- private JTextField getJTextFieldAbstract() {
- if (jTextFieldAbstract == null) {
- jTextFieldAbstract = new JTextField();
- jTextFieldAbstract.setBounds(new java.awt.Rectangle(160, 85, 520, 20));
- jTextFieldAbstract.setToolTipText("A one sentence description of this FAR package.");
- }
- return jTextFieldAbstract;
- }
-
- /**
- * This method initializes jTextFieldURL
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldURL() {
- if (jTextFieldURL == null) {
- jTextFieldURL = new JTextField();
- jTextFieldURL.setBounds(new java.awt.Rectangle(160, 285, 520, 20));
- jTextFieldURL.setToolTipText("A URL for the latest version of the license");
- }
- return jTextFieldURL;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setViewportView(getJContentPane());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jButtonCancel1
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(590, 350, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(480, 350, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jScrollPaneCopyright
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPaneCopyright() {
- if (jScrollPaneCopyright == null) {
- jScrollPaneCopyright = new JScrollPane();
- jScrollPaneCopyright.setBounds(new java.awt.Rectangle(160, 175, 520, 40));
- jScrollPaneCopyright.setViewportView(getJTextAreaCopyright());
- }
- return jScrollPaneCopyright;
- }
-
- /**
- * This method initializes jTextAreaCopyright
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextAreaCopyright() {
- if (jTextAreaCopyright == null) {
- jTextAreaCopyright = new JTextArea();
- }
- return jTextAreaCopyright;
- }
-
- public static void main(String[] args) {
- CreateStepOne c = new CreateStepOne(new IFrame(), true);
- c.setVisible(true);
- }
-
- /**
- * This is the default constructor
- *
- */
- public CreateStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * Disable all components when the mode is view
- *
- * @param isView
- * true - The view mode; false - The non-view mode
- *
- */
- public void setViewMode(boolean isView) {
- if (isView) {
- this.jTextFieldBaseName.setEnabled(!isView);
- this.jTextFieldGuid.setEnabled(!isView);
- this.jTextFieldVersion.setEnabled(!isView);
- this.jTextAreaLicense.setEnabled(!isView);
- this.jScrollPaneCopyright.setEnabled(!isView);
- this.jTextAreaCopyright.setEnabled(!isView);
- this.jTextAreaDescription.setEnabled(!isView);
- this.jTextFieldSpecification.setEnabled(!isView);
- this.jTextFieldAbstract.setEnabled(!isView);
- this.jButtonGenerateGuid.setEnabled(!isView);
- this.jButtonOk.setEnabled(!isView);
- }
- }
-
- /**
- * This method initializes this
- *
- */
- private void initialize() {
- this.setSize(700, 425);
- this.setContentPane(getJScrollPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_ONE_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel jContentPane
- *
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
-
- jLabelURL = new JLabel();
- jLabelURL.setText("License URL");
- jLabelURL.setBounds(new java.awt.Rectangle(35, 285, 120, 20));
- jLabelBaseName = new JLabel();
- jLabelBaseName.setText("FAR Name");
- jLabelBaseName.setBounds(new java.awt.Rectangle(35, 10, 120, 20));
- jLabelGuid = new JLabel();
- jLabelGuid.setText("Guid Value");
- jLabelGuid.setBounds(new java.awt.Rectangle(35, 35, 120, 20));
- jLabelVersion = new JLabel();
- jLabelVersion.setText("Version");
- jLabelVersion.setBounds(new java.awt.Rectangle(35, 60, 120, 20));
- jLabelAbstract = new JLabel();
- jLabelAbstract.setText("Abstract");
- jLabelAbstract.setBounds(new java.awt.Rectangle(35, 85, 120, 20));
- jLabelDescription = new JLabel();
- jLabelDescription.setText("Description");
- jLabelDescription.setBounds(new java.awt.Rectangle(35, 110, 120, 20));
- jLabelCopyright = new JLabel();
- jLabelCopyright.setText("Copyright");
- jLabelCopyright.setBounds(new java.awt.Rectangle(35, 175, 120, 20));
- jLabelLicense = new JLabel();
- jLabelLicense.setText("License");
- jLabelLicense.setBounds(new java.awt.Rectangle(35, 220, 120, 20));
- jLabelSpecification = new JLabel();
- jLabelSpecification.setText("Specification");
- jLabelSpecification.setBounds(new java.awt.Rectangle(35, 310, 120, 20));
-
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
-
- 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(jLabelSpecification, null);
- jContentPane.add(getJTextFieldSpecification(), null);
- jContentPane.add(getJScrollPaneLicense(), null);
- jContentPane.add(getJScrollPaneDescription(), null);
- jContentPane.add(jLabelAbstract, null);
- jContentPane.add(getJTextFieldAbstract(), null);
- jContentPane.add(jLabelURL, null);
- jContentPane.add(getJTextFieldURL(), null);
- jStarLabel1 = new StarLabel();
- jStarLabel1.setLocation(new java.awt.Point(20, 10));
- jStarLabel4 = new StarLabel();
- jStarLabel4.setLocation(new java.awt.Point(20, 35));
- jStarLabel5 = new StarLabel();
- jStarLabel5.setLocation(new java.awt.Point(20, 60));
- jStarLabel6 = new StarLabel();
- jStarLabel6.setLocation(new java.awt.Point(20, 110));
- jStarLabel7 = new StarLabel();
- jStarLabel7.setLocation(new java.awt.Point(20, 175));
- jStarLabel8 = new StarLabel();
- jStarLabel8.setLocation(new java.awt.Point(20, 220));
- jStarLabel10 = new StarLabel();
- jStarLabel10.setLocation(new java.awt.Point(20, 85));
- jStarLabel12 = new StarLabel();
- jStarLabel12.setLocation(new java.awt.Point(20, 310));
-
- jContentPane.add(jStarLabel1, null);
- jContentPane.add(jStarLabel4, null);
- jContentPane.add(jStarLabel5, null);
- jContentPane.add(jStarLabel6, null);
- jContentPane.add(jStarLabel7, null);
- jContentPane.add(jStarLabel8, null);
- jContentPane.add(jStarLabel10, null);
- jContentPane.add(jStarLabel12, null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJScrollPaneCopyright(), null);
- }
- return jContentPane;
- }
-
- public boolean valid() {
- //
- // Check BaseName
- //
- if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Create far", "FAR Name must be entered.");
- return false;
- }
- if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Create far", "Incorrect data type for FAR Name");
- return false;
- }
- farHeader.setFarName(this.jTextFieldBaseName.getText());
-
- //
- // Check Guid
- //
- if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Create far", "A GUID must be entered.");
- return false;
- }
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
- Log.wrn("Create far", "Incorrect data type for Guid");
- return false;
- }
- farHeader.setGuidValue(this.jTextFieldGuid.getText());
-
- //
- // Check Version
- //
- if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Create far", "A Version must be entered.");
- return false;
- }
- if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Create far", "Incorrect data type for Version");
- return false;
- }
- farHeader.setVersion(this.jTextFieldVersion.getText());
-
- //
- // Check Abstact
- //
- if (isEmpty(this.jTextFieldAbstract.getText())) {
- Log.wrn("Create far", "An Abstract must be entered.");
- return false;
- }
- if (!DataValidation.isAbstract(this.jTextFieldAbstract.getText())) {
- Log.wrn("Create far", "Incorrect data type for Abstract");
- return false;
- }
- farHeader.setAbstractStr(this.jTextFieldAbstract.getText());
-
- //
- // Check Description
- //
- if (isEmpty(this.jTextAreaDescription.getText())) {
- Log.wrn("Create far", "A Description must be entered.");
- return false;
- }
- farHeader.setDescription(this.jTextAreaDescription.getText());
-
- //
- // Check Copyright
- //
- if (isEmpty(this.jTextAreaCopyright.getText())) {
- Log.wrn("Create far", "The Copyright must be entered.");
- return false;
- }
- farHeader.setCopyright(this.jTextAreaCopyright.getText());
-
- //
- // Check License
- //
- if (isEmpty(this.jTextAreaLicense.getText())) {
- Log.wrn("Create far", "The License must be entered.");
- return false;
- }
- farHeader.setLicense(this.jTextAreaLicense.getText());
-
- farHeader.setSpecification(this.jTextFieldSpecification.getText());
- return true;
- }
-
- /**
- * Check the input data is empty or not
- *
- * @param strValue
- * The input data which need be checked
- *
- * @retval true - The input data is empty
- * @retval fals - The input data is not empty
- *
- */
- public boolean isEmpty(String strValue) {
- if (strValue.length() > 0) {
- return false;
- }
- return true;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- if (!valid()) {
- return ;
- }
- if (stepTwo == null) {
- stepTwo = new CreateStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonGenerateGuid) {
- this.jTextFieldGuid.setText(Tools.generateUuidString());
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public FarHeader getFarHeader() {
- return farHeader;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java
deleted file mode 100644
index 666082d3d4..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/** @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.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTextField;
-
-public class CreateStepThree extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 7559888600474043337L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonPrevious = null;
-
- private JLabel jLabel = null;
-
- private ICheckBoxList jComboBoxFileFilter = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel1 = null;
-
- private JTextField jTextField = null;
-
- Vector<String> v = new Vector<String>();
-
- private CreateStepTwo stepTwo = null;
-
- private CreateStepFour stepFour = null;
-
- public CreateStepThree(IDialog iDialog, boolean modal, CreateStepTwo stepTwo) {
- this(iDialog, modal);
- this.stepTwo = stepTwo;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Add additional file filter regular expressions in the text field, separated by space characters.\n");
- jTextArea.append("Note, for additional information about regular expressions, please reference PERL language regular expressions.");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxFileFilter() {
- if (jComboBoxFileFilter == null) {
- jComboBoxFileFilter = new ICheckBoxList();
- v.addElement(".svn");
- v.addElement("CVS");
- jComboBoxFileFilter.setAllItems(v);
- jComboBoxFileFilter.initCheckedItem(true, v);
- }
- return jComboBoxFileFilter;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 85, 640, 130));
- jScrollPane.setViewportView(getJComboBoxFileFilter());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextField() {
- if (jTextField == null) {
- jTextField = new JTextField();
- jTextField.setBounds(new java.awt.Rectangle(30, 250, 640, 20));
- }
- return jTextField;
- }
-
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepThree(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_THREE_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 220, 260, 20));
- jLabel1.setText("Input File Filter Pattern (regular expressions)");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 64, 160, 20));
- jLabel.setText("File Filter Pattern: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJTextField(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
-
- if (stepFour == null) {
- stepFour = new CreateStepFour(this, true, this);
- }
-
- this.setVisible(false);
- stepFour.setVisible(true);
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepTwo.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public Set<String> getFileFilter() {
- Set<String> result = new LinkedHashSet<String>();
- Vector<Integer> selected = jComboBoxFileFilter.getAllCheckedItemsIndex();
-
- Iterator<Integer> iter = selected.iterator();
-
- while (iter.hasNext()) {
- result.add(v.get(iter.next().intValue()));
- }
-
- String[] userdefined = jTextField.getText().split(" ");
-
- for (int i = 0; i < userdefined.length; i++) {
- if (!userdefined[i].trim().equalsIgnoreCase("")) {
- result.add(userdefined[i]);
- }
- }
-
- return result;
- }
-
- public CreateStepTwo getPreviousStep() {
- return stepTwo;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java
deleted file mode 100644
index a2e3500c3a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/** @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.frameworkwizard.far.createui;
-
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class CreateStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 3003841865197005528L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JLabel jLabel1 = null;
-
- private ICheckBoxList jComboBoxPackage = null;
-
- private ICheckBoxList jComboBoxPlatform = null;
-
- private JButton jButtonNext = null;
-
- private JButton jButtonCancel = null;
-
- private JScrollPane jScrollPanePackage = null;
-
- private JScrollPane jScrollPanePlatform = null;
-
- private CreateStepThree stepThree = null;
-
- private Vector<PlatformIdentification> platformVector = null;
-
- private Vector<PackageIdentification> packageVector = null;
-
- private CreateStepOne stepOne = null;
-
- private JButton jButtonPrevious = null;
-
- public CreateStepTwo(IDialog iDialog, boolean modal, CreateStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Choose at least one package or platform. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jComboBox
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxPackage() {
- if (jComboBoxPackage == null) {
- jComboBoxPackage = new ICheckBoxList();
- WorkspaceTools wt = new WorkspaceTools();
- Vector<String> v = new Vector<String>();
- packageVector = wt.getAllPackages();
- Iterator<PackageIdentification> iter = packageVector.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- String str = item.getName() + " " + item.getVersion() + " [" + item.getPath() + "]";
- v.addElement(str);
- }
- jComboBoxPackage.setAllItems(v);
- }
- return jComboBoxPackage;
- }
-
- /**
- * This method initializes jComboBox1
- *
- * @return javax.swing.JComboBox
- */
- private ICheckBoxList getJComboBoxPlatform() {
- if (jComboBoxPlatform == null) {
- jComboBoxPlatform = new ICheckBoxList();
- WorkspaceTools wt = new WorkspaceTools();
- Vector<String> v = new Vector<String>();
- platformVector = wt.getAllPlatforms();
- Iterator<PlatformIdentification> iter = platformVector.iterator();
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- String str = item.getName() + " " + item.getVersion() + " [" + item.getPath() + "]";
- v.addElement(str);
- }
- jComboBoxPlatform.setAllItems(v);
- }
- return jComboBoxPlatform;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePackage() {
- if (jScrollPanePackage == null) {
- jScrollPanePackage = new JScrollPane();
- jScrollPanePackage.setBounds(new java.awt.Rectangle(140,65,535,130));
- jScrollPanePackage.setViewportView(getJComboBoxPackage());
- }
- return jScrollPanePackage;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPanePlatform() {
- if (jScrollPanePlatform == null) {
- jScrollPanePlatform = new JScrollPane();
- jScrollPanePlatform.setBounds(new java.awt.Rectangle(140,200,535,110));
- jScrollPanePlatform.setViewportView(getJComboBoxPlatform());
- }
- return jScrollPanePlatform;
- }
-
- /**
- * This is the default constructor
- */
- public CreateStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.CREATE_STEP_TWO_TITLE);
- this.centerWindow();
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 200, 100, 20));
- jLabel1.setText("Platforms: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 64, 100, 20));
- jLabel.setText("Packages:");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJScrollPanePackage(), null);
- jContentPane.add(getJScrollPanePlatform(), null);
- jContentPane.add(getJButtonPrevious(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- if (jComboBoxPlatform.getAllCheckedItemsIndex().size() == 0
- && jComboBoxPackage.getAllCheckedItemsIndex().size() == 0) {
- Log.wrn("Create far", "Choose at least one package and/or platform.");
- return;
- }
-
- //
- // If some packages a Repackage=false, give a warning message
- //
- List<PackageIdentification> selectedPackages = getSelectedPackages();
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> allRepackablePackages = wt.getAllRepackagablePackages();
-
- List<PackageIdentification> unRepackablePackages = new Vector<PackageIdentification>();
- String msg = "Following selected packages: \n";
- Iterator<PackageIdentification> iter = selectedPackages.iterator();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (!allRepackablePackages.contains(item)) {
- unRepackablePackages.add(item);
- msg += item.getName() + "\n";
- }
- }
- msg += "is un-Repackagable. Do you want to continue? ";
-
- if (unRepackablePackages.size() > 0) {
- if(JOptionPane.showConfirmDialog(this, msg, "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
- return ;
- }
- }
-
- if (stepThree == null) {
- stepThree = new CreateStepThree(this, true, this);
- }
- this.setVisible(false);
- stepThree.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- public List<PackageIdentification> getSelectedPackages() {
- Vector<Integer> v = jComboBoxPackage.getAllCheckedItemsIndex();
- List<PackageIdentification> result = new ArrayList<PackageIdentification>();
- for (int i = 0; i < v.size(); i++) {
- result.add(packageVector.get(v.get(i).intValue()));
- }
- return result;
- }
-
- public List<PlatformIdentification> getSelectedPlatforms() {
- Vector<Integer> v = jComboBoxPlatform.getAllCheckedItemsIndex();
- List<PlatformIdentification> result = new ArrayList<PlatformIdentification>();
- for (int i = 0; i < v.size(); i++) {
- result.add(platformVector.get(v.get(i).intValue()));
- }
- return result;
- }
-
- public CreateStepOne getPreviousStep() {
- return stepOne;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java
deleted file mode 100644
index f5b68f4eae..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/** @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.frameworkwizard.far.deleteui;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JList;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.far.PackageQuery;
-import org.tianocore.frameworkwizard.far.PackageQueryInterface;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DeleteStepOne extends IDialog implements ListSelectionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 636773964435618476L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JTextArea jTextAreaInstruction = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel2 = null;
-
- private JLabel jLabel3 = null;
-
- private JScrollPane jScrollPane1 = null;
-
- private JScrollPane jScrollPane2 = null;
-
- private JList jListPlatform = null;
-
- private JList jListPackage = null;
-
- private JLabel jLabel4 = null;
-
- private JButton jButtonDetail = null;
-
- private JList jListFar = null;
-
- private JLabel jLabelImage = null;
-
- private Vector<FarIdentification> farVector = null;
-
- Vector<PackageIdentification> removePackages = null;
-
- Vector<PlatformIdentification> removePlatforms = null;
-
- private DeleteStepTwo stepTwo = null;
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addActionListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.setEnabled(false);
- jButtonNext.addActionListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextArea1
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea1() {
- if (jTextAreaInstruction == null) {
- jTextAreaInstruction = new JTextArea();
- jTextAreaInstruction.setBounds(new java.awt.Rectangle(30, 7, 662, 50));
- jTextAreaInstruction.setText("Step 1: Select FAR to remove.\n");
- jTextAreaInstruction.setCaretColor(Color.RED);
- jTextAreaInstruction
- .append("After choosing the FAR, the packages and/or platforms that belong to the FAR will displayed.\n");
- jTextAreaInstruction.append("Icon \"OK\" or \"NO\" indicates whether the FAR can be safely removed.");
- jTextAreaInstruction.setEditable(false);
- }
- return jTextAreaInstruction;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(140, 65, 530, 100));
- jScrollPane.setViewportView(getJListFar());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane1() {
- if (jScrollPane1 == null) {
- jScrollPane1 = new JScrollPane();
- jScrollPane1.setBounds(new java.awt.Rectangle(30, 195, 300, 115));
- jScrollPane1.setViewportView(getJListPackage());
- }
- return jScrollPane1;
- }
-
- /**
- * This method initializes jScrollPane2
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane2() {
- if (jScrollPane2 == null) {
- jScrollPane2 = new JScrollPane();
- jScrollPane2.setBounds(new java.awt.Rectangle(360, 195, 310, 115));
- jScrollPane2.setViewportView(getJListPlatform());
- }
- return jScrollPane2;
- }
-
- /**
- * This method initializes jList
- *
- * @return javax.swing.JList
- */
- private JList getJListPlatform() {
- if (jListPlatform == null) {
- jListPlatform = new JList();
- jListPlatform.setEnabled(false);
- }
- return jListPlatform;
- }
-
- /**
- * This method initializes jList1
- *
- * @return javax.swing.JList
- */
- private JList getJListPackage() {
- if (jListPackage == null) {
- jListPackage = new JList();
- jListPackage.setEnabled(false);
- }
- return jListPackage;
- }
-
- /**
- * This method initializes jButtonDetail
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonDetail() {
- if (jButtonDetail == null) {
- jButtonDetail = new JButton();
- jButtonDetail.setBounds(new java.awt.Rectangle(367, 325, 69, 20));
- jButtonDetail.setText("Detail");
- jButtonDetail.setVisible(false);
- }
- return jButtonDetail;
- }
-
- /**
- * This method initializes jListFar
- *
- * @return javax.swing.JList
- */
- private JList getJListFar() {
- if (jListFar == null) {
- jListFar = new JList();
- WorkspaceTools wt = new WorkspaceTools();
- farVector = wt.getAllFars();
- jListFar.setListData(farVector);
- jListFar.addListSelectionListener(this);
- }
- return jListFar;
- }
-
- /**
- * This is the default constructor
- */
- public DeleteStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.DELETE_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelImage = new JLabel();
- jLabelImage.setBounds(new java.awt.Rectangle(30, 319, 36, 36));
- jLabel4 = new JLabel();
- jLabel4.setBounds(new java.awt.Rectangle(71, 325, 320, 20));
- jLabel3 = new JLabel();
- jLabel3.setBounds(new java.awt.Rectangle(360, 170, 113, 20));
- jLabel3.setText("FAR's Platforms");
- jLabel2 = new JLabel();
- jLabel2.setBounds(new java.awt.Rectangle(30, 170, 113, 20));
- jLabel2.setText("FAR's Packages");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 65, 100, 20));
- jLabel.setText("Select one FAR: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJTextArea1(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel2, null);
- jContentPane.add(jLabel3, null);
- jContentPane.add(getJScrollPane1(), null);
- jContentPane.add(getJScrollPane2(), null);
- jContentPane.add(jLabel4, null);
- jContentPane.add(getJButtonDetail(), null);
- jContentPane.add(jLabelImage, null);
- }
- return jContentPane;
- }
-
- public void valueChanged(ListSelectionEvent e) {
- //
- // Add logic for FAR list value changed
- //
- if (e.getSource() == jListFar) {
- boolean flag = true;
- FarIdentification far = (FarIdentification) jListFar.getSelectedValue();
- WorkspaceTools wt = new WorkspaceTools();
-
- removePackages = wt.getPackagesByFar(far);
- jListPackage.setListData(removePackages);
- removePlatforms = wt.getPlatformsByFar(far);
- jListPlatform.setListData(removePlatforms);
-
- //
- // Get Dependencies Info for current FAR
- //
- List<PackageIdentification> allPackages = wt.getAllPackages();
-
- //
- // Remain packages
- //
- allPackages.removeAll(removePackages);
-
- Iterator<PackageIdentification> iter = allPackages.iterator();
-
- PackageQueryInterface pq = new PackageQuery();
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- List<PackageIdentification> list = pq.getPackageDependencies(item.getSpdFile());
- List<PackageIdentification> result = AggregationOperation.minus(list, allPackages);
- if (result.size() > 0) {
- if (AggregationOperation.intersection(result, removePackages).size() > 0) {
- flag = false;
- break;
- }
- }
- }
-
- if (flag) {
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/Yes.JPG")));
- jLabel4.setText("None of the remaining packages depend on this FAR. ");
- jButtonDetail.setVisible(false);
- jButtonNext.setEnabled(true);
- } else {
- jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/No.JPG")));
- jLabel4.setText("Some of the remaining packages still depend on this FAR. ");
- // jButtonDetail.setVisible(true);
- jButtonNext.setEnabled(false);
- }
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
-
- if (stepTwo == null) {
- stepTwo = new DeleteStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.setVisible(true);
- }
-
- }
-
- public FarIdentification getSelecedFar() {
- return (FarIdentification) jListFar.getSelectedValue();
- }
-
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java
deleted file mode 100644
index 8d7e4e6fed..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/** @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.frameworkwizard.far.deleteui;
-
-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.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.ButtonGroup;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JTextArea;
-import javax.swing.JLabel;
-import javax.swing.JRadioButton;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class DeleteStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -1333748185798962746L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JRadioButton jRadioButton = null;
-
- private JRadioButton jRadioButton1 = null;
-
- private DeleteStepOne stepOne = null;
-
- public DeleteStepTwo(IDialog iDialog, boolean modal, DeleteStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Choose Delete Mode. \n");
- jTextArea.append("Mode 1 Only remove registation information from the WORKSPACE. \n");
- jTextArea.append("Mode 2 Also delete all files and directories from file system. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jRadioButton
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton() {
- if (jRadioButton == null) {
- jRadioButton = new JRadioButton();
- jRadioButton.setBounds(new java.awt.Rectangle(40,100,440,20));
- jRadioButton.setSelected(true);
- jRadioButton.setText("Mode 1: Only remove registration information from the WORKSPACE.");
- }
- return jRadioButton;
- }
-
- /**
- * This method initializes jRadioButton1
- *
- * @return javax.swing.JRadioButton
- */
- private JRadioButton getJRadioButton1() {
- if (jRadioButton1 == null) {
- jRadioButton1 = new JRadioButton();
- jRadioButton1.setBounds(new java.awt.Rectangle(40,140,440,20));
- jRadioButton1.setText("Mode 2: Delete ALL related files and directories from the WORKSPACE.");
- }
- return jRadioButton1;
- }
-
- /**
- * This is the default constructor
- */
- public DeleteStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.DELETE_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 70, 200, 20));
- jLabel.setText("Select delete mode: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- ButtonGroup group = new ButtonGroup();
- group.add(getJRadioButton());
- group.add(getJRadioButton1());
- jContentPane.add(getJRadioButton(), null);
- jContentPane.add(getJRadioButton1(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonFinish) {
- FarIdentification far = stepOne.getSelecedFar();
- WorkspaceTools wt = new WorkspaceTools();
- //
- // If remove all source files
- //
- if (jRadioButton1.isSelected()) {
-
- Vector<PackageIdentification> removePackages = wt.getPackagesByFar(far);
- Vector<PlatformIdentification> removePlatforms = wt.getPlatformsByFar(far);
-
- Vector<PlatformIdentification> allPlatforms = wt.getAllPlatforms();
- Set<File> allPlatformFiles = new LinkedHashSet<File>();
-
- Iterator<PlatformIdentification> iter = allPlatforms.iterator();
- while (iter.hasNext()) {
- allPlatformFiles.add(iter.next().getFpdFile());
- }
-
- //
- // For all platforms, only remove its FPD file
- //
- Iterator<PlatformIdentification> platfomrIter = removePlatforms.iterator();
- while (platfomrIter.hasNext()) {
- PlatformIdentification item = platfomrIter.next();
- allPlatformFiles.remove(item.getFpdFile());
- File parentDir = item.getFpdFile().getParentFile();
- item.getFpdFile().delete();
- //
- // Remove all empty parent dir
- //
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
-
- //
- // For all packages, remove all files.
- // Exception FPD file still in DB
- //
-
- Iterator<PackageIdentification> packageIter = removePackages.iterator();
- while (packageIter.hasNext()) {
- PackageIdentification item = packageIter.next();
- Set<File> deleteFiles = new LinkedHashSet<File>();
- recursiveDir(deleteFiles, item.getSpdFile().getParentFile(), allPlatformFiles);
- Iterator<File> iterDeleteFile = deleteFiles.iterator();
- while (iterDeleteFile.hasNext()) {
- deleteFiles(iterDeleteFile.next());
- }
- //
- // Remove all empty parent dir
- //
- File parentDir = item.getSpdFile().getParentFile();
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
- }
-
- //
- // Update DB file
- //
- wt.removeFarFromDb(far);
-
- this.setVisible(false);
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- private void recursiveDir(Set<File> files, File dir, Set<File> platformFiles) {
- File[] fileList = dir.listFiles();
- for (int i = 0; i < fileList.length; i++) {
- if (fileList[i].isFile()) {
- if (!platformFiles.contains(fileList[i])) {
- files.add(fileList[i]);
- }
- } else {
- if (isContain(fileList[i], platformFiles)) {
- recursiveDir(files, fileList[i], platformFiles);
- } else {
- files.add(fileList[i]);
- }
- }
- }
- }
-
- private void deleteFiles(File file) {
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- deleteFiles(files[i]);
- }
- }
- file.delete();
- }
-
- private boolean isContain(File dir, Set<File> platformFiles) {
- Iterator<File> iter = platformFiles.iterator();
- while (iter.hasNext()) {
- File file = iter.next();
- if (file.getPath().startsWith(dir.getPath())) {
- //
- // continue this FPD file
- //
- return true;
- }
- }
- return false;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java
deleted file mode 100644
index 24cd1369ea..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/** @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.frameworkwizard.far.installui;
-
-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.jar.JarFile;
-import java.util.Iterator;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JButton;
-import javax.swing.JTextArea;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.DistributeRule;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.table.DefaultTableModel;
-
-public class InstallStepOne extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -8821906198791949544L;
-
- private JPanel jContentPane = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JTextArea jTextArea = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldFarFile = null;
-
- private JButton jButtonBrowser = null;
-
- private InstallStepTwo stepTwo = null;
-
- Far far = null;
-
- private JLabel jLabelWarning = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTable = null;
-
- private PartialTableModel model = null;
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 1: Choose a framework archive(FAR) file. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFarFile() {
- if (jTextFieldFarFile == null) {
- jTextFieldFarFile = new JTextField();
- jTextFieldFarFile.setBounds(new java.awt.Rectangle(140, 80, 423, 20));
- }
- return jTextFieldFarFile;
- }
-
- /**
- * This method initializes jButtonBrowser
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowser() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 80, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 165, 642, 140));
- jScrollPane.setViewportView(getJTable());
- }
- jScrollPane.setVisible(false);
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTable() {
- if (jTable == null) {
- jTable = new JTable();
- model = new PartialTableModel();
- jTable = new JTable(model);
- jTable.setRowHeight(20);
- jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- model.addColumn("Name");
- model.addColumn("Version");
- model.addColumn("GUID");
-
- jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- jTable.setVisible(false);
- return jTable;
- }
-
- public void prepareTable(List<PackageIdentification> packageList) {
- model.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- Iterator<PackageIdentification> iter = packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[3];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = item.getGuid();
- model.addRow(str);
- }
- }
-
- /**
- * This is the default constructor
- */
- public InstallStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.INSTALL_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabelWarning = new JLabel();
- jLabelWarning.setBounds(new java.awt.Rectangle(30, 125, 510, 20));
- jLabelWarning.setText("Cannot install this FAR, the WORKSPACE is missing the following required packages.");
- jLabelWarning.setVisible(false);
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 80, 97, 20));
- jLabel.setText("Choose FAR file: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldFarFile(), null);
- jContentPane.add(getJButtonBrowser(), null);
- jContentPane.add(jLabelWarning, null);
- jContentPane.add(getJScrollPane(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Add some logic process here
- //
- File farFile = new File(jTextFieldFarFile.getText());
- if (!farFile.exists() || !farFile.isFile()) {
- Log.wrn("Install far", "Please choose an existing FAR file.");
- return;
- }
-
- //
- // Verify Far
- //
- JarFile jarFar;
- try {
- jarFar = new JarFile(farFile);
- far = new Far(jarFar);
-
- //
- // Far dependency check
- //
- List<PackageIdentification> pkgIdList = DistributeRule.installFarCheck(far);
-
- if (pkgIdList.size() > 0) {
- prepareTable(pkgIdList);
- jLabelWarning.setVisible(true);
- jTable.setVisible(true);
- jScrollPane.setVisible(true);
- return;
- }
-
- } catch (Exception exp) {
- Log.wrn("Install far" + exp.getMessage());
- Log.err("Install far" + exp.getMessage());
- }
-
- if (stepTwo == null) {
- stepTwo = new InstallStepTwo(this, true, this);
- }
- this.setVisible(false);
-
- //
- // Refresh table
- //
- stepTwo.preparePackageTable();
- stepTwo.preparePlatformTable();
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- jLabelWarning.setVisible(false);
- jTable.setVisible(false);
- jScrollPane.setVisible(false);
- this.jTextFieldFarFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public Far getFar() {
- return far;
- }
-
-}
-
-class PartialTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java
deleted file mode 100644
index 68d286cdf5..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/** @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.frameworkwizard.far.installui;
-
-import java.awt.Color;
-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.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JScrollPane;
-import javax.swing.ListSelectionModel;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.JTable;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class InstallStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 4583090421587036969L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private PartialEditableTableModel packageModel = null;
-
- private PartialEditableTableModel platformModel = null;
-
- private InstallStepOne stepOne = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JLabel jLabel = null;
-
- private JScrollPane jScrollPane = null;
-
- private JTable jTablePackage = null;
-
- private JLabel jLabel1 = null;
-
- private JScrollPane jScrollPane1 = null;
-
- private JTable jTablePlatform = null;
-
- List<PlatformIdentification> platformVector = null;
-
- List<PackageIdentification> packageVector = null;
-
- public InstallStepTwo(IDialog iDialog, boolean modal, InstallStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Set Install Path for Packages and/or Platforms.\n");
- jTextArea.setCaretColor(Color.RED);
- jTextArea.append("Note that the Install Path is Relative to WORKSPACE. ");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 80, 642, 110));
- jScrollPane.setViewportView(getJTablePackage());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTable
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePackage() {
- if (jTablePackage == null) {
- jTablePackage = new JTable();
- packageModel = new PartialEditableTableModel();
- jTablePackage = new JTable(packageModel);
- jTablePackage.setRowHeight(20);
- jTablePackage.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- packageModel.addColumn("Name");
- packageModel.addColumn("Version");
- packageModel.addColumn("Default Path");
- packageModel.addColumn("Install To");
-
- jTablePackage.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- return jTablePackage;
- }
-
- public void preparePackageTable() {
- packageModel.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- try {
- Far far = stepOne.getFar();
-
- packageVector = far.manifest.getPackageList();
- Iterator<PackageIdentification> iter = packageVector.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- packageModel.addRow(str);
- }
- } catch (Exception e) {
- }
- }
-
- /**
- * This method initializes jScrollPane1
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane1() {
- if (jScrollPane1 == null) {
- jScrollPane1 = new JScrollPane();
- jScrollPane1.setBounds(new java.awt.Rectangle(30, 215, 642, 110));
- jScrollPane1.setViewportView(getJTablePlatform());
- }
- return jScrollPane1;
- }
-
- /**
- * This method initializes jTablePlatform
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePlatform() {
- if (jTablePlatform == null) {
- jTablePlatform = new JTable();
- platformModel = new PartialEditableTableModel();
- jTablePlatform = new JTable(platformModel);
- jTablePlatform.setRowHeight(20);
- jTablePlatform.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- platformModel.addColumn("Name");
- platformModel.addColumn("Version");
- platformModel.addColumn("Default Path");
- platformModel.addColumn("Install To");
-
- jTablePlatform.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- preparePlatformTable();
- }
- return jTablePlatform;
- }
-
- public void preparePlatformTable() {
- platformModel.setRowCount(0);
- //
- // Change here to get packages and platforms from FAR
- //
- try {
- Far far = stepOne.getFar();
-
- platformVector = far.manifest.getPlatformList();
- Iterator<PlatformIdentification> iter = platformVector.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PlatformIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- platformModel.addRow(str);
- }
- } catch (Exception e) {
- }
- }
-
- /**
- * This is the default constructor
- */
- public InstallStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.INSTALL_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 195, 348, 18));
- jLabel1.setText("Edit \"Install To\" paths for platforms: ");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(29, 60, 366, 20));
- jLabel.setText("Edit \"Install To\" paths for packages");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJScrollPane1(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonFinish) {
-
- if (jTablePackage.isEditing()) {
- jTablePackage.getCellEditor().stopCellEditing();
- }
-
- if (jTablePlatform.isEditing()) {
- jTablePlatform.getCellEditor().stopCellEditing();
- }
-
- List<String> packageList = new ArrayList<String>();
- List<String> platformList = new ArrayList<String>();
- //
- // Add some logic process here
- // Guid Check, File Check etc.
- //
- Set<File> allNewPath = new LinkedHashSet<File>();
- Map<PackageIdentification, File> packageMap = new LinkedHashMap<PackageIdentification, File>();
- for (int i = 0; i < packageModel.getRowCount(); i++) {
- File toFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + packageModel.getValueAt(i, 3));
- if (!isPackagePathValid(toFile)) {
- Log.wrn("Install far", packageVector.get(i) + " path already contains a package.");
- return;
- }
- if (allNewPath.contains(toFile)) {
- Log.wrn("Install far", "Path " + packageModel.getValueAt(i, 3) + " is specified twice.");
- return;
- }
- allNewPath.add(toFile);
- File spdFile = new File((String) packageModel.getValueAt(i, 3) + File.separatorChar
- + packageVector.get(i).getSpdFile().getName());
- packageList.add(spdFile.getPath());
- packageMap.put(packageVector.get(i), toFile);
- }
-
- Map<PlatformIdentification, File> platformMap = new LinkedHashMap<PlatformIdentification, File>();
- for (int i = 0; i < platformModel.getRowCount(); i++) {
- File toFile = new File(Workspace.getCurrentWorkspace() + File.separatorChar
- + platformModel.getValueAt(i, 3));
- if (!isPlatformPathValid(toFile)) {
- Log.wrn("Install far", platformVector.get(i) + " path already contains a platform.");
- return;
- }
- File fpdFile = new File((String) platformModel.getValueAt(i, 3) + File.separatorChar
- + platformVector.get(i).getFpdFile().getName());
- platformList.add(fpdFile.getPath());
- platformMap.put(platformVector.get(i), toFile);
- }
-
- //
- //
- //
- Far far = stepOne.getFar();
- try {
- far.InstallFar(platformMap, packageMap);
- //
- // Add to database
- //
- WorkspaceTools wt = new WorkspaceTools();
- wt.addFarToDb(packageList, platformList, far.manifest.getHeader());
- } catch (Exception ex) {
- Log.wrn("Install far", ex.getMessage());
- Log.err("Install far", ex.getMessage());
- return;
- }
-
- this.setVisible(false);
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- private boolean isPackagePathValid(File spdFile) {
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> allPackages = wt.getAllPackages();
- Iterator<PackageIdentification> iter = allPackages.iterator();
-
- while (iter.hasNext()) {
- PackageIdentification item = iter.next();
- if (isPathContainMutual(spdFile, item.getSpdFile())) {
- return false;
- }
- }
- return true;
- }
-
- private boolean isPlatformPathValid(File fpdFile) {
- WorkspaceTools wt = new WorkspaceTools();
- List<PlatformIdentification> allPlatforms = wt.getAllPlatforms();
- Iterator<PlatformIdentification> iter = allPlatforms.iterator();
-
- while (iter.hasNext()) {
- PlatformIdentification item = iter.next();
- if (isPathContainMutual(fpdFile, item.getFpdFile())) {
- return false;
- }
- }
- return true;
- }
-
- private boolean isPathContainMutual(File path1, File path2) {
- String s1 = Tools.addFileSeparator(path1.getPath());
- String s2 = Tools.addFileSeparator(path2.getParent());
-
- if (s1.length() > s2.length()) {
- if (s1.substring(0, s2.length()).equalsIgnoreCase(s2)) {
- return true;
- }
- } else {
- if (s2.substring(0, s1.length()).equalsIgnoreCase(s1)) {
- return true;
- }
- }
- return false;
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
-}
-
-class PartialEditableTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- case 3:
- return true;
- default:
- return false;
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java
deleted file mode 100644
index 5ae496672a..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/** @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.frameworkwizard.far.updateui;
-
-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.Vector;
-import java.util.jar.JarFile;
-
-import javax.swing.JFileChooser;
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JTextField;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.IFileFilter;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.common.ui.IFrame;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarIdentification;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-import javax.swing.JScrollPane;
-import javax.swing.JList;
-
-public class UpdateStepOne extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = 735554907464539931L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonNext = null;
-
- private JLabel jLabel = null;
-
- private JTextField jTextFieldFarFile = null;
-
- private JButton jButtonBrowser = null;
-
- private UpdateStepTwo stepTwo = null;
-
- private Far far = null;
-
- private Vector<FarIdentification> farVector = null;
-
- private JLabel jLabel1 = null;
-
- private JScrollPane jScrollPane = null;
-
- private JList jListFarFromDb = null;
-
- private File farFile = null;
-
- public File getFarFile() {
- return farFile;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 1: Choose framework archive (FAR) file. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonNext
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonNext() {
- if (jButtonNext == null) {
- jButtonNext = new JButton();
- jButtonNext.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonNext.setText("Next");
- jButtonNext.addMouseListener(this);
- }
- return jButtonNext;
- }
-
- /**
- * This method initializes jTextField
- *
- * @return javax.swing.JTextField
- */
- private JTextField getJTextFieldFarFile() {
- if (jTextFieldFarFile == null) {
- jTextFieldFarFile = new JTextField();
- jTextFieldFarFile.setBounds(new java.awt.Rectangle(130, 80, 436, 20));
- }
- return jTextFieldFarFile;
- }
-
- /**
- * This method initializes jButton
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonBrowser() {
- if (jButtonBrowser == null) {
- jButtonBrowser = new JButton();
- jButtonBrowser.setBounds(new java.awt.Rectangle(570, 80, 100, 20));
- jButtonBrowser.setText("Browser...");
- jButtonBrowser.addMouseListener(this);
- }
- return jButtonBrowser;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 135, 642, 160));
- jScrollPane.setViewportView(getJListFarFromDb());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jListFarFromDb
- *
- * @return javax.swing.JList
- */
- private JList getJListFarFromDb() {
- if (jListFarFromDb == null) {
- jListFarFromDb = new JList();
- WorkspaceTools wt = new WorkspaceTools();
- farVector = wt.getAllFars();
- jListFarFromDb.setListData(farVector);
- jListFarFromDb.setSelectionMode(0);
- }
- return jListFarFromDb;
- }
-
- /**
- * This is the default constructor
- */
- public UpdateStepOne(IFrame iFrame, boolean modal) {
- super(iFrame, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.UPDATE_STEP_ONE_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel1 = new JLabel();
- jLabel1.setBounds(new java.awt.Rectangle(30, 110, 355, 18));
- jLabel1.setText("Choose FAR from current WORKSPACE.");
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 80, 97, 20));
- jLabel.setText("Choose FAR file: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonNext(), null);
- jContentPane.add(jLabel, null);
- jContentPane.add(getJTextFieldFarFile(), null);
- jContentPane.add(getJButtonBrowser(), null);
- jContentPane.add(jLabel1, null);
- jContentPane.add(getJScrollPane(), null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonNext) {
- //
- // Judge if FAR file is existed
- //
- farFile = new File(jTextFieldFarFile.getText());
- if (!farFile.exists() || !farFile.isFile()) {
- Log.wrn("Update far", "Please choose a FAR file that already exists.");
- return;
- }
-
- //
- // Judge FAR is valid
- //
- try {
- JarFile file = new JarFile(farFile);
- this.far = new Far(file);
- } catch (Exception ex) {
- Log.wrn("Update far", ex.getMessage());
- Log.err("Update far", ex.getMessage());
- }
-
- //
- // Add more logic process here
- //
- if (jListFarFromDb.getSelectedValue() == null) {
- Log.wrn("Update far", "Please choose a FAR from current WORKSPACE.");
- return;
- }
-
- if (stepTwo == null) {
- stepTwo = new UpdateStepTwo(this, true, this);
- }
- this.setVisible(false);
- stepTwo.prepareTable();
- stepTwo.setVisible(true);
- } else if (e.getSource() == jButtonBrowser) {
- JFileChooser fc = new JFileChooser();
- fc.setAcceptAllFileFilterUsed(false);
- fc.addChoosableFileFilter(new IFileFilter(DataType.FAR_SURFACE_AREA_EXT));
- fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
-
- int result = fc.showOpenDialog(new JPanel());
- if (result == JFileChooser.APPROVE_OPTION) {
- this.jTextFieldFarFile.setText(Tools.addPathExt(fc.getSelectedFile().getPath(),
- DataType.RETURN_TYPE_FAR_SURFACE_AREA));
- }
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public FarIdentification getSelecedDbFar() {
- return (FarIdentification) jListFarFromDb.getSelectedValue();
- }
-
- public Far getFar() {
- return far;
- }
-}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java
deleted file mode 100644
index 6785803453..0000000000
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/** @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.frameworkwizard.far.updateui;
-
-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.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.swing.JPanel;
-import javax.swing.JTextArea;
-import javax.swing.JButton;
-import javax.swing.JScrollPane;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
-import javax.swing.table.DefaultTableModel;
-
-import org.tianocore.frameworkwizard.common.DataType;
-import org.tianocore.frameworkwizard.common.Log;
-import org.tianocore.frameworkwizard.common.Tools;
-import org.tianocore.frameworkwizard.common.ui.IDialog;
-import org.tianocore.frameworkwizard.far.AggregationOperation;
-import org.tianocore.frameworkwizard.far.DistributeRule;
-import org.tianocore.frameworkwizard.far.Far;
-import org.tianocore.frameworkwizard.far.FarStringDefinition;
-import org.tianocore.frameworkwizard.packaging.PackageIdentification;
-import org.tianocore.frameworkwizard.platform.PlatformIdentification;
-import org.tianocore.frameworkwizard.workspace.Workspace;
-import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
-
-public class UpdateStepTwo extends IDialog implements MouseListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -4400145363721213110L;
-
- private JPanel jContentPane = null;
-
- private JTextArea jTextArea = null;
-
- private UpdateStepOne stepOne = null;
-
- private JButton jButtonCancel = null;
-
- private JButton jButtonFinish = null;
-
- private JButton jButtonPrevious = null;
-
- private JScrollPane jScrollPane = null;
-
- private JLabel jLabel = null;
-
- private JTable jTablePackage = null;
-
- private PartialTableModel model = null;
-
- List<PackageIdentification> updatPkgList = new ArrayList<PackageIdentification>();
-
- public UpdateStepTwo(IDialog iDialog, boolean modal, UpdateStepOne stepOne) {
- this(iDialog, modal);
- this.stepOne = stepOne;
- }
-
- /**
- * This method initializes jTextArea
- *
- * @return javax.swing.JTextArea
- */
- private JTextArea getJTextArea() {
- if (jTextArea == null) {
- jTextArea = new JTextArea();
- jTextArea.setBounds(new java.awt.Rectangle(30, 7, 642, 50));
- jTextArea.setText("Step 2: Summary. \n");
- jTextArea.setEditable(false);
- }
- return jTextArea;
- }
-
- /**
- * This method initializes jButtonCancel
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonCancel() {
- if (jButtonCancel == null) {
- jButtonCancel = new JButton();
- jButtonCancel.setBounds(new java.awt.Rectangle(570, 330, 90, 20));
- jButtonCancel.setText("Cancel");
- jButtonCancel.addMouseListener(this);
- }
- return jButtonCancel;
- }
-
- /**
- * This method initializes jButtonFinish
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonFinish() {
- if (jButtonFinish == null) {
- jButtonFinish = new JButton();
- jButtonFinish.setBounds(new java.awt.Rectangle(470, 330, 90, 20));
- jButtonFinish.setText("Finish");
- jButtonFinish.addMouseListener(this);
- }
- return jButtonFinish;
- }
-
- /**
- * This method initializes jButtonPrevious
- *
- * @return javax.swing.JButton
- */
- private JButton getJButtonPrevious() {
- if (jButtonPrevious == null) {
- jButtonPrevious = new JButton();
- jButtonPrevious.setBounds(new java.awt.Rectangle(370, 330, 90, 20));
- jButtonPrevious.setText("Previous");
- jButtonPrevious.addMouseListener(this);
- }
- return jButtonPrevious;
- }
-
- /**
- * This method initializes jScrollPane
- *
- * @return javax.swing.JScrollPane
- */
- private JScrollPane getJScrollPane() {
- if (jScrollPane == null) {
- jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(30, 100, 642, 170));
- jScrollPane.setViewportView(getJTablePackage());
- }
- return jScrollPane;
- }
-
- /**
- * This method initializes jTablePackage
- *
- * @return javax.swing.JTable
- */
- private JTable getJTablePackage() {
- if (jTablePackage == null) {
- jTablePackage = new JTable();
- model = new PartialTableModel();
- jTablePackage = new JTable(model);
- jTablePackage.setRowHeight(20);
- jTablePackage.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
- model.addColumn("Name");
- model.addColumn("Version");
- model.addColumn("Guid");
- model.addColumn("Path");
-
- jTablePackage.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- }
- return jTablePackage;
- }
-
- public void prepareTable() {
- model.setRowCount(0);
- try {
- Far far = stepOne.getFar();
- List<PackageIdentification> packagesInFar = far.manifest.getPackageList();
-
- WorkspaceTools wt = new WorkspaceTools();
- List<PackageIdentification> packagesInDb = wt.getAllPackages();
-
- updatPkgList = AggregationOperation.intersection(packagesInDb, packagesInFar);
- //
- // Change here to get packages and platforms from FAR
- //
- Iterator<PackageIdentification> iter = updatPkgList.iterator();//packageList.iterator();
- while (iter.hasNext()) {
- String[] str = new String[4];
- PackageIdentification item = iter.next();
- str[0] = item.getName();
- str[1] = item.getVersion();
- str[2] = item.getGuid();
- str[3] = Tools.getFilePathOnly(Tools.getRelativePath(item.getPath(), Workspace.getCurrentWorkspace()));
- model.addRow(str);
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- /**
- * This is the default constructor
- */
- public UpdateStepTwo(IDialog iDialog, boolean modal) {
- super(iDialog, modal);
- initialize();
- }
-
- /**
- * This method initializes this
- *
- * @return void
- */
- private void initialize() {
- this.setSize(700, 400);
- this.setContentPane(getJContentPane());
- this.setTitle(FarStringDefinition.UPDATE_STEP_TWO_TITLE);
- Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
- this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
- }
-
- /**
- * This method initializes jContentPane
- *
- * @return javax.swing.JPanel
- */
- private JPanel getJContentPane() {
- if (jContentPane == null) {
- jLabel = new JLabel();
- jLabel.setBounds(new java.awt.Rectangle(30, 70, 281, 20));
- jLabel.setText("Following packages will be updated: ");
- jContentPane = new JPanel();
- jContentPane.setLayout(null);
- jContentPane.add(getJTextArea(), null);
- jContentPane.add(getJButtonCancel(), null);
- jContentPane.add(getJButtonFinish(), null);
- jContentPane.add(getJButtonPrevious(), null);
- jContentPane.add(getJScrollPane(), null);
- jContentPane.add(jLabel, null);
- }
- return jContentPane;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getSource() == jButtonCancel) {
- this.setVisible(false);
- } else if (e.getSource() == jButtonFinish) {
- //
- // Check depedency ?
- //
- WorkspaceTools wsTools = new WorkspaceTools();
-
- Iterator<PackageIdentification> iter = updatPkgList.iterator();
- List<PackageIdentification> depResultList = new ArrayList<PackageIdentification>();
- while (iter.hasNext()) {
- List<PackageIdentification> depPkgList = stepOne.getFar().getPackageDependencies(iter.next());
- depResultList = AggregationOperation.union(depResultList, depPkgList);
- }
-
- List<PackageIdentification> dbPkgList = DistributeRule.vectorToList(wsTools.getAllPackages());
- List<PackageIdentification> resultList = AggregationOperation
- .minus(
- depResultList,
- AggregationOperation
- .union(
- this.updatPkgList,
- dbPkgList));
- Iterator resultIter = resultList.iterator();
- while (resultIter.hasNext()) {
- Log.wrn("Update far", "Missing dependency package " + ((PackageIdentification) resultIter.next()).toString()
- + " in workspace!");
- return;
- }
-
- //
- // Remove all update packages
- //
- //
- // For all packages, remove all files.
- // Exception FPD file still in DB
- //
- Vector<PlatformIdentification> allPlatforms = wsTools.getAllPlatforms();
- Set<File> allPlatformFiles = new LinkedHashSet<File>();
-
- Iterator<PlatformIdentification> allPlfIter = allPlatforms.iterator();
- while (iter.hasNext()) {
- allPlatformFiles.add(allPlfIter.next().getFpdFile());
- }
-
- Iterator<PackageIdentification> packageIter = this.updatPkgList.iterator();
- while (packageIter.hasNext()) {
- PackageIdentification item = packageIter.next();
- Set<File> deleteFiles = new LinkedHashSet<File>();
- recursiveDir(deleteFiles, item.getSpdFile().getParentFile(), allPlatformFiles);
- Iterator<File> iterDeleteFile = deleteFiles.iterator();
- while (iterDeleteFile.hasNext()) {
- deleteFiles(iterDeleteFile.next());
- }
- //
- // Remove all empty parent dir
- //
- File parentDir = item.getSpdFile().getParentFile();
- while (parentDir.listFiles().length == 0) {
- File tempFile = parentDir;
- parentDir = parentDir.getParentFile();
- tempFile.delete();
- }
- }
-
- //
- // Install all update packages
- //
- Iterator<PackageIdentification> updataIter = this.updatPkgList.iterator();
- while (updataIter.hasNext()) {
- PackageIdentification pkgId = updataIter.next();
- try {
- stepOne.getFar().installPackage(pkgId, new File(pkgId.getSpdFile().getParent()));
- } catch (Exception ex) {
- Log.wrn("Install " + pkgId.toString(), ex.getMessage());
- Log.err("Install " + pkgId.toString(), ex.getMessage());
- }
-
- }
- this.stepOne.returnType = DataType.RETURN_TYPE_OK;
-
- this.setVisible(false);
- this.dispose();
- } else if (e.getSource() == jButtonPrevious) {
- this.setVisible(false);
- stepOne.setVisible(true);
- }
- }
-
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- private void recursiveDir(Set<File> files, File dir, Set<File> platformFiles) {
- File[] fileList = dir.listFiles();
- for (int i = 0; i < fileList.length; i++) {
- if (fileList[i].isFile()) {
- if (!platformFiles.contains(fileList[i])) {
- files.add(fileList[i]);
- }
- } else {
- if (isContain(fileList[i], platformFiles)) {
- recursiveDir(files, fileList[i], platformFiles);
- } else {
- files.add(fileList[i]);
- }
- }
- }
- }
-
- private void deleteFiles(File file) {
- if (file.isDirectory()) {
- File[] files = file.listFiles();
- for (int i = 0; i < files.length; i++) {
- deleteFiles(files[i]);
- }
- }
- file.delete();
- }
-
- private boolean isContain(File dir, Set<File> platformFiles) {
- Iterator<File> iter = platformFiles.iterator();
- while (iter.hasNext()) {
- File file = iter.next();
- if (file.getPath().startsWith(dir.getPath())) {
- //
- // continue this FPD file
- //
- return true;
- }
- }
- return false;
- }
-}
-
-class PartialTableModel extends DefaultTableModel {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public boolean isCellEditable(int row, int col) {
- switch (col) {
- case 3:
- return false;
- default:
- return false;
- }
- }
-}