if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
String packageGuid = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getGuid();\r
String packageVersion = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getVersion();\r
- if (GlobalData.findModuleIdByGuidVersion(guid, version, packageGuid, packageVersion) != null) {\r
+ if (GlobalData.findModuleId(guid, version, packageGuid, packageVersion) != null) {\r
Log.wrn("Clone", "A module with same Guid and same Version already exists, please selece a new Guid or Version!");\r
return false;\r
}\r
}\r
\r
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
- if (GlobalData.findPackageIdByGuidVersion(guid, version) != null) {\r
+ if (GlobalData.findPackageId(guid, version) != null) {\r
Log.wrn("Clone", "A package with same Guid and same Version already exists, please selece a new Guid or Version!");\r
return false;\r
}\r
}\r
\r
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
- if (GlobalData.findPlatformIdByGuidVersion(guid, version) != null) {\r
+ if (GlobalData.findPlatformId(guid, version) != null) {\r
Log.wrn("Clone", "A platform with same Guid and same Version already exists, please selece a new Guid or Version!");\r
return false;\r
}\r
Log.wrn("Clone", "The target module already exists!");\r
return false;\r
}\r
+ if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {\r
+ Log.wrn("Clone", "There already exists a same directory with a module");\r
+ return false;\r
+ }\r
+ \r
return checkId(mode);\r
}\r
\r
Log.wrn("Clone", "The target package already exists!");\r
return false;\r
}\r
+ if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {\r
+ Log.wrn("Clone", "There already exists a same directory with a package");\r
+ return false;\r
+ }\r
+ \r
return checkId(mode);\r
}\r
\r
Log.wrn("Clone", "The target platform already exists.");\r
return false;\r
}\r
+ if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(trg), mode)) {\r
+ Log.wrn("Clone", "There already exists a same directory with a platform");\r
+ return false;\r
+ }\r
+ \r
return checkId(mode);\r
}\r
\r
\r
if (arg0.getSource() == this.jMenuItemFileCloseAll) {\r
this.closeAll();\r
+ this.refresh();\r
this.makeEmptyTree();\r
}\r
\r
iTree.removeNodeChildrenByPath(item);\r
}\r
\r
+ GlobalData.openingModuleList.reload(this.currentOpeningModuleIndex);\r
GlobalData.openingModuleList.setModuleOpen(this.currentOpeningModuleIndex, false);\r
GlobalData.openingModuleList.setModuleSaved(this.currentOpeningModuleIndex, true);\r
+ \r
this.cleanDesktopPaneModule();\r
this.currentOpeningModuleIndex = -1;\r
}\r
iTree.removeNodeChildrenByPath(item);\r
}\r
\r
+ GlobalData.openingPackageList.reload(this.currentOpeningPackageIndex);\r
GlobalData.openingPackageList.setPackageOpen(this.currentOpeningPackageIndex, false);\r
GlobalData.openingPackageList.setPackageSaved(this.currentOpeningPackageIndex, true);\r
this.cleanDesktopPanePackage();\r
iTree.removeNodeChildrenByPath(item);\r
}\r
\r
+ GlobalData.openingPlatformList.reload(this.currentOpeningPlatformIndex);\r
GlobalData.openingPlatformList.setPlatformOpen(this.currentOpeningPlatformIndex, false);\r
GlobalData.openingPlatformList.setPlatformSaved(this.currentOpeningPlatformIndex, true);\r
this.cleanDesktopPanePlatform();\r
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
import org.tianocore.frameworkwizard.common.DataType;\r
import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
import org.tianocore.frameworkwizard.common.IFileFilter;\r
import org.tianocore.frameworkwizard.common.Log;\r
import org.tianocore.frameworkwizard.common.SaveFile;\r
\r
**/\r
public boolean check() {\r
+ String path = this.jTextFieldFilePath.getText();\r
+ String guid = this.jTextFieldGuid.getText();\r
+ String version = this.jTextFieldVersion.getText();\r
+ \r
//\r
// Check if all required fields are not empty\r
//\r
- if (isEmpty(this.jTextFieldFilePath.getText())) {\r
+ if (isEmpty(path)) {\r
Log.wrn("New File", "A File Path must be entered!");\r
return false;\r
}\r
Log.wrn("New File", "A Name must be entered");\r
return false;\r
}\r
- if (isEmpty(this.jTextFieldGuid.getText())) {\r
+ if (isEmpty(guid)) {\r
Log.wrn("New File", "The Guid must be entered!");\r
return false;\r
}\r
- if (isEmpty(this.jTextFieldVersion.getText())) {\r
+ if (isEmpty(version)) {\r
Log.wrn("New File", "A Version number must be entered!");\r
return false;\r
}\r
Log.wrn("New File", "Incorrect data type for the Name!");\r
return false;\r
}\r
- if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {\r
+ if (!DataValidation.isGuid((guid))) {\r
Log.wrn("New File", "Incorrect data type for Guid, which must be in registry format! (8-4-4-4-12)");\r
return false;\r
}\r
+ \r
+\r
\r
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
//\r
// Check if the module is already existed in current package\r
//\r
String packagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();\r
- String modulePath = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());\r
+ String modulePath = Tools.convertPathToCurrentOsType(path);\r
Vector<String> msaFile = wt.getAllModulesOfPackage(packagePath);\r
\r
for (int index = 0; index < msaFile.size(); index++) {\r
return false;\r
}\r
}\r
+ \r
+ //\r
+ // Check if path already exists\r
+ //\r
+ if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(modulePath), mode)) {\r
+ Log.wrn("New File", "There already exists a same directory with a module");\r
+ return false;\r
+ }\r
+ \r
+ //\r
+ // Check if Guid+Version is unique\r
+ //\r
+ String packageGuid = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getGuid();\r
+ String packageVersion = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getVersion();\r
+ if (GlobalData.findModuleId(guid, version, packageGuid, packageVersion) != null) {\r
+ Log.wrn("New File", "A module with same Guid and same Version already exists, please selece a new Guid or Version!");\r
+ return false;\r
+ }\r
}\r
\r
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
//\r
// Check if the package is already existed in database\r
//\r
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());\r
+ path = Tools.convertPathToCurrentOsType(path);\r
Vector<PackageIdentification> vPackageList = wt.getAllPackages();\r
if (vPackageList != null && vPackageList.size() > 0) {\r
for (int index = 0; index < vPackageList.size(); index++) {\r
}\r
}\r
}\r
+ \r
+ //\r
+ // Check if path already exists\r
+ //\r
+ if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(path), mode)) {\r
+ Log.wrn("New File", "There already exists a same directory with a package");\r
+ return false;\r
+ }\r
+ \r
+ //\r
+ // Check if Guid+Version is unique\r
+ //\r
+ if (GlobalData.findPackageId(guid, version) != null) {\r
+ Log.wrn("New File", "A package with same Guid and same Version already exists, please selece a new Guid or Version!");\r
+ return false;\r
+ }\r
}\r
\r
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
//\r
// Check if the platform is already existed in database\r
//\r
- String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());\r
+ path = Tools.convertPathToCurrentOsType(path);\r
Vector<PlatformIdentification> vPlatfromList = wt.getAllPlatforms();\r
if (vPlatfromList != null && vPlatfromList.size() > 0) {\r
for (int index = 0; index < vPlatfromList.size(); index++) {\r
}\r
}\r
}\r
+ \r
+ //\r
+ // Check if path already exists\r
+ //\r
+ if (GlobalData.isDuplicateRelativePath(Tools.getFilePathOnly(path), mode)) {\r
+ Log.wrn("New File", "There already exists a same directory with a platform");\r
+ return false;\r
+ }\r
+ \r
+ //\r
+ // Check if Guid+Version is unique\r
+ //\r
+ if (GlobalData.findPlatformId(guid, version) != null) {\r
+ Log.wrn("New File", "A platform with same Guid and same Version already exists, please selece a new Guid or Version!");\r
+ return false;\r
+ }\r
}\r
\r
return true;\r
@return\r
\r
**/\r
- public static ModuleIdentification findModuleIdByGuidVersion(String moduleGuid, String moduleVersion,\r
- String packageGuid, String packageVersion) {\r
+ public static ModuleIdentification findModuleId(String moduleGuid, String moduleVersion, String packageGuid,\r
+ String packageVersion) {\r
ModuleIdentification mid = null;\r
for (int index = 0; index < vModuleList.size(); index++) {\r
if (vModuleList.elementAt(index).equals(moduleGuid, moduleVersion, packageGuid, packageVersion)) {\r
@return\r
\r
**/\r
- public static PackageIdentification findPackageIdByGuidVersion(String packageGuid, String packageVersion) {\r
+ public static PackageIdentification findPackageId(String packageGuid, String packageVersion) {\r
PackageIdentification pid = null;\r
for (int index = 0; index < vPackageList.size(); index++) {\r
if (vPackageList.elementAt(index).equals(packageGuid, packageVersion)) {\r
@return\r
\r
**/\r
- public static PlatformIdentification findPlatformIdByGuidVersion(String platformGuid, String platformVersion) {\r
+ public static PlatformIdentification findPlatformId(String platformGuid, String platformVersion) {\r
PlatformIdentification pid = null;\r
for (int index = 0; index < vPlatformList.size(); index++) {\r
if (vPlatformList.elementAt(index).equals(platformGuid, platformVersion)) {\r
}\r
return pid;\r
}\r
+\r
+ /**\r
+ \r
+ @param relativePath\r
+ @param mode\r
+ @return\r
+ \r
+ **/\r
+ public static boolean isDuplicateRelativePath(String relativePath, int mode) {\r
+ if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
+ for (int index = 0; index < vModuleList.size(); index++) {\r
+ String path = vModuleList.elementAt(index).getPath();\r
+ if (Tools.getFilePathOnly(path).equals(relativePath)) {\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
+ for (int index = 0; index < vPackageList.size(); index++) {\r
+ String path = vPackageList.elementAt(index).getPath();\r
+ if (Tools.getFilePathOnly(path).equals(relativePath)) {\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
+ for (int index = 0; index < vPlatformList.size(); index++) {\r
+ String path = vPlatformList.elementAt(index).getPath();\r
+ if (Tools.getFilePathOnly(path).equals(relativePath)) {\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+\r
+ return false;\r
+ }\r
}\r
}\r
return false;\r
}\r
+ \r
+ public void reload(int index) {\r
+ if (index > -1) {\r
+ vOpeningModuleList.elementAt(index).reload();\r
+ }\r
+ }\r
}\r
\r
package org.tianocore.frameworkwizard.common.Identifications;\r
\r
+import java.io.IOException;\r
+\r
+import org.apache.xmlbeans.XmlException;\r
import org.tianocore.ModuleSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.OpenFile;\r
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
\r
public class OpeningModuleType extends OpeningFileType{\r
public void setId(ModuleIdentification id) {\r
this.id = id;\r
}\r
+ \r
+ public void reload() {\r
+ if (this.id != null) {\r
+ String path = id.getPath();\r
+ if (path.length() > 0) {\r
+ try {\r
+ this.xmlMsa = OpenFile.openMsaFile(id.getPath());\r
+ } catch (IOException e) {\r
+ Log.err("Open Module Surface Area " + path, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.err("Open Module Surface Area " + path, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.err("Open Module Surface Area " + path, "Invalid file type");\r
+ }\r
+ }\r
+ }\r
+ }\r
}\r
}\r
return false;\r
}\r
+ \r
+ public void reload(int index) {\r
+ if (index > -1) {\r
+ vOpeningPackageList.elementAt(index).reload();\r
+ }\r
+ }\r
}\r
**/\r
package org.tianocore.frameworkwizard.common.Identifications;\r
\r
+import java.io.IOException;\r
+\r
+import org.apache.xmlbeans.XmlException;\r
import org.tianocore.PackageSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.OpenFile;\r
import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
public class OpeningPackageType extends OpeningFileType {\r
public void setId(PackageIdentification id) {\r
this.id = id;\r
}\r
+ \r
+ public void reload() {\r
+ if (this.id != null) {\r
+ String path = id.getPath();\r
+ if (path.length() > 0) {\r
+ try {\r
+ this.xmlSpd = OpenFile.openSpdFile(id.getPath());\r
+ } catch (IOException e) {\r
+ Log.err("Open Package Surface Area " + path, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.err("Open Package Surface Area " + path, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.err("Open Package Surface Area " + path, "Invalid file type");\r
+ }\r
+ }\r
+ }\r
+ }\r
}\r
}\r
return false;\r
}\r
+ \r
+ public void reload(int index) {\r
+ if (index > -1) {\r
+ vOpeningPlatformList.elementAt(index).reload();\r
+ }\r
+ }\r
}\r
**/\r
package org.tianocore.frameworkwizard.common.Identifications;\r
\r
+import java.io.IOException;\r
+\r
+import org.apache.xmlbeans.XmlException;\r
import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.OpenFile;\r
import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
\r
public class OpeningPlatformType extends OpeningFileType {\r
public void setId(PlatformIdentification id) {\r
this.id = id;\r
}\r
+ \r
+ public void reload() {\r
+ if (this.id != null) {\r
+ String path = id.getPath();\r
+ if (path.length() > 0) {\r
+ try {\r
+ this.xmlFpd = OpenFile.openFpdFile(id.getPath());\r
+ } catch (IOException e) {\r
+ Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
+ }\r
+ }\r
+ }\r
+ }\r
}\r
// Write Module Sa Info\r
//\r
ModuleIdentification moduleSaId = GlobalData\r
- .findModuleIdByGuidVersion(\r
- msa\r
- .getModuleGuid(),\r
- msa\r
- .getModuleVersion(),\r
- msa\r
- .getPackageGuid(),\r
- msa\r
- .getPackageVersion());\r
+ .findModuleId(\r
+ msa.getModuleGuid(),\r
+ msa\r
+ .getModuleVersion(),\r
+ msa.getPackageGuid(),\r
+ msa\r
+ .getPackageVersion());\r
tmp = tmp\r
+ TAB\r
+ TAB\r
if (mid.equals(i.getModuleGuid(), i.getModuleVersion(), i.getPackageGuid(),\r
i.getPackageVersion())) {\r
ModuleIdentification moduleSaId = GlobalData\r
- .findModuleIdByGuidVersion(\r
- msa\r
- .getModuleGuid(),\r
- msa\r
- .getModuleVersion(),\r
- msa\r
- .getPackageGuid(),\r
- msa\r
- .getPackageVersion());\r
+ .findModuleId(\r
+ msa\r
+ .getModuleGuid(),\r
+ msa\r
+ .getModuleVersion(),\r
+ msa\r
+ .getPackageGuid(),\r
+ msa\r
+ .getPackageVersion());\r
if (moduleSaId != null) {\r
vModuleSa.addElement(moduleSaId);\r
}\r
\r
package org.tianocore.frameworkwizard.module.Identifications;\r
\r
-\r
import java.io.IOException;\r
\r
import org.apache.xmlbeans.XmlException;\r
import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
public class ModuleIdentification extends Identification {\r
- \r
+\r
private PackageIdentification packageId;\r
- \r
+\r
private String moduleType;\r
- \r
+\r
private boolean isLibrary;\r
- \r
+\r
public ModuleIdentification(String name, String guid, String version, String path) {\r
- super(name, guid, version, path);\r
+ super(name, guid, version, path);\r
setModuleType();\r
}\r
- \r
+\r
public ModuleIdentification(String name, String guid, String version, String path, boolean library) {\r
super(name, guid, version, path);\r
this.isLibrary = library;\r
}\r
- \r
+\r
public ModuleIdentification(Identification id) {\r
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
}\r
- \r
+\r
public ModuleIdentification(Identification id, boolean library) {\r
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
this.isLibrary = library;\r
}\r
- \r
- public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId){\r
+\r
+ public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId) {\r
super(name, guid, version, path);\r
this.packageId = packageId;\r
setModuleType();\r
}\r
- \r
- public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId, String type){\r
+\r
+ public ModuleIdentification(String name, String guid, String version, String path, PackageIdentification packageId,\r
+ String type) {\r
super(name, guid, version, path);\r
this.packageId = packageId;\r
this.moduleType = type;\r
}\r
- \r
+\r
public ModuleIdentification(Identification id, PackageIdentification packageId) {\r
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
this.packageId = packageId;\r
setModuleType();\r
}\r
- \r
+\r
public ModuleIdentification(Identification id, PackageIdentification packageId, boolean library) {\r
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
this.packageId = packageId;\r
this.isLibrary = library;\r
}\r
- \r
+\r
public ModuleIdentification(Identification id, PackageIdentification packageId, String type) {\r
super(id.getName(), id.getGuid(), id.getVersion(), id.getPath());\r
this.packageId = packageId;\r
this.moduleType = type;\r
}\r
- \r
- public String toString(){\r
+\r
+ public String toString() {\r
return "Module " + this.getName() + "[" + this.getGuid() + "] in package " + packageId;\r
}\r
\r
public void setModuleType(String moduleType) {\r
this.moduleType = moduleType;\r
}\r
- \r
+\r
private void setModuleType() {\r
ModuleSurfaceArea msa = null;\r
try {\r
msa = OpenFile.openMsaFile(this.getPath());\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
- \r
+\r
} catch (XmlException e) {\r
// TODO Auto-generated catch block\r
- \r
+\r
} catch (Exception e) {\r
// TODO Auto-generated catch block\r
- \r
+\r
}\r
setModuleType(DataType.MODULE_TYPE_MODULE);\r
setLibrary(false);\r
}\r
}\r
}\r
- \r
+\r
public boolean equals(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {\r
boolean b = false;\r
if (this.getGuid().equals(moduleGuid) && this.getPackageId().getGuid().equals(packageGuid)) {\r