Restructuring for better separation of Tool packages.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1674 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
218
Tools/Java/Source/FrameworkWizard/FrameworkWizard.msa
Normal file
218
Tools/Java/Source/FrameworkWizard/FrameworkWizard.msa
Normal file
@ -0,0 +1,218 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" >
|
||||
<MsaHeader>
|
||||
<ModuleName>Framework Wizard</ModuleName>
|
||||
<ModuleType>TOOL</ModuleType>
|
||||
<GuidValue>EAC548CB-1B55-4d32-B3E1-F790095BF590</GuidValue>
|
||||
<Version>2.0</Version>
|
||||
<Abstract>This is the EFI/Tiano Tool Resources Module</Abstract>
|
||||
<Description>
|
||||
This Module provides the EFI/Tiano Tools that are used to create EFI/Tiano
|
||||
Modules and Platform Binary Files (PBF)
|
||||
These tools require compilation only once if the Developer Workstation and
|
||||
the Developer's choice of HOST tool chain are stable. If the developer
|
||||
updates either the OS or the HOST tool chain, these tools should be rebuilt.
|
||||
</Description>
|
||||
<Copyright>Copyright 2005-2006, Intel Corporation</Copyright>
|
||||
<License>
|
||||
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.
|
||||
</License>
|
||||
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||
</MsaHeader>
|
||||
<ModuleDefinitions>
|
||||
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||
<BinaryModule>false</BinaryModule>
|
||||
<OutputFileBasename>NULL</OutputFileBasename>
|
||||
</ModuleDefinitions>
|
||||
<SourceFiles>
|
||||
<Filename>build.xml</Filename>
|
||||
<Filename>FrameworkWizard.msa</Filename>
|
||||
<Filename>MANIFEST.MF</Filename>
|
||||
<Filename>rsc/resources/images/logo.gif</Filename>
|
||||
<Filename>rsc/resources/images/No.JPG</Filename>
|
||||
<Filename>rsc/resources/images/Yes.JPG</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/About.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/Clone.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/FrameworkWizardUI.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/NewFileChooser.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/SelectModuleBelong.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/SplashScreen.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/ToolChainConfig.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/DataType.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/DataValidation.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/EnumerationData.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/FileOperation.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/GlobalData.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/IDefaultTableModel.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/IFileFilter.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Log.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/OpenFile.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/SaveFile.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Sort.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Tools.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/XmlConfig.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/find/Find.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/find/FindResult.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/find/GuidId.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/find/LibraryClassId.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/find/PcdId.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/find/PpiId.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/find/ProtocolId.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/Identification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningFileType.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleList.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningModuleType.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageList.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPackageType.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformList.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/OpeningPlatformType.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigId.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/ArchCheckBox.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/ExitConfirm.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/IComboBox.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/IDefaultMutableTreeNode.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/IDesktopManager.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/IDialog.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/IFrame.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/IInternalFrame.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/ITree.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/StarLabel.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListCellRenderer.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListener.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListModel.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/AggregationOperation.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/DistributeRule.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/Far.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/FarFileItem.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/FarHeader.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/FarIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/FarInterface.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/FarMd5.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/FarPackage.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/FarPlatformItem.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/Mainfest.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/ManifestInterface.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/PackageQuery.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/PackageQueryInterface.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepFour.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepOne.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepThree.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepOne.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/deleteui/DeleteStepTwo.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/installui/InstallStepOne.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/installui/InstallStepTwo.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/updateui/UpdateStepOne.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/far/updateui/UpdateStepTwo.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/BootModes/BootModesVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/DataHubs/DataHubsVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Externs/ExternsVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Guids/GuidsVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/HiiPackages/HiiPackagesVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/PackageDependencies/PackageDependenciesVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdCodedVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/PcdCoded/PcdVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Ppis/PpisVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Protocols/ProtocolsVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/SourceFiles/SourceFilesVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/SystemTables/SystemTablesVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/Identifications/Variables/VariablesVector.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleBootModes.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleDataHubs.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleDefinitions.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleExterns.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleGuids.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleHiiPackages.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleHobs.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleLibraryClassDefinitions.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModulePackageDependencies.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModulePpis.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleProtocols.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleSourceFiles.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleSystemTables.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/ModuleVariables.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/BootModesDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/DataHubsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/ExternsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/GuidsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/HiiPackagesDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/PackageDepDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/PCDsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/PpisDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/ProtocolsDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/SystemTablesDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/module/ui/dialog/VariablesDlg.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/PackageIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageDefinitions.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/PlatformIdentification.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/DynamicTree.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/TableSorter.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/workspace/Workspace.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java</Filename>
|
||||
<Filename>src/org/tianocore/frameworkwizard/workspace/ui/SwitchWorkspace.java</Filename>
|
||||
</SourceFiles>
|
||||
</ModuleSurfaceArea>
|
2
Tools/Java/Source/FrameworkWizard/MANIFEST.MF
Normal file
2
Tools/Java/Source/FrameworkWizard/MANIFEST.MF
Normal file
@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: org.tianocore.frameworkwizard.FrameworkWizardUI
|
44
Tools/Java/Source/FrameworkWizard/build.xml
Normal file
44
Tools/Java/Source/FrameworkWizard/build.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<project name="FrameworkWizard" default="FrameworkWizard" basedir=".">
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
|
||||
<property environment="env"/>
|
||||
<property name="WORKSPACE" value="${env.WORKSPACE}"/>
|
||||
<path id="classpath">
|
||||
<fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
|
||||
<fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
|
||||
</path>
|
||||
<property name="buildDir" value="build"/>
|
||||
<property name="resourceDir" value="rsc"/>
|
||||
<property name="installLocation" value="${WORKSPACE}/Tools/bin"/>
|
||||
<target name="FrameworkWizard" depends="install"/>
|
||||
<target name="source">
|
||||
<mkdir dir="${buildDir}"/>
|
||||
<javac srcdir="src" destdir="${buildDir}">
|
||||
<classpath refid="classpath"/>
|
||||
<!-- <compilerarg value="-Xlint"/> -->
|
||||
</javac>
|
||||
</target>
|
||||
<target name="clean">
|
||||
<delete dir="${buildDir}"/>
|
||||
</target>
|
||||
<target name="cleanall">
|
||||
<delete dir="${buildDir}"/>
|
||||
<delete file="${installLocation}/FrameworkWizard.jar"/>
|
||||
</target>
|
||||
<target name="install" depends="source">
|
||||
<jar destfile="${installLocation}/FrameworkWizard.jar" manifest="MANIFEST.MF">
|
||||
<fileset dir="${buildDir}"/>
|
||||
<fileset dir="${resourceDir}"/>
|
||||
</jar>
|
||||
</target>
|
||||
</project>
|
BIN
Tools/Java/Source/FrameworkWizard/rsc/resources/images/No.JPG
Normal file
BIN
Tools/Java/Source/FrameworkWizard/rsc/resources/images/No.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
Tools/Java/Source/FrameworkWizard/rsc/resources/images/Yes.JPG
Normal file
BIN
Tools/Java/Source/FrameworkWizard/rsc/resources/images/Yes.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
Tools/Java/Source/FrameworkWizard/rsc/resources/images/logo.gif
Normal file
BIN
Tools/Java/Source/FrameworkWizard/rsc/resources/images/logo.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
@ -0,0 +1,161 @@
|
||||
/** @file
|
||||
|
||||
To show a about window with copyright 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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.ui.IDialog;
|
||||
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
/**
|
||||
The class is used to show a about window with copyright information
|
||||
It extends IDialog
|
||||
|
||||
**/
|
||||
public class About extends IDialog {
|
||||
|
||||
///
|
||||
/// Define Class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = 2958136136667310962L;
|
||||
|
||||
///
|
||||
/// Define Class Members
|
||||
///
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JLabel jLabel = null;
|
||||
|
||||
private JLabel jLabel1 = null;
|
||||
|
||||
private JLabel jLabel2 = null;
|
||||
|
||||
private JButton jButtonOK = null;
|
||||
|
||||
private JLabel jLabelImage = null;
|
||||
|
||||
/**
|
||||
This method initializes jButtonOK
|
||||
|
||||
@return javax.swing.JButton jButtonOK
|
||||
|
||||
**/
|
||||
private JButton getJButtonOK() {
|
||||
if (jButtonOK == null) {
|
||||
jButtonOK = new JButton();
|
||||
jButtonOK.setBounds(new java.awt.Rectangle(115, 200, 90, 20));
|
||||
jButtonOK.setText("OK");
|
||||
jButtonOK.addActionListener(this);
|
||||
}
|
||||
return jButtonOK;
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public About() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public About(IFrame parentFrame, boolean modal) {
|
||||
super(parentFrame, modal);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes this
|
||||
|
||||
**/
|
||||
private void init() {
|
||||
this.setSize(320, 265);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setTitle("About");
|
||||
this.getRootPane().setDefaultButton(jButtonOK);
|
||||
this.centerWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jContentPane
|
||||
|
||||
@return javax.swing.JPanel jContentPane
|
||||
|
||||
**/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jLabelImage = new JLabel();
|
||||
jLabelImage.setBounds(new java.awt.Rectangle(63, 20, 193, 58));
|
||||
jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/logo.gif")));
|
||||
|
||||
jLabel2 = new JLabel();
|
||||
jLabel2.setBounds(new java.awt.Rectangle(25, 160, 270, 20));
|
||||
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel2.setText("All rights reserved");
|
||||
jLabel1 = new JLabel();
|
||||
jLabel1.setBounds(new java.awt.Rectangle(25, 130, 270, 20));
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel1.setText("Copyright (c) 2006, Intel Corporation");
|
||||
jLabel = new JLabel();
|
||||
jLabel.setToolTipText("");
|
||||
jLabel.setBounds(new java.awt.Rectangle(25, 90, 270, 20));
|
||||
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION);
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.setSize(new java.awt.Dimension(320, 235));
|
||||
jContentPane.add(jLabel, null);
|
||||
jContentPane.add(jLabel1, null);
|
||||
jContentPane.add(jLabel2, null);
|
||||
jContentPane.add(getJButtonOK(), null);
|
||||
jContentPane.add(jLabelImage, null);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*
|
||||
* Override actionPerformed to listen all actions
|
||||
*/
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == jButtonOK) {
|
||||
returnType = DataType.RETURN_TYPE_OK;
|
||||
this.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Dispose when windows is closing
|
||||
|
||||
@param arg0
|
||||
|
||||
**/
|
||||
public void windowClosing(WindowEvent arg0) {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,228 @@
|
||||
/** @file
|
||||
|
||||
The file is used to show a new file chooser dialog
|
||||
|
||||
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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JRadioButton;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.ui.IDialog;
|
||||
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||
|
||||
public class NewFileChooser extends IDialog {
|
||||
|
||||
/**
|
||||
Define class members
|
||||
|
||||
**/
|
||||
private static final long serialVersionUID = -3657926400683618281L;
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JButton jButtonNext = null;
|
||||
|
||||
private JButton jButtonCancel = null;
|
||||
|
||||
private JRadioButton jRadioButtonModule = null;
|
||||
|
||||
private JRadioButton jRadioButtonPackage = null;
|
||||
|
||||
private JRadioButton jRadioButtonPlatform = null;
|
||||
|
||||
private JRadioButton jRadioButtonBuildXml = null;
|
||||
|
||||
private final ButtonGroup buttonGroup = new ButtonGroup();
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public NewFileChooser() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public NewFileChooser(IFrame parentFrame, boolean modal) {
|
||||
super(parentFrame, modal);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonOk
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonOk() {
|
||||
if (jButtonNext == null) {
|
||||
jButtonNext = new JButton();
|
||||
jButtonNext.setBounds(new java.awt.Rectangle(90, 150, 80, 20));
|
||||
jButtonNext.setText("Next");
|
||||
jButtonNext.addActionListener(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(180, 150, 80, 20));
|
||||
jButtonCancel.setText("Cancel");
|
||||
jButtonCancel.addActionListener(this);
|
||||
}
|
||||
return jButtonCancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonModule
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonModule() {
|
||||
if (jRadioButtonModule == null) {
|
||||
jRadioButtonModule = new JRadioButton();
|
||||
jRadioButtonModule.setText(DataType.MODULE_SURFACE_AREA);
|
||||
jRadioButtonModule.setBounds(new java.awt.Rectangle(20, 20, 240, 20));
|
||||
jRadioButtonModule.setSelected(true);
|
||||
}
|
||||
return jRadioButtonModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonPackage
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonPackage() {
|
||||
if (jRadioButtonPackage == null) {
|
||||
jRadioButtonPackage = new JRadioButton();
|
||||
jRadioButtonPackage.setText(DataType.PACKAGE_SURFACE_AREA);
|
||||
jRadioButtonPackage.setBounds(new java.awt.Rectangle(20, 50, 240, 20));
|
||||
}
|
||||
return jRadioButtonPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonPlatform
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonPlatform() {
|
||||
if (jRadioButtonPlatform == null) {
|
||||
jRadioButtonPlatform = new JRadioButton();
|
||||
jRadioButtonPlatform.setText(DataType.PLATFORM_SURFACE_AREA);
|
||||
jRadioButtonPlatform.setBounds(new java.awt.Rectangle(20, 80, 240, 20));
|
||||
}
|
||||
return jRadioButtonPlatform;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonBuildXml
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonBuildXml() {
|
||||
if (jRadioButtonBuildXml == null) {
|
||||
jRadioButtonBuildXml = new JRadioButton();
|
||||
jRadioButtonBuildXml.setText(DataType.ANT_BUILD_FILE);
|
||||
jRadioButtonBuildXml.setBounds(new java.awt.Rectangle(20, 110, 240, 20));
|
||||
jRadioButtonBuildXml.setVisible(false);
|
||||
}
|
||||
return jRadioButtonBuildXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
NewFileChooser nfc = new NewFileChooser();
|
||||
nfc.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void init() {
|
||||
this.setSize(310, 220);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setTitle("Select New File Type");
|
||||
this.centerWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.add(getJButtonOk(), null);
|
||||
jContentPane.add(getJButtonCancel(), null);
|
||||
jContentPane.add(getJRadioButtonModule(), null);
|
||||
jContentPane.add(getJRadioButtonPackage(), null);
|
||||
jContentPane.add(getJRadioButtonPlatform(), null);
|
||||
jContentPane.add(getJRadioButtonBuildXml(), null);
|
||||
buttonGroup.add(this.getJRadioButtonModule());
|
||||
buttonGroup.add(this.getJRadioButtonPackage());
|
||||
buttonGroup.add(this.getJRadioButtonPlatform());
|
||||
buttonGroup.add(this.getJRadioButtonBuildXml());
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*
|
||||
* Override actionPerformed to listen all actions
|
||||
*/
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == jButtonCancel) {
|
||||
this.setVisible(false);
|
||||
returnType = DataType.RETURN_TYPE_CANCEL;
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonNext) {
|
||||
this.setVisible(false);
|
||||
if (this.jRadioButtonModule.isSelected()) {
|
||||
returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
|
||||
}
|
||||
if (this.jRadioButtonPackage.isSelected()) {
|
||||
returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
|
||||
}
|
||||
if (this.jRadioButtonPlatform.isSelected()) {
|
||||
returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
|
||||
}
|
||||
if (this.jRadioButtonBuildXml.isSelected()) {
|
||||
returnType = DataType.RETURN_TYPE_BUILD_XML;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,743 @@
|
||||
/** @file
|
||||
|
||||
The file is used to let user choose to create module in an existing package
|
||||
or to create a new package first.
|
||||
|
||||
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;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import org.tianocore.ModuleTypeDef;
|
||||
import org.tianocore.MsaHeaderDocument;
|
||||
import org.tianocore.SpdHeaderDocument;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||
import org.tianocore.PlatformHeaderDocument.PlatformHeader;
|
||||
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.DataValidation;
|
||||
import org.tianocore.frameworkwizard.common.IFileFilter;
|
||||
import org.tianocore.frameworkwizard.common.Log;
|
||||
import org.tianocore.frameworkwizard.common.SaveFile;
|
||||
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.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
import org.tianocore.frameworkwizard.workspace.Workspace;
|
||||
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||
import javax.swing.JRadioButton;
|
||||
|
||||
public class SelectModuleBelong extends IDialog {
|
||||
|
||||
/**
|
||||
Define class members
|
||||
|
||||
**/
|
||||
private static final long serialVersionUID = 4171355136991448972L;
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JComboBox jComboBoxExistingPackage = null;
|
||||
|
||||
private JButton jButtonOk = null;
|
||||
|
||||
private JButton jButtonCancel = null;
|
||||
|
||||
private Vector<PackageIdentification> packages = null;
|
||||
|
||||
private JLabel jLabelPackage = null;
|
||||
|
||||
private JLabel jLabelFilePath = null;
|
||||
|
||||
private JTextField jTextFieldFilePath = null;
|
||||
|
||||
private JButton jButtonBrowse = null;
|
||||
|
||||
private JLabel jLabelName = null;
|
||||
|
||||
private JTextField jTextFieldName = null;
|
||||
|
||||
private JLabel jLabelGuid = null;
|
||||
|
||||
private JTextField jTextFieldGuid = null;
|
||||
|
||||
private JButton jButtonGen = null;
|
||||
|
||||
private JLabel jLabelVersion = null;
|
||||
|
||||
private JTextField jTextFieldVersion = null;
|
||||
|
||||
private StarLabel jStarLabel1 = null;
|
||||
|
||||
private StarLabel jStarLabel2 = null;
|
||||
|
||||
private StarLabel jStarLabel3 = null;
|
||||
|
||||
private StarLabel jStarLabel4 = null;
|
||||
|
||||
private StarLabel jStarLabel5 = null;
|
||||
|
||||
private ButtonGroup bg = new ButtonGroup();
|
||||
|
||||
private WorkspaceTools wt = new WorkspaceTools();
|
||||
|
||||
private ModuleIdentification mid = null;
|
||||
|
||||
private PackageIdentification pid = null;
|
||||
|
||||
private PlatformIdentification fid = null;
|
||||
|
||||
private ModuleSurfaceArea msa = null;
|
||||
|
||||
private PackageSurfaceArea spd = null;
|
||||
|
||||
private PlatformSurfaceArea fpd = null;
|
||||
|
||||
private int mode = -1;
|
||||
|
||||
private JLabel jLabelIsLibrary = null;
|
||||
|
||||
private JRadioButton jRadioButtonYes = null;
|
||||
|
||||
private JRadioButton jRadioButtonNo = null;
|
||||
|
||||
/**
|
||||
* This method initializes jComboBoxExistingPackage
|
||||
*
|
||||
* @return javax.swing.JComboBox
|
||||
*/
|
||||
private JComboBox getJComboBoxExistingPackage() {
|
||||
if (jComboBoxExistingPackage == null) {
|
||||
jComboBoxExistingPackage = new JComboBox();
|
||||
jComboBoxExistingPackage.setBounds(new java.awt.Rectangle(140, 10, 340, 20));
|
||||
}
|
||||
return jComboBoxExistingPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonNext
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonOk() {
|
||||
if (jButtonOk == null) {
|
||||
jButtonOk = new JButton();
|
||||
jButtonOk.setBounds(new java.awt.Rectangle(310, 165, 80, 20));
|
||||
jButtonOk.setText("Ok");
|
||||
jButtonOk.addActionListener(this);
|
||||
}
|
||||
return jButtonOk;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonCancel
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonCancel() {
|
||||
if (jButtonCancel == null) {
|
||||
jButtonCancel = new JButton();
|
||||
jButtonCancel.setBounds(new java.awt.Rectangle(395, 165, 80, 20));
|
||||
jButtonCancel.setText("Cancel");
|
||||
jButtonCancel.addActionListener(this);
|
||||
}
|
||||
return jButtonCancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTextFieldFilePath
|
||||
*
|
||||
* @return javax.swing.JTextField
|
||||
*/
|
||||
private JTextField getJTextFieldFilePath() {
|
||||
if (jTextFieldFilePath == null) {
|
||||
jTextFieldFilePath = new JTextField();
|
||||
jTextFieldFilePath.setBounds(new java.awt.Rectangle(140, 60, 250, 20));
|
||||
}
|
||||
return jTextFieldFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonBrowse
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonBrowse() {
|
||||
if (jButtonBrowse == null) {
|
||||
jButtonBrowse = new JButton();
|
||||
jButtonBrowse.setBounds(new java.awt.Rectangle(395, 60, 85, 20));
|
||||
jButtonBrowse.setText("Browse");
|
||||
jButtonBrowse.addActionListener(this);
|
||||
}
|
||||
return jButtonBrowse;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTextFieldModuleName
|
||||
*
|
||||
* @return javax.swing.JTextField
|
||||
*/
|
||||
private JTextField getJTextFieldName() {
|
||||
if (jTextFieldName == null) {
|
||||
jTextFieldName = new JTextField();
|
||||
jTextFieldName.setBounds(new java.awt.Rectangle(140, 85, 340, 20));
|
||||
}
|
||||
return jTextFieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTextFieldGuid
|
||||
*
|
||||
* @return javax.swing.JTextField
|
||||
*/
|
||||
private JTextField getJTextFieldGuid() {
|
||||
if (jTextFieldGuid == null) {
|
||||
jTextFieldGuid = new JTextField();
|
||||
jTextFieldGuid.setBounds(new java.awt.Rectangle(140, 110, 250, 20));
|
||||
}
|
||||
return jTextFieldGuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonGen
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonGen() {
|
||||
if (jButtonGen == null) {
|
||||
jButtonGen = new JButton();
|
||||
jButtonGen.setBounds(new java.awt.Rectangle(395, 110, 85, 20));
|
||||
jButtonGen.setText("GEN");
|
||||
jButtonGen.addActionListener(this);
|
||||
}
|
||||
return jButtonGen;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jTextFieldVersion
|
||||
*
|
||||
* @return javax.swing.JTextField
|
||||
*/
|
||||
private JTextField getJTextFieldVersion() {
|
||||
if (jTextFieldVersion == null) {
|
||||
jTextFieldVersion = new JTextField();
|
||||
jTextFieldVersion.setBounds(new java.awt.Rectangle(140, 135, 340, 20));
|
||||
}
|
||||
return jTextFieldVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonYes
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonYes() {
|
||||
if (jRadioButtonYes == null) {
|
||||
jRadioButtonYes = new JRadioButton();
|
||||
jRadioButtonYes.setBounds(new java.awt.Rectangle(140, 35, 100, 20));
|
||||
jRadioButtonYes.setSelected(false);
|
||||
jRadioButtonYes.setText("Yes");
|
||||
}
|
||||
return jRadioButtonYes;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jRadioButtonNo
|
||||
*
|
||||
* @return javax.swing.JRadioButton
|
||||
*/
|
||||
private JRadioButton getJRadioButtonNo() {
|
||||
if (jRadioButtonNo == null) {
|
||||
jRadioButtonNo = new JRadioButton();
|
||||
jRadioButtonNo.setBounds(new java.awt.Rectangle(300, 35, 110, 20));
|
||||
jRadioButtonNo.setSelected(true);
|
||||
jRadioButtonNo.setText("No");
|
||||
}
|
||||
return jRadioButtonNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
SelectModuleBelong smb = new SelectModuleBelong();
|
||||
smb.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public SelectModuleBelong() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public SelectModuleBelong(IFrame parentFrame, boolean modal, int fileType) {
|
||||
super(parentFrame, modal);
|
||||
this.mode = fileType;
|
||||
init();
|
||||
initExistingPackage();
|
||||
if (mode != DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
|
||||
this.jStarLabel1.setVisible(false);
|
||||
this.jLabelPackage.setVisible(false);
|
||||
this.jComboBoxExistingPackage.setVisible(false);
|
||||
this.jLabelIsLibrary.setVisible(false);
|
||||
this.jRadioButtonYes.setVisible(false);
|
||||
this.jRadioButtonNo.setVisible(false);
|
||||
upLocation(this.jStarLabel2, 50);
|
||||
upLocation(this.jStarLabel3, 50);
|
||||
upLocation(this.jStarLabel4, 50);
|
||||
upLocation(this.jStarLabel5, 50);
|
||||
upLocation(this.jLabelFilePath, 50);
|
||||
upLocation(this.jLabelName, 50);
|
||||
upLocation(this.jLabelGuid, 50);
|
||||
upLocation(this.jLabelVersion, 50);
|
||||
upLocation(this.jTextFieldFilePath, 50);
|
||||
upLocation(this.jTextFieldName, 50);
|
||||
upLocation(this.jTextFieldGuid, 50);
|
||||
upLocation(this.jTextFieldVersion, 50);
|
||||
upLocation(this.jButtonBrowse, 50);
|
||||
upLocation(this.jButtonGen, 50);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void init() {
|
||||
this.setSize(500, 230);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setTitle("New");
|
||||
this.centerWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jLabelIsLibrary = new JLabel();
|
||||
jLabelIsLibrary.setBounds(new java.awt.Rectangle(15, 35, 120, 20));
|
||||
jLabelIsLibrary.setText("Is this a Library");
|
||||
jLabelVersion = new JLabel();
|
||||
jLabelVersion.setBounds(new java.awt.Rectangle(15, 135, 120, 20));
|
||||
jLabelVersion.setText("Version");
|
||||
jLabelGuid = new JLabel();
|
||||
jLabelGuid.setBounds(new java.awt.Rectangle(15, 110, 120, 20));
|
||||
jLabelGuid.setText("Guid");
|
||||
jLabelName = new JLabel();
|
||||
jLabelName.setBounds(new java.awt.Rectangle(15, 85, 120, 20));
|
||||
jLabelName.setText("Module Name");
|
||||
jLabelFilePath = new JLabel();
|
||||
jLabelFilePath.setBounds(new java.awt.Rectangle(15, 60, 120, 20));
|
||||
jLabelFilePath.setText("File Path");
|
||||
jLabelPackage = new JLabel();
|
||||
jLabelPackage.setBounds(new java.awt.Rectangle(15, 10, 120, 20));
|
||||
jLabelPackage.setText("Choose a Package");
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.setSize(new java.awt.Dimension(490, 198));
|
||||
jContentPane.add(getJComboBoxExistingPackage(), null);
|
||||
jContentPane.add(getJButtonOk(), null);
|
||||
jContentPane.add(getJButtonCancel(), null);
|
||||
jContentPane.add(jLabelPackage, null);
|
||||
jContentPane.add(jLabelFilePath, null);
|
||||
jContentPane.add(getJTextFieldFilePath(), null);
|
||||
jContentPane.add(getJButtonBrowse(), null);
|
||||
jContentPane.add(jLabelName, null);
|
||||
jContentPane.add(getJTextFieldName(), null);
|
||||
jContentPane.add(jLabelGuid, null);
|
||||
jContentPane.add(getJTextFieldGuid(), null);
|
||||
jContentPane.add(getJButtonGen(), null);
|
||||
jContentPane.add(jLabelVersion, null);
|
||||
jContentPane.add(getJTextFieldVersion(), null);
|
||||
|
||||
jStarLabel1 = new StarLabel();
|
||||
jStarLabel1.setLocation(new java.awt.Point(0, 10));
|
||||
jStarLabel2 = new StarLabel();
|
||||
jStarLabel2.setLocation(new java.awt.Point(0, 60));
|
||||
jStarLabel3 = new StarLabel();
|
||||
jStarLabel3.setLocation(new java.awt.Point(0, 85));
|
||||
jStarLabel4 = new StarLabel();
|
||||
jStarLabel4.setLocation(new java.awt.Point(0, 110));
|
||||
jStarLabel5 = new StarLabel();
|
||||
jStarLabel5.setLocation(new java.awt.Point(0, 135));
|
||||
jContentPane.add(jStarLabel1, null);
|
||||
jContentPane.add(jStarLabel2, null);
|
||||
jContentPane.add(jStarLabel3, null);
|
||||
jContentPane.add(jStarLabel4, null);
|
||||
jContentPane.add(jStarLabel5, null);
|
||||
jContentPane.add(jLabelIsLibrary, null);
|
||||
jContentPane.add(getJRadioButtonYes(), null);
|
||||
jContentPane.add(getJRadioButtonNo(), null);
|
||||
bg.add(getJRadioButtonNo());
|
||||
bg.add(getJRadioButtonYes());
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/**
|
||||
Query all existing packages and fill them into combox
|
||||
|
||||
**/
|
||||
private void initExistingPackage() {
|
||||
packages = wt.getAllPackages();
|
||||
for (int index = 0; index < packages.size(); index++) {
|
||||
this.jComboBoxExistingPackage.addItem(packages.elementAt(index).getName());
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*
|
||||
* Override actionPerformed to listen all actions
|
||||
*/
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == jButtonCancel) {
|
||||
this.setVisible(false);
|
||||
this.returnType = DataType.RETURN_TYPE_CANCEL;
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonOk) {
|
||||
if (this.check()) {
|
||||
this.save();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
this.setVisible(false);
|
||||
this.returnType = DataType.RETURN_TYPE_OK;
|
||||
}
|
||||
|
||||
if (arg0.getSource() == this.jButtonGen) {
|
||||
this.jTextFieldGuid.setText(Tools.generateUuidString());
|
||||
}
|
||||
|
||||
if (arg0.getSource() == this.jButtonBrowse) {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
|
||||
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
|
||||
fc.setCurrentDirectory(new File(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())
|
||||
.getPath()));
|
||||
fc.addChoosableFileFilter(new IFileFilter(DataType.MODULE_SURFACE_AREA_EXT));
|
||||
}
|
||||
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
|
||||
fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
|
||||
fc.addChoosableFileFilter(new IFileFilter(DataType.PACKAGE_SURFACE_AREA_EXT));
|
||||
}
|
||||
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
|
||||
fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));
|
||||
fc.addChoosableFileFilter(new IFileFilter(DataType.PLATFORM_SURFACE_AREA_EXT));
|
||||
}
|
||||
int result = fc.showSaveDialog(new JPanel());
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
this.jTextFieldFilePath.setText(Tools.addPathExt(fc.getSelectedFile().getPath(), mode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Data validation for all fields
|
||||
|
||||
@retval true - All datas are valid
|
||||
@retval false - At least one data is invalid
|
||||
|
||||
**/
|
||||
public boolean check() {
|
||||
//
|
||||
// Check if all required fields are not empty
|
||||
//
|
||||
if (isEmpty(this.jTextFieldFilePath.getText())) {
|
||||
Log.wrn("New File", "A File Path must be entered!");
|
||||
return false;
|
||||
}
|
||||
if (isEmpty(this.jTextFieldName.getText())) {
|
||||
Log.wrn("New File", "A Name must be entered");
|
||||
return false;
|
||||
}
|
||||
if (isEmpty(this.jTextFieldGuid.getText())) {
|
||||
Log.wrn("New File", "The Guid must be entered!");
|
||||
return false;
|
||||
}
|
||||
if (isEmpty(this.jTextFieldVersion.getText())) {
|
||||
Log.wrn("New File", "A Version number must be entered!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Check if all fields have correct data types
|
||||
//
|
||||
if (!DataValidation.isBaseName(this.jTextFieldName.getText())) {
|
||||
Log.wrn("New File", "Incorrect data type for the Name!");
|
||||
return false;
|
||||
}
|
||||
if (!DataValidation.isGuid((this.jTextFieldGuid).getText())) {
|
||||
Log.wrn("New File", "Incorrect data type for Guid, which must be in registry format! (8-4-4-4-12)");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
|
||||
//
|
||||
// Check if the module is already existed in current package
|
||||
//
|
||||
String packagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();
|
||||
String modulePath = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
|
||||
Vector<String> msaFile = wt.getAllModulesOfPackage(packagePath);
|
||||
|
||||
for (int index = 0; index < msaFile.size(); index++) {
|
||||
if (msaFile.elementAt(index).equals(modulePath)) {
|
||||
Log.wrn("New File", "This module is already exists in the selected package!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
|
||||
//
|
||||
// Check if the package is already existed in database
|
||||
//
|
||||
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
|
||||
Vector<PackageIdentification> vPackageList = wt.getAllPackages();
|
||||
if (vPackageList != null && vPackageList.size() > 0) {
|
||||
for (int index = 0; index < vPackageList.size(); index++) {
|
||||
if (vPackageList.get(index).getPath().equals(path)) {
|
||||
Log.wrn("New File", "This package is already exists in this workspace!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
|
||||
//
|
||||
// Check if the platform is already existed in database
|
||||
//
|
||||
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
|
||||
Vector<PlatformIdentification> vPlatfromList = wt.getAllPlatforms();
|
||||
if (vPlatfromList != null && vPlatfromList.size() > 0) {
|
||||
for (int index = 0; index < vPlatfromList.size(); index++) {
|
||||
if (vPlatfromList.get(index).getPath().equals(path)) {
|
||||
Log.wrn("New File", "This platform is already exists in this workspace!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
Save file
|
||||
|
||||
**/
|
||||
public void save() {
|
||||
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
|
||||
this.saveModule();
|
||||
}
|
||||
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
|
||||
this.savePackage();
|
||||
}
|
||||
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
|
||||
this.savePlatform();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Save all components of Msa Header
|
||||
|
||||
**/
|
||||
private void saveModule() {
|
||||
msa = null;
|
||||
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
|
||||
|
||||
//
|
||||
// Save to memory
|
||||
//
|
||||
try {
|
||||
MsaHeaderDocument.MsaHeader msaHeader = null;
|
||||
|
||||
msa = ModuleSurfaceArea.Factory.newInstance();
|
||||
msaHeader = MsaHeaderDocument.MsaHeader.Factory.newInstance();
|
||||
|
||||
msaHeader.setModuleName(this.jTextFieldName.getText());
|
||||
msaHeader.setGuidValue(this.jTextFieldGuid.getText());
|
||||
msaHeader.setVersion(this.jTextFieldVersion.getText());
|
||||
msaHeader.setModuleType(ModuleTypeDef.BASE);
|
||||
|
||||
msa.setMsaHeader(msaHeader);
|
||||
} catch (Exception e) {
|
||||
Log.err("Save ModuleSurfaceArea Document", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Save to real file
|
||||
//
|
||||
try {
|
||||
SaveFile.saveMsaFile(path, msa);
|
||||
} catch (Exception e) {
|
||||
Log.wrn("Save Module to file system", e.getMessage());
|
||||
Log.err("Save Module to file system", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Save to identification
|
||||
//
|
||||
mid = new ModuleIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
|
||||
this.jTextFieldVersion.getText(), path, jRadioButtonYes.isSelected());
|
||||
mid.setPackageId(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()));
|
||||
}
|
||||
|
||||
/**
|
||||
Save all components of Spd Header
|
||||
|
||||
**/
|
||||
private void savePackage() {
|
||||
spd = null;
|
||||
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
|
||||
|
||||
//
|
||||
// Save to memory
|
||||
//
|
||||
try {
|
||||
SpdHeaderDocument.SpdHeader spdHeader = null;
|
||||
|
||||
spd = PackageSurfaceArea.Factory.newInstance();
|
||||
spdHeader = SpdHeaderDocument.SpdHeader.Factory.newInstance();
|
||||
|
||||
spdHeader.setPackageName(this.jTextFieldName.getText());
|
||||
spdHeader.setGuidValue(this.jTextFieldGuid.getText());
|
||||
spdHeader.setVersion(this.jTextFieldVersion.getText());
|
||||
|
||||
spd.setSpdHeader(spdHeader);
|
||||
} catch (Exception e) {
|
||||
Log.wrn("Save Package Surface Area Description Document", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Save to real file
|
||||
//
|
||||
try {
|
||||
SaveFile.saveSpdFile(path, spd);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.wrn("Save Package to file system", e.getMessage());
|
||||
Log.err("Save Package to file system", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Save to identification
|
||||
//
|
||||
pid = new PackageIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
|
||||
this.jTextFieldVersion.getText(), path);
|
||||
}
|
||||
|
||||
/**
|
||||
Save all components of Fpd Header
|
||||
|
||||
**/
|
||||
private void savePlatform() {
|
||||
fpd = null;
|
||||
String path = Tools.convertPathToCurrentOsType(this.jTextFieldFilePath.getText());
|
||||
|
||||
//
|
||||
// Save to memory
|
||||
//
|
||||
try {
|
||||
PlatformHeader fpdHeader = null;
|
||||
|
||||
fpd = PlatformSurfaceArea.Factory.newInstance();
|
||||
fpdHeader = PlatformHeader.Factory.newInstance();
|
||||
|
||||
fpdHeader.setPlatformName(this.jTextFieldName.getText());
|
||||
fpdHeader.setGuidValue(this.jTextFieldGuid.getText());
|
||||
fpdHeader.setVersion(this.jTextFieldVersion.getText());
|
||||
|
||||
fpd.setPlatformHeader(fpdHeader);
|
||||
} catch (Exception e) {
|
||||
Log.wrn("Save Framework Platform Description Document", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Save to real file
|
||||
//
|
||||
try {
|
||||
SaveFile.saveFpdFile(path, fpd);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.wrn("Save Platform to file system", e.getMessage());
|
||||
Log.err("Save Platform to file system", e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Save to identification
|
||||
//
|
||||
fid = new PlatformIdentification(this.jTextFieldName.getText(), this.jTextFieldGuid.getText(),
|
||||
this.jTextFieldVersion.getText(), path);
|
||||
}
|
||||
|
||||
public ModuleIdentification getMid() {
|
||||
return mid;
|
||||
}
|
||||
|
||||
public PlatformIdentification getFid() {
|
||||
return fid;
|
||||
}
|
||||
|
||||
public PackageIdentification getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
private void upLocation(Component c, int size) {
|
||||
c.setLocation(c.getLocation().x, c.getLocation().y - size);
|
||||
}
|
||||
|
||||
public PlatformSurfaceArea getFpd() {
|
||||
return fpd;
|
||||
}
|
||||
|
||||
public ModuleSurfaceArea getMsa() {
|
||||
return msa;
|
||||
}
|
||||
|
||||
public PackageSurfaceArea getSpd() {
|
||||
return spd;
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
/** @file
|
||||
|
||||
To show a splash screen when starting
|
||||
|
||||
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;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JRootPane;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||
|
||||
public class SplashScreen extends IFrame {
|
||||
|
||||
///
|
||||
/// Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = 1077736364497801470L;
|
||||
|
||||
private JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="10,54"
|
||||
|
||||
private JLabel jLabelImage = null;
|
||||
|
||||
private JLabel jLabel = null;
|
||||
|
||||
private JLabel jLabel1 = null;
|
||||
|
||||
private JLabel jLabel2 = null;
|
||||
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public SplashScreen() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void init() {
|
||||
this.setSize(320, 205);
|
||||
this.setUndecorated(true);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
|
||||
this.setTitle("Init");
|
||||
this.centerWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jLabelImage = new JLabel();
|
||||
jLabelImage.setBounds(new java.awt.Rectangle(63, 20, 193, 58));
|
||||
jLabelImage.setIcon(new ImageIcon(getClass().getResource("/resources/images/logo.gif")));
|
||||
|
||||
jLabel2 = new JLabel();
|
||||
jLabel2.setBounds(new java.awt.Rectangle(25, 120, 270, 20));
|
||||
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel2.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 14));
|
||||
jLabel2.setText("Initializing...");
|
||||
jLabel1 = new JLabel();
|
||||
jLabel1.setBounds(new java.awt.Rectangle(3,166,270,20));
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||
jLabel1.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 8));
|
||||
jLabel1.setText("Copyright (c) 2006, Intel Corporation");
|
||||
jLabel = new JLabel();
|
||||
jLabel.setToolTipText("");
|
||||
jLabel.setBounds(new java.awt.Rectangle(25, 90, 270, 20));
|
||||
jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
jLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 18));
|
||||
jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION);
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.setSize(new java.awt.Dimension(320,199));
|
||||
jContentPane.setBackground(java.awt.SystemColor.inactiveCaptionText);
|
||||
jContentPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
jContentPane.add(jLabel, null);
|
||||
jContentPane.add(jLabel1, null);
|
||||
jContentPane.add(jLabel2, null);
|
||||
jContentPane.add(jLabelImage, null);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,507 @@
|
||||
/** @file
|
||||
|
||||
The file is used to setup tool chain configuration
|
||||
|
||||
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;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
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.Identifications.ToolChainConfigId;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigVector;
|
||||
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||
import org.tianocore.frameworkwizard.workspace.Workspace;
|
||||
|
||||
public class ToolChainConfig extends IFrame implements ListSelectionListener, TableModelListener{
|
||||
|
||||
///
|
||||
/// Define Class Members
|
||||
///
|
||||
private static final long serialVersionUID = 1486930966278269085L;
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JScrollPane jScrollPane = null;
|
||||
|
||||
private DefaultTableModel model = null;
|
||||
|
||||
private JTable jTable = null;
|
||||
|
||||
private JButton jButtonOpen = null;
|
||||
|
||||
private JButton jButtonSave = null;
|
||||
|
||||
private JButton jButtonClose = null;
|
||||
|
||||
private String toolsDir = Tools.addFileSeparator(Workspace.getCurrentWorkspace()) + "Tools"
|
||||
+ DataType.FILE_SEPARATOR + "Conf";
|
||||
|
||||
private String currentFile = Tools.addFileSeparator(toolsDir) + "tools_def.template";
|
||||
|
||||
private ToolChainConfigVector vtcc = new ToolChainConfigVector();
|
||||
|
||||
private JLabel jLabelName = null;
|
||||
|
||||
private JTextField jTextFieldName = null;
|
||||
|
||||
private JLabel jLabelValue = null;
|
||||
|
||||
private JTextField jTextFieldValue = null;
|
||||
|
||||
private JButton jButtonAdd = null;
|
||||
|
||||
private JButton jButtonRemove = null;
|
||||
|
||||
private int selectedRow = -1;
|
||||
|
||||
private JButton jButtonHelp = null;
|
||||
|
||||
private static ToolChainConfig tcc = null;
|
||||
|
||||
private ToolChainConfigHelp tcch = null;
|
||||
|
||||
/**
|
||||
This method initializes jScrollPane
|
||||
|
||||
@return javax.swing.JScrollPane
|
||||
|
||||
**/
|
||||
private JScrollPane getJScrollPane() {
|
||||
if (jScrollPane == null) {
|
||||
jScrollPane = new JScrollPane();
|
||||
jScrollPane.setBounds(new java.awt.Rectangle(15, 15, 555, 345));
|
||||
jScrollPane.setViewportView(getJTable());
|
||||
}
|
||||
return jScrollPane;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jTable
|
||||
|
||||
@return javax.swing.JTable
|
||||
|
||||
**/
|
||||
private JTable getJTable() {
|
||||
if (jTable == null) {
|
||||
model = new DefaultTableModel();
|
||||
jTable = new JTable(model);
|
||||
jTable.setRowHeight(20);
|
||||
|
||||
model.addColumn("Property");
|
||||
model.addColumn("Value");
|
||||
|
||||
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
jTable.getSelectionModel().addListSelectionListener(this);
|
||||
jTable.getModel().addTableModelListener(this);
|
||||
}
|
||||
return jTable;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jButtonOpen
|
||||
|
||||
@return javax.swing.JButton
|
||||
|
||||
**/
|
||||
private JButton getJButtonOpen() {
|
||||
if (jButtonOpen == null) {
|
||||
jButtonOpen = new JButton();
|
||||
jButtonOpen.setBounds(new java.awt.Rectangle(40, 405, 120, 20));
|
||||
jButtonOpen.setText("Open File");
|
||||
jButtonOpen.addActionListener(this);
|
||||
}
|
||||
return jButtonOpen;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jButtonSave
|
||||
|
||||
@return javax.swing.JButton
|
||||
|
||||
**/
|
||||
private JButton getJButtonSave() {
|
||||
if (jButtonSave == null) {
|
||||
jButtonSave = new JButton();
|
||||
jButtonSave.setBounds(new java.awt.Rectangle(170, 405, 120, 20));
|
||||
jButtonSave.setText("Save File");
|
||||
jButtonSave.addActionListener(this);
|
||||
}
|
||||
return jButtonSave;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jButtonClose
|
||||
|
||||
@return javax.swing.JButton
|
||||
|
||||
**/
|
||||
private JButton getJButtonClose() {
|
||||
if (jButtonClose == null) {
|
||||
jButtonClose = new JButton();
|
||||
jButtonClose.setBounds(new java.awt.Rectangle(490, 405, 80, 20));
|
||||
jButtonClose.setText("Close");
|
||||
jButtonClose.addActionListener(this);
|
||||
}
|
||||
return jButtonClose;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jTextFieldName
|
||||
|
||||
@return javax.swing.JTextField
|
||||
|
||||
**/
|
||||
private JTextField getJTextFieldName() {
|
||||
if (jTextFieldName == null) {
|
||||
jTextFieldName = new JTextField();
|
||||
jTextFieldName.setBounds(new java.awt.Rectangle(60, 365, 140, 20));
|
||||
}
|
||||
return jTextFieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jTextFieldValue
|
||||
|
||||
@return javax.swing.JTextField
|
||||
|
||||
**/
|
||||
private JTextField getJTextFieldValue() {
|
||||
if (jTextFieldValue == null) {
|
||||
jTextFieldValue = new JTextField();
|
||||
jTextFieldValue.setBounds(new java.awt.Rectangle(250, 365, 140, 20));
|
||||
}
|
||||
return jTextFieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jButtonAdd
|
||||
|
||||
@return javax.swing.JButton
|
||||
|
||||
**/
|
||||
private JButton getJButtonAdd() {
|
||||
if (jButtonAdd == null) {
|
||||
jButtonAdd = new JButton();
|
||||
jButtonAdd.setBounds(new java.awt.Rectangle(400, 365, 80, 20));
|
||||
jButtonAdd.setText("Add");
|
||||
jButtonAdd.addActionListener(this);
|
||||
}
|
||||
return jButtonAdd;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jButtonRemove
|
||||
|
||||
@return javax.swing.JButton
|
||||
|
||||
**/
|
||||
private JButton getJButtonRemove() {
|
||||
if (jButtonRemove == null) {
|
||||
jButtonRemove = new JButton();
|
||||
jButtonRemove.setBounds(new java.awt.Rectangle(490, 365, 80, 20));
|
||||
jButtonRemove.setText("Remove");
|
||||
jButtonRemove.addActionListener(this);
|
||||
}
|
||||
return jButtonRemove;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonHelp
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonHelp() {
|
||||
if (jButtonHelp == null) {
|
||||
jButtonHelp = new JButton();
|
||||
jButtonHelp.setBounds(new java.awt.Rectangle(300,405,120,20));
|
||||
jButtonHelp.setText("Help");
|
||||
jButtonHelp.addActionListener(this);
|
||||
}
|
||||
return jButtonHelp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public static ToolChainConfig getInstance() {
|
||||
if (tcc == null) {
|
||||
tcc = new ToolChainConfig();
|
||||
}
|
||||
return tcc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public ToolChainConfig() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes this
|
||||
|
||||
**/
|
||||
private void init() {
|
||||
this.setSize(600, 480);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.setTitle("Tool Chain Configuration");
|
||||
this.centerWindow();
|
||||
|
||||
//
|
||||
// Read default file
|
||||
//
|
||||
File f = new File(currentFile);
|
||||
if (f.exists()) {
|
||||
try {
|
||||
vtcc.removeAll();
|
||||
vtcc.parseFile(this.currentFile);
|
||||
this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]");
|
||||
} catch (IOException e) {
|
||||
Log.log(this.currentFile + "Read Error", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
Log.log("File Open Error: ", this.currentFile + " File Not Found");
|
||||
}
|
||||
|
||||
showTable();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jContentPane
|
||||
|
||||
@return javax.swing.JPanel
|
||||
|
||||
**/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jLabelValue = new JLabel();
|
||||
jLabelValue.setBounds(new java.awt.Rectangle(205, 365, 40, 20));
|
||||
jLabelValue.setText("Value");
|
||||
jLabelName = new JLabel();
|
||||
jLabelName.setBounds(new java.awt.Rectangle(15, 365, 40, 20));
|
||||
jLabelName.setText("Name");
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.add(getJScrollPane(), null);
|
||||
jContentPane.add(getJButtonOpen(), null);
|
||||
jContentPane.add(getJButtonSave(), null);
|
||||
jContentPane.add(getJButtonClose(), null);
|
||||
jContentPane.add(jLabelName, null);
|
||||
jContentPane.add(getJTextFieldName(), null);
|
||||
jContentPane.add(jLabelValue, null);
|
||||
jContentPane.add(getJTextFieldValue(), null);
|
||||
jContentPane.add(getJButtonAdd(), null);
|
||||
jContentPane.add(getJButtonRemove(), null);
|
||||
jContentPane.add(getJButtonHelp(), null);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*
|
||||
* Override actionPerformed to listen all actions
|
||||
*/
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == jButtonClose) {
|
||||
this.exit();
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonOpen) {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
|
||||
fc.addChoosableFileFilter(iff);
|
||||
fc.setCurrentDirectory(new File(toolsDir));
|
||||
|
||||
int result = fc.showOpenDialog(new JPanel());
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
try {
|
||||
vtcc.removeAll();
|
||||
vtcc.parseFile(fc.getSelectedFile().getPath());
|
||||
currentFile = fc.getSelectedFile().getPath();
|
||||
this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]");
|
||||
} catch (IOException e) {
|
||||
Log.wrn(this.currentFile + "Read Error", e.getMessage());
|
||||
Log.err(this.currentFile + "Read Error", e.getMessage());
|
||||
return;
|
||||
}
|
||||
this.showTable();
|
||||
}
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonSave) {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setAcceptAllFileFilterUsed(false);
|
||||
IFileFilter iff = new IFileFilter(DataType.TEXT_FILE_EXT);
|
||||
fc.addChoosableFileFilter(iff);
|
||||
fc.setCurrentDirectory(new File(toolsDir));
|
||||
|
||||
int result = fc.showSaveDialog(new JPanel());
|
||||
if (result == JFileChooser.APPROVE_OPTION) {
|
||||
currentFile = fc.getSelectedFile().getPath();
|
||||
try {
|
||||
vtcc.saveFile(currentFile);
|
||||
} catch (IOException e) {
|
||||
Log.wrn(this.currentFile + "Write Error", e.getMessage());
|
||||
Log.err(this.currentFile + "Write Error", e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonAdd) {
|
||||
if (check()) {
|
||||
String[] row = { jTextFieldName.getText(), jTextFieldValue.getText() };
|
||||
this.vtcc.addToolChainConfigs(new ToolChainConfigId(row[0], row[1]));
|
||||
this.model.addRow(row);
|
||||
}
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonRemove) {
|
||||
if (jTable.isEditing()) {
|
||||
jTable.getCellEditor().stopCellEditing();
|
||||
}
|
||||
if (selectedRow > -1) {
|
||||
this.model.removeRow(selectedRow);
|
||||
this.vtcc.removeToolChainConfigs(selectedRow);
|
||||
selectedRow = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg0.getSource() == jButtonHelp) {
|
||||
tcch = ToolChainConfigHelp.getInstance();
|
||||
tcch.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Read content of vector and put then into table
|
||||
|
||||
**/
|
||||
private void showTable() {
|
||||
clearAll();
|
||||
|
||||
if (vtcc.size() > 0) {
|
||||
for (int index = 0; index < vtcc.size(); index++) {
|
||||
model.addRow(vtcc.toStringVector(index));
|
||||
}
|
||||
}
|
||||
this.jTable.repaint();
|
||||
this.jTable.updateUI();
|
||||
//this.jScrollPane.setViewportView(this.jTable);
|
||||
}
|
||||
|
||||
/**
|
||||
Clear all table rows
|
||||
|
||||
**/
|
||||
private void clearAll() {
|
||||
if (model != null) {
|
||||
for (int index = model.getRowCount() - 1; index >= 0; index--) {
|
||||
model.removeRow(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Check if name or value is empty
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
private boolean check() {
|
||||
if (isEmpty(this.jTextFieldName.getText())) {
|
||||
Log.wrn("Add Tool Chain", "The Property Name must be entered!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isEmpty(this.jTextFieldValue.getText())) {
|
||||
Log.wrn("Add Tool Chain", "The Property Value must be entered!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)
|
||||
*
|
||||
*/
|
||||
public void valueChanged(ListSelectionEvent arg0) {
|
||||
if (arg0.getValueIsAdjusting()) {
|
||||
return;
|
||||
}
|
||||
ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();
|
||||
if (lsm.isSelectionEmpty()) {
|
||||
return;
|
||||
} else {
|
||||
selectedRow = lsm.getMinSelectionIndex();
|
||||
}
|
||||
}
|
||||
|
||||
public void tableChanged(TableModelEvent arg0) {
|
||||
int row = arg0.getFirstRow();
|
||||
TableModel m = (TableModel)arg0.getSource();
|
||||
if (arg0.getType() == TableModelEvent.UPDATE){
|
||||
this.vtcc.getToolChainConfigs(row).setName(m.getValueAt(row, 0).toString());
|
||||
this.vtcc.getToolChainConfigs(row).setValue(m.getValueAt(row, 1).toString());
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
|
||||
*
|
||||
* Override windowClosing to popup warning message to confirm quit
|
||||
*
|
||||
*/
|
||||
public void windowClosing(WindowEvent arg0) {
|
||||
this.exit();
|
||||
}
|
||||
|
||||
private void exit() {
|
||||
this.setVisible(false);
|
||||
if (tcch != null) {
|
||||
tcch.dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package org.tianocore.frameworkwizard;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextPane;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import javax.swing.JButton;
|
||||
|
||||
|
||||
public class ToolChainConfigHelp extends JFrame implements ActionListener {
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
private static final long serialVersionUID = -6315081029366587222L;
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private String helpContent = "";
|
||||
|
||||
private JTextPane jTextPane = null;
|
||||
|
||||
private JButton jButtonClose = null;
|
||||
|
||||
private static ToolChainConfigHelp tcch = null;
|
||||
|
||||
/**
|
||||
* This method initializes jTextPane
|
||||
*
|
||||
* @return javax.swing.JTextPane
|
||||
*/
|
||||
private JTextPane getJTextPane() {
|
||||
if (jTextPane == null) {
|
||||
jTextPane = new JTextPane();
|
||||
jTextPane.setBounds(new java.awt.Rectangle(10,10,600,420));
|
||||
jTextPane.setBackground(new java.awt.Color(238,238,238));
|
||||
jTextPane.setEditable(false);
|
||||
helpContent = helpContent
|
||||
+ "The template for the Property is: TARGET_TAGNAME_ARCH_COMMAND_ATTR" + DataType.UNIX_LINE_SEPARATOR
|
||||
+ "The Value, is either a full path, full path and filename or a reserved word." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ "TARGET - DEBUG and RELEASE are predefined, however the user may define one or more of their own TARGET types in this file." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ "TAGNAME - HOST, MSFT, GCC, INTC are predefined, however the user may define one or more of their own TAGNAME keywords in this file." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ "ARCH - EDK II supports IA32, X64, IPF and EBC at this time." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ "COMMAND - Predefined command codes are listed in the tools_def.txt file, however the user can specify additional command codes for their one, non-standard tools." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ "ATTR - Predefined Attributes are listed in the tools_def.txt file." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ "NOTE: The TAGNAME: HOST is reserved and MUST be defined in order to build the included Tiano tools from their C source files. These tools have been built and tested using both Microsoft and GCC tool chains." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR
|
||||
+ "NOTE: The \"*\" symbol may be used as a wildcard character in most of these fields, refer to the tools_def.txt and the \"EDK II Build and Packaging Architecture Specification\" for more details." + DataType.UNIX_LINE_SEPARATOR
|
||||
+ DataType.UNIX_LINE_SEPARATOR;
|
||||
|
||||
jTextPane.setText(helpContent);
|
||||
}
|
||||
return jTextPane;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jButtonClose
|
||||
*
|
||||
* @return javax.swing.JButton
|
||||
*/
|
||||
private JButton getJButtonClose() {
|
||||
if (jButtonClose == null) {
|
||||
jButtonClose = new JButton();
|
||||
jButtonClose.setBounds(new java.awt.Rectangle(480,450,80,20));
|
||||
jButtonClose.setText("Close");
|
||||
jButtonClose.addActionListener(this);
|
||||
}
|
||||
return jButtonClose;
|
||||
}
|
||||
|
||||
public static ToolChainConfigHelp getInstance() {
|
||||
if (tcch == null) {
|
||||
tcch = new ToolChainConfigHelp();
|
||||
}
|
||||
return tcch;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
ToolChainConfigHelp tcch = new ToolChainConfigHelp();
|
||||
tcch.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public ToolChainConfigHelp() {
|
||||
super();
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void initialize() {
|
||||
this.setSize(625, 520);
|
||||
this.setResizable(false);
|
||||
this.setTitle("How to Modify a Tool Chain Configuration");
|
||||
this.setContentPane(getJContentPane());
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.add(getJTextPane(), null);
|
||||
jContentPane.add(getJButtonClose(), null);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == jButtonClose) {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,287 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define all used final variables
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
/**
|
||||
The class is used to define all used final variables
|
||||
|
||||
**/
|
||||
public class DataType {
|
||||
|
||||
/**
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Define all return types
|
||||
//
|
||||
public static final int RETURN_TYPE_OK = 1;
|
||||
|
||||
public static final int RETURN_TYPE_CANCEL = 2;
|
||||
|
||||
public static final int RETURN_TYPE_NEXT = 3;
|
||||
|
||||
public static final int RETURN_TYPE_BACK = 4;
|
||||
|
||||
public static final int RETURN_TYPE_MODULE_SURFACE_AREA = 11;
|
||||
|
||||
public static final int RETURN_TYPE_PACKAGE_SURFACE_AREA = 12;
|
||||
|
||||
public static final int RETURN_TYPE_PLATFORM_SURFACE_AREA = 13;
|
||||
|
||||
public static final int RETURN_TYPE_BUILD_XML = 14;
|
||||
|
||||
public static final int RETURN_TYPE_WORKSPACE = 15;
|
||||
|
||||
public static final int RETURN_TYPE_TEXT = 16;
|
||||
|
||||
public static final int RETURN_TYPE_FAR_SURFACE_AREA = 17;
|
||||
|
||||
|
||||
//
|
||||
// Define all used final variables
|
||||
//
|
||||
public static final String DOS_LINE_SEPARATOR = "\r\n";
|
||||
|
||||
public static final String UNIX_LINE_SEPARATOR = "\n";
|
||||
|
||||
public static final String LINE_SEPARATOR = UNIX_LINE_SEPARATOR;
|
||||
|
||||
public static final String HTML_LINE_SEPARATOR = "<br>";
|
||||
|
||||
public static final String EMPTY_SELECT_ITEM = "----";
|
||||
|
||||
public static final String DOS_FILE_SEPARATOR = "\\";
|
||||
|
||||
public static final String UNIX_FILE_SEPARATOR = "/";
|
||||
|
||||
//
|
||||
// Define xml files ext
|
||||
//
|
||||
public static final String COPY_OF = "Copy of ";
|
||||
|
||||
public static final String FILE_EXT_SEPARATOR = ".";
|
||||
|
||||
public static final String WORKSPACE = "Workspace";
|
||||
|
||||
public static final String MODULE_SURFACE_AREA = "Module Surface Area Description";
|
||||
|
||||
public static final String MODULE_SURFACE_AREA_EXT = "msa";
|
||||
|
||||
public static final String MODULE_SURFACE_AREA_EXT_DESCRIPTION = MODULE_SURFACE_AREA + " (*."
|
||||
+ MODULE_SURFACE_AREA_EXT + ")";
|
||||
|
||||
public static final String PACKAGE_SURFACE_AREA = "Package Surface Area Description";
|
||||
|
||||
public static final String PACKAGE_SURFACE_AREA_EXT = "spd";
|
||||
|
||||
public static final String PACKAGE_SURFACE_AREA_EXT_DESCRIPTION = PACKAGE_SURFACE_AREA + " (*."
|
||||
+ PACKAGE_SURFACE_AREA_EXT + ")";
|
||||
|
||||
public static final String PLATFORM_SURFACE_AREA = "Platform Surface Area Description";
|
||||
|
||||
public static final String PLATFORM_SURFACE_AREA_EXT = "fpd";
|
||||
|
||||
public static final String PLATFORM_SURFACE_AREA_EXT_DESCRIPTION = PLATFORM_SURFACE_AREA + " (*."
|
||||
+ PLATFORM_SURFACE_AREA_EXT + ")";
|
||||
|
||||
public static final String ANT_BUILD_FILE = "ANT Build File";
|
||||
|
||||
public static final String ANT_BUILD_FILE_EXT = "xml";
|
||||
|
||||
public static final String ANT_BUILD_FILE_EXT_DESCRIPTION = ANT_BUILD_FILE + " (*." + ANT_BUILD_FILE_EXT + ")";
|
||||
|
||||
public static final String TEXT_FILE = "Text File";
|
||||
|
||||
public static final String TEXT_FILE_EXT = "txt";
|
||||
|
||||
public static final String TEXT_FILE_EXT_DESCRIPTION = TEXT_FILE + " (*." + TEXT_FILE_EXT + ")";
|
||||
|
||||
public static final String FAR_SURFACE_AREA = "Framework Archive";
|
||||
|
||||
public static final String FAR_SURFACE_AREA_EXT = "far";
|
||||
|
||||
public static final String FAR_SURFACE_AREA_EXT_DESCRIPTION = FAR_SURFACE_AREA + " (*." + FAR_SURFACE_AREA_EXT + ")";
|
||||
//
|
||||
// Define file separator for current OS
|
||||
//
|
||||
public static String FILE_SEPARATOR = System.getProperty("file.separator");
|
||||
|
||||
//
|
||||
// Defien all used frame, container component's sizes
|
||||
//
|
||||
public static final int MAIN_FRAME_PREFERRED_SIZE_WIDTH = 800;
|
||||
|
||||
public static final int MAIN_FRAME_PREFERRED_SIZE_HEIGHT = 600;
|
||||
|
||||
public static final int MAIN_FRAME_MAX_SIZE_WIDTH = 1920;
|
||||
|
||||
public static final int MAIN_FRAME_MAX_SIZE_HEIGHT = 1200;
|
||||
|
||||
public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH = 790;
|
||||
|
||||
public static final int MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT = 545;
|
||||
|
||||
public static final int MAIN_FRAME_WIDTH_SPACING = MAIN_FRAME_PREFERRED_SIZE_WIDTH
|
||||
- MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_WIDTH;
|
||||
|
||||
public static final int MAIN_FRAME_HEIGHT_SPACING = MAIN_FRAME_PREFERRED_SIZE_HEIGHT
|
||||
- MAIN_FRAME_SPLIT_PANEL_PREFERRED_SIZE_HEIGHT;
|
||||
|
||||
public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_WIDTH = 273;
|
||||
|
||||
public static final int MAIN_FRAME_TREE_PANEL_PREFERRED_SIZE_HEIGHT = 545;
|
||||
|
||||
public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_WIDTH = 515;
|
||||
|
||||
public static final int MAIN_FRAME_EDITOR_PANEL_PREFERRED_SIZE_HEIGHT = 545;
|
||||
|
||||
public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_X = 260;
|
||||
|
||||
public static final int MAIN_FRAME_EDITOR_PANEL_LOCATION_Y = 1;
|
||||
|
||||
public static final int SPACE_TO_RIGHT_FOR_GENERATE_BUTTON = 10;
|
||||
|
||||
public static final int SPACE_TO_RIGHT_FOR_OK_BUTTON = 10;
|
||||
|
||||
public static final int SPACE_TO_RIGHT_FOR_ADD_BUTTON = 180;
|
||||
|
||||
public static final int SPACE_TO_RIGHT_FOR_REMOVE_BUTTON = 95;
|
||||
|
||||
public static final int SPACE_TO_RIGHT_FOR_UPDATE_BUTTON = 10;
|
||||
|
||||
public static final int SPACE_TO_BOTTOM_FOR_ADD_BUTTON = 30;
|
||||
|
||||
public static final int SPACE_TO_BOTTOM_FOR_REMOVE_BUTTON = 30;
|
||||
|
||||
public static final int SPACE_TO_BOTTOM_FOR_UPDATE_BUTTON = 30;
|
||||
|
||||
public static final int SPACE_TO_RIGHT_FOR_CLOSE_BUTTON = 240;
|
||||
|
||||
public static final int SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON = 25;
|
||||
|
||||
public static final int SPACE_TO_RIGHT_FOR_PROTOCOL_NOTIFY = 25;
|
||||
|
||||
public static final int LEFT_WIDTH = 160;
|
||||
|
||||
public static final int LEFT_HEIGHT = 20;
|
||||
|
||||
public static final int RIGHT_WIDTH = 320;
|
||||
|
||||
public static final int RIGHT_HEIGHT = 20;
|
||||
|
||||
public static final int RIGHT_MULTIPLE_HEIGHT = 4 * RIGHT_HEIGHT;
|
||||
|
||||
public static final int BUTTON_GEN_WIDTH = 65;
|
||||
|
||||
public static final int BUTTON_GEN_HEIGHT = 20;
|
||||
|
||||
public static final int BUTTON_BROWSE_WIDTH = 65;
|
||||
|
||||
public static final int BUTTON_BROWSE_HEIGHT = 20;
|
||||
|
||||
public static final int BUTTON_ADD_WIDTH = 80;
|
||||
|
||||
public static final int BUTTON_ADD_HEIGHT = 20;
|
||||
|
||||
public static final int BUTTON_UPDATE_WIDTH = 80;
|
||||
|
||||
public static final int BUTTON_UPDATE_HEIGHT = 20;
|
||||
|
||||
public static final int BUTTON_REMOVE_WIDTH = 80;
|
||||
|
||||
public static final int BUTTON_REMOVE_HEIGHT = 20;
|
||||
|
||||
public static final int SCROLLBAR_WIDTH = 18;
|
||||
|
||||
public static final int SCROLLBAR_HEIGHT = 18;
|
||||
|
||||
//
|
||||
// Common Help Text
|
||||
// First defined here
|
||||
// Will be replaced by resource file later
|
||||
//
|
||||
public static final String SUP_ARCH_LIST_HELP_TEXT = "<html>Selecting a checkbox is a restriction of only the selected architectures;<br>If none of boxes are selected, all architectures are supported.<html>";
|
||||
|
||||
//
|
||||
// Project name and version
|
||||
//
|
||||
public static final String PROJECT_NAME = "Framework Wizard";
|
||||
|
||||
public static final String PROJECT_VERSION = "1.0";
|
||||
|
||||
//
|
||||
// Sort Type
|
||||
//
|
||||
public static final int SORT_TYPE_ASCENDING = 1;
|
||||
|
||||
public static final int SORT_TYPE_DESCENDING = 2;
|
||||
|
||||
//
|
||||
// Module Type
|
||||
//
|
||||
public static final String MODULE_TYPE_LIBRARY = "Library";
|
||||
|
||||
public static final String MODULE_TYPE_MODULE = "Module";
|
||||
|
||||
//
|
||||
// Hex String Header
|
||||
//
|
||||
public static final String HEX_STRING_HEADER = "0x";
|
||||
|
||||
//
|
||||
// The String of Boolean
|
||||
//
|
||||
public static final String TRUE = "True";
|
||||
|
||||
public static final String FALSE = "False";
|
||||
|
||||
//
|
||||
// The Sting for USAGE type
|
||||
//
|
||||
public final static String USAGE_TYPE_ALWAYS_CONSUMED = "ALWAYS_CONSUMED";
|
||||
|
||||
public final static String USAGE_TYPE_SOMETIMES_CONSUMED = "SOMETIMES_CONSUMED";
|
||||
|
||||
public final static String USAGE_TYPE_ALWAYS_PRODUCED = "ALWAYS_PRODUCED";
|
||||
|
||||
public final static String USAGE_TYPE_SOMETIMES_PRODUCED = "SOMETIMES_PRODUCED";
|
||||
|
||||
public final static String USAGE_TYPE_PRIVATE = "PRIVATE";
|
||||
|
||||
//
|
||||
// The String for PPI type
|
||||
//
|
||||
public final static String PPI_TYPE_PPI = "Ppi";
|
||||
|
||||
public final static String PPI_TYPE_PPI_NOTIFY = "Ppi Notify";
|
||||
|
||||
//
|
||||
// The String for Protocol type
|
||||
//
|
||||
public final static String PROTOCOL_TYPE_PROTOCOL = "Protocol";
|
||||
|
||||
public final static String PROTOCOL_TYPE_PROTOCOL_NOTIFY = "Protocol Notify";
|
||||
|
||||
//
|
||||
// The default file name for guids.xref file
|
||||
//
|
||||
public final static String GUIDS_XREF_FILE_NAME = "guids.xref";
|
||||
}
|
@ -0,0 +1,712 @@
|
||||
/** @file
|
||||
|
||||
The file is used to provides all kinds of Data Validation interface
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
The class is used to provides all kinds of data validation interface
|
||||
|
||||
<p>All provided interfaces are in static mode</p>
|
||||
|
||||
**/
|
||||
public class DataValidation {
|
||||
|
||||
/**
|
||||
Reserved for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// The below is used to check common data types
|
||||
//
|
||||
|
||||
/**
|
||||
Check if the imput data is int
|
||||
|
||||
@param strInt The input string which needs validation
|
||||
|
||||
@retval true - The input is Int
|
||||
@retval false - The input is not Int
|
||||
|
||||
**/
|
||||
public static boolean isInt(String strInt) {
|
||||
return isMatch("^-?[0-9]\\d*$", strInt);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is int and it is in the valid scope
|
||||
The scope is provided by String
|
||||
|
||||
@param strNumber The input string which needs validation
|
||||
@param BeginNumber The left boundary of the scope
|
||||
@param EndNumber The right boundary of the scope
|
||||
|
||||
@retval true - The input is Int and in the scope;
|
||||
@retval false - The input is not Int or not in the scope
|
||||
|
||||
**/
|
||||
public static boolean isInt(String strNumber, int BeginNumber, int EndNumber) {
|
||||
//
|
||||
//Check if the input data is int first
|
||||
//
|
||||
if (!isInt(strNumber)) {
|
||||
return false;
|
||||
}
|
||||
//
|
||||
//And then check if the data is between the scope
|
||||
//
|
||||
Integer intTemp = new Integer(strNumber);
|
||||
if ((intTemp.intValue() < BeginNumber) || (intTemp.intValue() > EndNumber)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is int and it is in the valid scope
|
||||
The scope is provided by String
|
||||
|
||||
@param strNumber The input string which needs validation
|
||||
@param strBeginNumber The left boundary of the scope
|
||||
@param strEndNumber The right boundary of the scope
|
||||
|
||||
@retval true - The input is Int and in the scope;
|
||||
@retval false - The input is not Int or not in the scope
|
||||
|
||||
**/
|
||||
public static boolean isInt(String strNumber, String strBeginNumber, String strEndNumber) {
|
||||
//
|
||||
//Check if all input data are int
|
||||
//
|
||||
if (!isInt(strNumber)) {
|
||||
return false;
|
||||
}
|
||||
if (!isInt(strBeginNumber)) {
|
||||
return false;
|
||||
}
|
||||
if (!isInt(strEndNumber)) {
|
||||
return false;
|
||||
}
|
||||
//
|
||||
//And then check if the data is between the scope
|
||||
//
|
||||
Integer intI = new Integer(strNumber);
|
||||
Integer intJ = new Integer(strBeginNumber);
|
||||
Integer intK = new Integer(strEndNumber);
|
||||
if ((intI.intValue() < intJ.intValue()) || (intI.intValue() > intK.intValue())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
Use regex to check if the input data is in valid format
|
||||
|
||||
@param strPattern The input regex
|
||||
@param strMatcher The input data need be checked
|
||||
|
||||
@retval true - The data matches the regex
|
||||
@retval false - The data doesn't match the regex
|
||||
|
||||
**/
|
||||
public static boolean isMatch(String strPattern, String strMatcher) {
|
||||
Pattern pattern = Pattern.compile(strPattern);
|
||||
Matcher matcher = pattern.matcher(strMatcher);
|
||||
|
||||
return matcher.find();
|
||||
}
|
||||
|
||||
//
|
||||
// The below is used to check common customized data types
|
||||
//
|
||||
|
||||
/**
|
||||
Check if the input data is UiNameType
|
||||
|
||||
@param arg0 The input string need be checked
|
||||
|
||||
@retval true - The input is UiNameType
|
||||
@retval false - The input is not UiNameType
|
||||
|
||||
**/
|
||||
public static boolean isUiNameType(String arg0) {
|
||||
if (arg0.length() < 1) {
|
||||
return false;
|
||||
}
|
||||
return isMatch("[^ ].*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is GuidType2
|
||||
|
||||
@param arg0 The input string need be checked
|
||||
|
||||
@retval true - The input is GuidType2
|
||||
@retval false - The input is not GuidType2
|
||||
|
||||
**/
|
||||
public static boolean isGuidType2(String arg0) {
|
||||
return isMatch("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Guid
|
||||
|
||||
@param strGuid The input string need be checked
|
||||
|
||||
@retval true - The input is Guid
|
||||
@retval false - The input is not Guid
|
||||
|
||||
**/
|
||||
public static boolean isGuid(String arg0) {
|
||||
return isGuidType2(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Version
|
||||
|
||||
@param arg0 The input string need be checked
|
||||
|
||||
@retval true - The input is Version
|
||||
@retval false - The input is not Version
|
||||
|
||||
**/
|
||||
public static boolean isVersionDataType(String arg0) {
|
||||
return isMatch("\\d+(\\.\\d+)*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Sentence
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is Sentence
|
||||
@retval false - The input is not Sentence
|
||||
|
||||
**/
|
||||
public static boolean isSentence(String arg0) {
|
||||
return isMatch("(\\w+\\W*)+( )+(\\W*\\w*\\W*\\s*)*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is FileNameConventio
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is FileNameConventio
|
||||
@retval false - The input is not FileNameConventio
|
||||
|
||||
**/
|
||||
public static boolean isFileNameConvention(String arg0) {
|
||||
return isMatch("[a-zA-Z][a-zA-Z0-9]*((_)*(-)*(.)*[a-zA-Z0-9]*)*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is KeywordType
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is KeywordType
|
||||
@retval false - The input is not KeywordType
|
||||
|
||||
**/
|
||||
public static boolean isKeywordType(String arg0) {
|
||||
return isMatch("[a-zA-Z]+(_*[a-zA-Z0-9]*)*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is FeatureFlagExpressionType
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is FeatureFlagExpressionType
|
||||
@retval false - The input is not FeatureFlagExpressionType
|
||||
|
||||
**/
|
||||
public static boolean isFeatureFlagExpressionType(String arg0) {
|
||||
return (arg0.length() >= 1);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is FeatureFlag
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is FeatureFlag
|
||||
@retval false - The input is not FeatureFlag
|
||||
|
||||
**/
|
||||
public static boolean isFeatureFlag(String arg0) {
|
||||
return isFeatureFlagExpressionType(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is PathAndFilename
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is PathAndFilename
|
||||
@retval false - The input is not PathAndFilename
|
||||
|
||||
**/
|
||||
public static boolean isPathAndFilename(String arg0) {
|
||||
return !arg0.equals("");
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is ToolsNameConvention
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is ToolsNameConvention
|
||||
@retval false - The input is not ToolsNameConvention
|
||||
|
||||
**/
|
||||
public static boolean isToolsNameConvention(String arg0) {
|
||||
return isMatch("[a-zA-Z][a-zA-Z0-9]*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is C_NameType
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is C_NameType
|
||||
@retval false - The input is not C_NameType
|
||||
|
||||
**/
|
||||
public static boolean isC_NameType(String arg0) {
|
||||
return isMatch("(_)*[a-zA-Z]+((_)*[a-zA-Z0-9]*)*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is HexWordArrayType
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is HexWordArrayType
|
||||
@retval false - The input is not HexWordArrayType
|
||||
|
||||
**/
|
||||
public static boolean isHexWordArrayType(String arg0) {
|
||||
return arg0.length() >=6 && isMatch("((\\s)*0x([a-fA-F0-9]){4}(,)?(\\s)*)+", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Hex64BitDataType
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is Hex64BitDataType
|
||||
@retval false - The input is not Hex64BitDataType
|
||||
|
||||
**/
|
||||
public static boolean isHex64BitDataType(String arg0) {
|
||||
return isMatch("(0x)?[a-fA-F0-9]{1,16}", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is UnicodeString
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is UnicodeString
|
||||
@retval false - The input is not UnicodeString
|
||||
|
||||
**/
|
||||
public static boolean isUnicodeString(String arg0) {
|
||||
return arg0.length() >= 3 && isMatch("(\\s)*L(\\:)?\"[^\"]*\"(\\s)*", arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is HexByteArrayType
|
||||
|
||||
@param strSentence The input string need be checked
|
||||
|
||||
@retval true - The input is HexByteArrayType
|
||||
@retval false - The input is not HexByteArrayType
|
||||
|
||||
**/
|
||||
public static boolean isHexByteArrayType(String arg0) {
|
||||
return arg0.length() >= 4 && isMatch("((\\s)*0x([a-fA-F0-9]){2}(,)?(\\s)*)+", arg0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check if the input data is DateType
|
||||
|
||||
@param strDateType The input string need be checked
|
||||
|
||||
@retval true - The input is DateType
|
||||
@retval false - The input is not DateType
|
||||
|
||||
**/
|
||||
public static boolean isDateType(String strDateType) {
|
||||
return isMatch("[1-9][0-9][0-9][0-9]-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]", strDateType);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is DosPath
|
||||
|
||||
@param strDosPath The input string need be checked
|
||||
|
||||
@retval true - The input is DosPath
|
||||
@retval false - The input is not DosPath
|
||||
|
||||
**/
|
||||
public static boolean isDosPath(String strDosPath) {
|
||||
return isMatch("([a-zA-Z]:\\\\)?(((\\\\?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*", strDosPath);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is UnixPath
|
||||
|
||||
@param strUnixPath The input string need be checked
|
||||
|
||||
@retval true - The input is UnixPath
|
||||
@retval false - The input is not UnixPath
|
||||
|
||||
**/
|
||||
public static boolean isUnixPath(String strUnixPath) {
|
||||
return isMatch("(\\/)?(((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*", strUnixPath);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is DirectoryNamingConvention
|
||||
|
||||
@param strDirectoryNamingConvention The input string need be checked
|
||||
|
||||
@retval true - The input is DirectoryNamingConvention
|
||||
@retval false - The input is not DirectoryNamingConvention
|
||||
|
||||
**/
|
||||
public static boolean isDirectoryNamingConvention(String strDirectoryNamingConvention) {
|
||||
return (isDosPath(strDirectoryNamingConvention) || isUnixPath(strDirectoryNamingConvention));
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is HexDoubleWordDataType
|
||||
|
||||
@param strHexDoubleWordDataType The input string need be checked
|
||||
|
||||
@retval true - The input is HexDoubleWordDataType
|
||||
@retval false - The input is not HexDoubleWordDataType
|
||||
|
||||
**/
|
||||
public static boolean isHexDoubleWordDataType(String strHexDoubleWordDataType) {
|
||||
return isMatch("0x[a-fA-F0-9]{1,8}", strHexDoubleWordDataType);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is V1
|
||||
|
||||
@param strV1 The input string need be checked
|
||||
|
||||
@retval true - The input is V1
|
||||
@retval false - The input is not V1
|
||||
|
||||
**/
|
||||
public static boolean isV1(String strV1) {
|
||||
return isMatch("((%[A-Z](_*[A-Z0-9]*)*%)+((((\\\\)?_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\\\)?)*)", strV1);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is V2
|
||||
|
||||
@param strV2 The input string need be checked
|
||||
|
||||
@retval true - The input is V2
|
||||
@retval false - The input is not V2
|
||||
|
||||
**/
|
||||
public static boolean isV2(String strV2) {
|
||||
return isMatch(
|
||||
"(($[A-Z](_*[A-Z0-9]*)*)+||($\\([A-Z](_*[A-Z0-9]*)*\\))+||($\\{[A-Z](_*[A-Z0-9]*)*\\})+)+(\\/)?(((((_*-*.*[a-zA-Z0-9]*)*(_*-*.*[a-zA-Z0-9])*)+(\\/)?)*)*)",
|
||||
strV2);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is VariableConvention
|
||||
|
||||
@param strVariableConvention The input string need be checked
|
||||
|
||||
@retval true - The input is VariableConvention
|
||||
@retval false - The input is not VariableConvention
|
||||
|
||||
**/
|
||||
public static boolean isVariableConvention(String strVariableConvention) {
|
||||
return (isV1(strVariableConvention) || isV2(strVariableConvention));
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is UCName
|
||||
|
||||
@param strUCName The input string need be checked
|
||||
|
||||
@retval true - The input is UCName
|
||||
@retval false - The input is not UCName
|
||||
|
||||
**/
|
||||
public static boolean isUCName(String strUCName) {
|
||||
return isMatch("[A-Z]+(_*[A-Z0-9]*( )*)*", strUCName);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is HexByteDataType
|
||||
|
||||
@param strHex64BitDataType The input string need be checked
|
||||
|
||||
@retval true - The input is HexByteDataType
|
||||
@retval false - The input is not HexByteDataType
|
||||
|
||||
**/
|
||||
public static boolean isHexByteDataType(String strHex64BitDataType) {
|
||||
return isMatch("(0x)?[a-fA-F0-9]{1,2}", strHex64BitDataType);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is HexWordDataType
|
||||
|
||||
@param strHexWordDataType The input string need be checked
|
||||
|
||||
@retval true - The input is HexWordDataType
|
||||
@retval false - The input is not HexWordDataType
|
||||
|
||||
**/
|
||||
public static boolean isHexWordDataType(String strHexWordDataType) {
|
||||
return isMatch("0x[a-fA-F0-9]{1,4}", strHexWordDataType);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is OverrideID
|
||||
|
||||
@param strOverrideID The input string need be checked
|
||||
|
||||
@retval true - The input is OverrideID
|
||||
@retval false - The input is not OverrideID
|
||||
|
||||
**/
|
||||
public static boolean isOverrideID(String strOverrideID) {
|
||||
return isInt(strOverrideID);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Supported Architectures
|
||||
|
||||
@param strSupportedArchitectures
|
||||
@retval true - The input is Supported Architectures
|
||||
@retval false - The input isn't Supported Architectures
|
||||
|
||||
*/
|
||||
public static boolean isSupportedArchitectures(String strSupportedArchitectures) {
|
||||
return isMatch("(ALL){1}|(((IA32)|((X64)|(IPF)|(EBC)){1}((,((IA32)|(X64)|(IPF)|(EBC)){1} ){0,2}))){1}",
|
||||
strSupportedArchitectures);
|
||||
}
|
||||
|
||||
//
|
||||
//The below is used to check msaheader data type
|
||||
//
|
||||
|
||||
/**
|
||||
Check if the input data is BaseName
|
||||
|
||||
@param strBaseName The input string need be checked
|
||||
|
||||
@retval true - The input is BaseName
|
||||
@retval false - The input is not BaseName
|
||||
|
||||
**/
|
||||
public static boolean isBaseName(String arg0) {
|
||||
return isUiNameType(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Version
|
||||
|
||||
@param arg0 The input string need be checked
|
||||
|
||||
@retval true - The input is Version
|
||||
@retval false - The input is not Version
|
||||
|
||||
**/
|
||||
public static boolean isVersion(String arg0) {
|
||||
return isVersionDataType(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Abstract
|
||||
|
||||
@param strAbstract The input string need be checked
|
||||
|
||||
@retval true - The input is Abstract
|
||||
@retval false - The input is not Abstract
|
||||
|
||||
**/
|
||||
public static boolean isAbstract(String arg0) {
|
||||
return isSentence(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Copyright
|
||||
|
||||
@param strCopyright The input string need be checked
|
||||
|
||||
@retval true - The input is Copyright
|
||||
@retval false - The input is not Copyright
|
||||
|
||||
**/
|
||||
public static boolean isCopyright(String arg0) {
|
||||
return !arg0.equals("");
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is Specification
|
||||
|
||||
@param strCopyright The input string need be checked
|
||||
|
||||
@retval true - The input is Specification
|
||||
@retval false - The input is not Specification
|
||||
|
||||
**/
|
||||
public static boolean isSpecification(String arg0) {
|
||||
return isSentence(arg0);
|
||||
}
|
||||
|
||||
//
|
||||
// The below is used to check ModuleDefinitions data types
|
||||
//
|
||||
/**
|
||||
Check if the input data is OutputFileBasename
|
||||
|
||||
@param strCopyright The input string need be checked
|
||||
|
||||
@retval true - The input is OutputFileBasename
|
||||
@retval false - The input is not OutputFileBasename
|
||||
|
||||
**/
|
||||
public static boolean isOutputFileBasename(String arg0) {
|
||||
return isFileNameConvention(arg0);
|
||||
}
|
||||
|
||||
//
|
||||
// The below is used to check LibraryClass data types
|
||||
//
|
||||
/**
|
||||
Check if the input data is LibraryClass
|
||||
|
||||
@param strCopyright The input string need be checked
|
||||
|
||||
@retval true - The input is LibraryClass
|
||||
@retval false - The input is not LibraryClass
|
||||
|
||||
**/
|
||||
public static boolean isLibraryClass(String arg0) {
|
||||
return isKeywordType(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is RecommendedInstanceVersion
|
||||
|
||||
@param strCopyright The input string need be checked
|
||||
|
||||
@retval true - The input is RecommendedInstanceVersion
|
||||
@retval false - The input is not RecommendedInstanceVersion
|
||||
|
||||
**/
|
||||
public static boolean isRecommendedInstanceVersion(String arg0) {
|
||||
return isVersionDataType(arg0);
|
||||
}
|
||||
|
||||
//
|
||||
// The below is used to check sourcefiles data types
|
||||
//
|
||||
|
||||
/**
|
||||
Check if the input data is Filename
|
||||
|
||||
@param strPath The input string need be checked
|
||||
|
||||
@retval true - The input is Filename
|
||||
@retval false - The input is not Filename
|
||||
|
||||
**/
|
||||
public static boolean isFilename(String arg0) {
|
||||
return isPathAndFilename(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is TagName
|
||||
|
||||
@param strPath The input string need be checked
|
||||
|
||||
@retval true - The input is TagName
|
||||
@retval false - The input is not TagName
|
||||
|
||||
**/
|
||||
public static boolean isTagName(String arg0) {
|
||||
return isToolsNameConvention(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is ToolCode
|
||||
|
||||
@param strPath The input string need be checked
|
||||
|
||||
@retval true - The input is ToolCode
|
||||
@retval false - The input is not ToolCode
|
||||
|
||||
**/
|
||||
public static boolean isToolCode(String arg0) {
|
||||
return isToolsNameConvention(arg0);
|
||||
}
|
||||
|
||||
/**
|
||||
Check if the input data is ToolChainFamily
|
||||
|
||||
@param strPath The input string need be checked
|
||||
|
||||
@retval true - The input is ToolChainFamily
|
||||
@retval false - The input is not ToolChainFamily
|
||||
|
||||
**/
|
||||
public static boolean isToolChainFamily(String arg0) {
|
||||
return isToolsNameConvention(arg0);
|
||||
}
|
||||
|
||||
//
|
||||
// The below is used to check pcdcoded data types
|
||||
//
|
||||
/**
|
||||
Check if the input data is DefaultValueType
|
||||
|
||||
@param strPath The input string need be checked
|
||||
|
||||
@retval true - The input is DefaultValueType
|
||||
@retval false - The input is not DefaultValueType
|
||||
|
||||
**/
|
||||
public static boolean isDefaultValueType(String arg0) {
|
||||
return isHex64BitDataType(arg0) || isUnicodeString(arg0) || isHexByteArrayType(arg0);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,193 @@
|
||||
/** @file
|
||||
|
||||
The file is used to provides interfaces for file operations
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class FileOperation {
|
||||
|
||||
/**
|
||||
|
||||
@param args
|
||||
* @throws Exception
|
||||
|
||||
**/
|
||||
public static void main(String[] args) throws Exception {
|
||||
FileOperation.newFolder("C:\\aaa\\aaa\\aaa\\aaa\\aaa");
|
||||
}
|
||||
|
||||
/**
|
||||
To new a folder
|
||||
|
||||
@param folderPath The folder path to be created
|
||||
@throws Exception
|
||||
|
||||
**/
|
||||
public static void newFolder(String folderPath) throws Exception {
|
||||
folderPath = Tools.convertPathToCurrentOsType(folderPath);
|
||||
File f = new File(folderPath);
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
/**
|
||||
Delete a file
|
||||
|
||||
@param filePath The file path to be deleted
|
||||
@throws Exception
|
||||
|
||||
**/
|
||||
public static void delFile(String filePath) throws Exception {
|
||||
File f = new File(filePath);
|
||||
if (f.exists()) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Delete a folder and all its files
|
||||
|
||||
@param filePath The name of the folder which need be deleted
|
||||
@throws Exception
|
||||
|
||||
**/
|
||||
public static void delFolder(String filePath) throws Exception {
|
||||
File f = new File(filePath);
|
||||
if (!f.exists()) {
|
||||
return;
|
||||
}
|
||||
if (!f.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
delFolder(f);
|
||||
}
|
||||
|
||||
/**
|
||||
Delete a folder and all its files
|
||||
|
||||
@param fleFolderName The name of the folder which need be deleted
|
||||
|
||||
@retval true - Delete successfully
|
||||
@retval false - Delete successfully
|
||||
|
||||
**/
|
||||
private static boolean delFolder(File fileName) throws Exception {
|
||||
boolean blnIsDeleted = true;
|
||||
|
||||
File[] aryAllFiles = fileName.listFiles();
|
||||
|
||||
for (int indexI = 0; indexI < aryAllFiles.length; indexI++) {
|
||||
if (blnIsDeleted) {
|
||||
if (aryAllFiles[indexI].isDirectory()) {
|
||||
//
|
||||
//If is a directory, recursively call this function to delete sub folders
|
||||
//
|
||||
blnIsDeleted = delFolder(aryAllFiles[indexI]);
|
||||
} else if (aryAllFiles[indexI].isFile()) {
|
||||
//
|
||||
//If is a file, delete it
|
||||
//
|
||||
if (!aryAllFiles[indexI].delete()) {
|
||||
blnIsDeleted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (blnIsDeleted) {
|
||||
fileName.delete();
|
||||
}
|
||||
return blnIsDeleted;
|
||||
}
|
||||
|
||||
/**
|
||||
Copy a file
|
||||
|
||||
@param oldPath
|
||||
@param newPath
|
||||
@throws Exception
|
||||
|
||||
**/
|
||||
public static void copyFile(String oldPath, String newPath) throws Exception {
|
||||
oldPath = Tools.convertPathToCurrentOsType(oldPath);
|
||||
newPath = Tools.convertPathToCurrentOsType(newPath);
|
||||
|
||||
int byteCount = 0;
|
||||
File oldFile = new File(oldPath);
|
||||
|
||||
File newFile = new File(Tools.getFilePathOnly(newPath));
|
||||
if (!newFile.exists()) {
|
||||
newFolder(Tools.getFilePathOnly(newPath));
|
||||
}
|
||||
|
||||
if (oldFile.exists()) {
|
||||
InputStream is = new FileInputStream(oldPath);
|
||||
FileOutputStream fos = new FileOutputStream(newPath);
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
while ((byteCount = is.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, byteCount);
|
||||
}
|
||||
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Copy a folder
|
||||
|
||||
@param oldPath
|
||||
@param newPath
|
||||
@throws Exception
|
||||
|
||||
**/
|
||||
public static void copyFolder(String oldPath, String newPath) throws Exception {
|
||||
File oldFile = new File(oldPath);
|
||||
|
||||
//
|
||||
// Create new file path first
|
||||
//
|
||||
newFolder(newPath);
|
||||
|
||||
String[] files = oldFile.list();
|
||||
File temp = null;
|
||||
for (int index = 0; index < files.length; index++) {
|
||||
if (oldPath.endsWith(DataType.FILE_SEPARATOR)) {
|
||||
temp = new File(oldPath + files[index]);
|
||||
} else {
|
||||
temp = new File(oldPath + DataType.FILE_SEPARATOR + files[index]);
|
||||
}
|
||||
|
||||
if (temp.isFile()) {
|
||||
FileInputStream fis = new FileInputStream(temp);
|
||||
FileOutputStream fos = new FileOutputStream(newPath + DataType.FILE_SEPARATOR
|
||||
+ (temp.getName()).toString());
|
||||
byte[] b = new byte[1024 * 5];
|
||||
int len;
|
||||
while ((len = fis.read(b)) != -1) {
|
||||
fos.write(b, 0, len);
|
||||
}
|
||||
fos.flush();
|
||||
fos.close();
|
||||
fis.close();
|
||||
}
|
||||
if (temp.isDirectory()) {
|
||||
copyFolder(oldPath + DataType.FILE_SEPARATOR + files[index], newPath + DataType.FILE_SEPARATOR
|
||||
+ files[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,202 @@
|
||||
/** @file
|
||||
The file is used to provide initializing global data.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.MsaFilesDocument.MsaFiles;
|
||||
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleList;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageList;
|
||||
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformList;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
import org.tianocore.frameworkwizard.workspace.Workspace;
|
||||
|
||||
public class GlobalData {
|
||||
|
||||
public static FrameworkDatabase fdb = null;
|
||||
|
||||
public static OpeningModuleList openingModuleList = new OpeningModuleList();
|
||||
|
||||
public static OpeningPackageList openingPackageList = new OpeningPackageList();
|
||||
|
||||
public static OpeningPlatformList openingPlatformList = new OpeningPlatformList();
|
||||
|
||||
public static Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();
|
||||
|
||||
public static Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();
|
||||
|
||||
public static Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();
|
||||
|
||||
public static void init() {
|
||||
initDatabase();
|
||||
initPackage();
|
||||
initPlatform();
|
||||
initModule();
|
||||
}
|
||||
|
||||
public static void initDatabase() {
|
||||
String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();
|
||||
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);
|
||||
try {
|
||||
fdb = OpenFile.openFrameworkDb(strFrameworkDbFilePath);
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static void initModule() {
|
||||
vModuleList = new Vector<ModuleIdentification>();
|
||||
openingModuleList = new OpeningModuleList();
|
||||
|
||||
ModuleSurfaceArea msa = null;
|
||||
Vector<String> modulePaths = new Vector<String>();
|
||||
Identification id = null;
|
||||
ModuleIdentification mid = null;
|
||||
String packagePath = null;
|
||||
String modulePath = null;
|
||||
|
||||
//
|
||||
// For each package, get all modules list
|
||||
//
|
||||
if (vPackageList.size() > 0) {
|
||||
for (int indexI = 0; indexI < vPackageList.size(); indexI++) {
|
||||
packagePath = vPackageList.elementAt(indexI).getPath();
|
||||
modulePaths = getAllModulesOfPackage(packagePath);
|
||||
|
||||
for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
|
||||
try {
|
||||
modulePath = modulePaths.get(indexJ);
|
||||
msa = OpenFile.openMsaFile(modulePath);
|
||||
|
||||
} catch (IOException e) {
|
||||
Log.err("Open Module Surface Area " + modulePath, e.getMessage());
|
||||
continue;
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Module Surface Area " + modulePath, e.getMessage());
|
||||
continue;
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
|
||||
continue;
|
||||
}
|
||||
id = Tools.getId(modulePath, msa);
|
||||
mid = new ModuleIdentification(id, vPackageList.elementAt(indexI));
|
||||
vModuleList.addElement(mid);
|
||||
openingModuleList.insertToOpeningModuleList(mid, msa);
|
||||
}
|
||||
}
|
||||
Sort.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initPackage() {
|
||||
vPackageList = new Vector<PackageIdentification>();
|
||||
openingPackageList = new OpeningPackageList();
|
||||
if (fdb != null) {
|
||||
for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {
|
||||
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
|
||||
+ fdb.getPackageList().getFilenameArray(index).getStringValue();
|
||||
path = Tools.convertPathToCurrentOsType(path);
|
||||
PackageSurfaceArea spd = null;
|
||||
PackageIdentification id = null;
|
||||
try {
|
||||
spd = OpenFile.openSpdFile(path);
|
||||
} catch (IOException e) {
|
||||
Log.err("Open Package Surface Area " + path, e.getMessage());
|
||||
continue;
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Package Surface Area " + path, e.getMessage());
|
||||
continue;
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Package Surface Area " + path, "Invalid file type");
|
||||
continue;
|
||||
}
|
||||
id = Tools.getId(path, spd);
|
||||
vPackageList.addElement(id);
|
||||
openingPackageList.insertToOpeningPackageList(id, spd);
|
||||
}
|
||||
Sort.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initPlatform() {
|
||||
vPlatformList = new Vector<PlatformIdentification>();
|
||||
openingPlatformList = new OpeningPlatformList();
|
||||
|
||||
if (fdb != null) {
|
||||
for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {
|
||||
String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR
|
||||
+ fdb.getPlatformList().getFilenameArray(index).getStringValue();
|
||||
path = Tools.convertPathToCurrentOsType(path);
|
||||
PlatformSurfaceArea fpd = null;
|
||||
PlatformIdentification id = null;
|
||||
try {
|
||||
fpd = OpenFile.openFpdFile(path);
|
||||
} catch (IOException e) {
|
||||
Log.err("Open Platform Surface Area " + path, e.getMessage());
|
||||
continue;
|
||||
} catch (XmlException e) {
|
||||
Log.err("Open Platform Surface Area " + path, e.getMessage());
|
||||
continue;
|
||||
} catch (Exception e) {
|
||||
Log.err("Open Platform Surface Area " + path, "Invalid file type");
|
||||
continue;
|
||||
}
|
||||
id = Tools.getId(path, fpd);
|
||||
vPlatformList.addElement(new PlatformIdentification(id));
|
||||
openingPlatformList.insertToOpeningPlatformList(id, fpd);
|
||||
}
|
||||
Sort.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get all modules' paths from one package
|
||||
|
||||
@return a Vector with all modules' path
|
||||
|
||||
**/
|
||||
public static Vector<String> getAllModulesOfPackage(String path) {
|
||||
Vector<String> modulePath = new Vector<String>();
|
||||
try {
|
||||
MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();
|
||||
if (files != null) {
|
||||
for (int index = 0; index < files.getFilenameList().size(); index++) {
|
||||
String msaPath = files.getFilenameList().get(index);
|
||||
msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;
|
||||
msaPath = Tools.convertPathToCurrentOsType(msaPath);
|
||||
modulePath.addElement(msaPath);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.err("Get all modules from a package " + path, e.getMessage());
|
||||
} catch (XmlException e) {
|
||||
Log.err("Get all modules from a package " + path, e.getMessage());
|
||||
} catch (Exception e) {
|
||||
Log.err("Get all modules from a package " + path, e.getMessage());
|
||||
}
|
||||
return modulePath;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override DefaultTableModel to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
public class IDefaultTableModel extends DefaultTableModel {
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
private static final long serialVersionUID = -1782544418084080185L;
|
||||
|
||||
public IDefaultTableModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.table.TableModel#isCellEditable(int, int)
|
||||
*
|
||||
*/
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override FileFilter to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
/**
|
||||
The class is used to override FileFilter to provides customized interfaces
|
||||
|
||||
**/
|
||||
public class IFileFilter extends FileFilter {
|
||||
|
||||
private String strExt;
|
||||
|
||||
/**
|
||||
Reserved for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
@param ext
|
||||
|
||||
**/
|
||||
public IFileFilter(String ext) {
|
||||
this.strExt = ext;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.filechooser.FileFilter#accept(java.io.File)
|
||||
*
|
||||
* Override method "accept"
|
||||
*
|
||||
*/
|
||||
public boolean accept(File file) {
|
||||
if (file.isDirectory()) {
|
||||
return true;
|
||||
}
|
||||
String strFileName = file.getName();
|
||||
int intIndex = strFileName.lastIndexOf('.');
|
||||
if (intIndex > 0 && intIndex < strFileName.length() - 1) {
|
||||
String strExtension = strFileName.substring(intIndex + 1).toLowerCase();
|
||||
if (strExtension.equals(strExt))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.filechooser.FileFilter#getDescription()
|
||||
*
|
||||
* Override method "getDescription" to config description via different file type
|
||||
*
|
||||
*/
|
||||
public String getDescription() {
|
||||
if (strExt.equals(DataType.MODULE_SURFACE_AREA_EXT))
|
||||
return DataType.MODULE_SURFACE_AREA_EXT_DESCRIPTION;
|
||||
if (strExt.equals(DataType.PACKAGE_SURFACE_AREA_EXT))
|
||||
return DataType.PACKAGE_SURFACE_AREA_EXT_DESCRIPTION;
|
||||
if (strExt.equals(DataType.PLATFORM_SURFACE_AREA_EXT))
|
||||
return DataType.PLATFORM_SURFACE_AREA_EXT_DESCRIPTION;
|
||||
if (strExt.equals(DataType.TEXT_FILE_EXT))
|
||||
return DataType.TEXT_FILE_EXT_DESCRIPTION;
|
||||
if (strExt.equals(DataType.FAR_SURFACE_AREA_EXT))
|
||||
return DataType.FAR_SURFACE_AREA_EXT_DESCRIPTION;
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
/** @file
|
||||
|
||||
The file is used to save basic 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.common.Identifications;
|
||||
|
||||
public class Identification {
|
||||
|
||||
///
|
||||
/// Define class members
|
||||
///
|
||||
private String name;
|
||||
|
||||
private String guid;
|
||||
|
||||
private String version;
|
||||
|
||||
private String path;
|
||||
|
||||
public Identification(String name, String guid, String version) {
|
||||
this.name = name;
|
||||
this.guid = guid;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public Identification() {
|
||||
|
||||
}
|
||||
|
||||
public Identification(String name, String guid, String version, String path) {
|
||||
this.name = name;
|
||||
this.guid = guid;
|
||||
this.version = version;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Identification) {
|
||||
Identification id = (Identification) obj;
|
||||
if (path.equals(id.path)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equalsWithGuid(Object obj) {
|
||||
if (obj instanceof Identification) {
|
||||
Identification id = (Identification) obj;
|
||||
if (guid.equalsIgnoreCase(id.guid)) {
|
||||
if (version == null || id.version == null) {
|
||||
return true;
|
||||
} else if (version.trim().equalsIgnoreCase("") || id.version.trim().equalsIgnoreCase("")) {
|
||||
return true;
|
||||
} else if (version.equalsIgnoreCase(id.version)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return super.equals(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setGuid(String guid) {
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return guid.toLowerCase().hashCode();
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define common opening file type
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
|
||||
public class OpeningFileType {
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private boolean isSaved = true;
|
||||
|
||||
private boolean isNew = false;
|
||||
|
||||
private boolean isOpen = false;
|
||||
|
||||
private Set<TreePath> treePath = new LinkedHashSet<TreePath>();
|
||||
|
||||
public OpeningFileType() {
|
||||
|
||||
}
|
||||
|
||||
public boolean isNew() {
|
||||
return isNew;
|
||||
}
|
||||
|
||||
public void setNew(boolean isNew) {
|
||||
this.isNew = isNew;
|
||||
}
|
||||
|
||||
public boolean isSaved() {
|
||||
return isSaved;
|
||||
}
|
||||
|
||||
public void setSaved(boolean isSaved) {
|
||||
this.isSaved = isSaved;
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
public void setOpen(boolean isOpen) {
|
||||
this.isOpen = isOpen;
|
||||
}
|
||||
|
||||
public Set<TreePath> getTreePath() {
|
||||
return treePath;
|
||||
}
|
||||
|
||||
public void setTreePath(Set<TreePath> treePath) {
|
||||
this.treePath = treePath;
|
||||
}
|
||||
}
|
@ -0,0 +1,224 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define opening module list
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
|
||||
public class OpeningModuleList {
|
||||
private Vector<OpeningModuleType> vOpeningModuleList = new Vector<OpeningModuleType>();
|
||||
|
||||
public OpeningModuleList() {
|
||||
|
||||
}
|
||||
|
||||
public Vector<OpeningModuleType> getVOpeningModuleList() {
|
||||
return vOpeningModuleList;
|
||||
}
|
||||
|
||||
public void setVOpeningModuleList(Vector<OpeningModuleType> openingModuleList) {
|
||||
vOpeningModuleList = openingModuleList;
|
||||
}
|
||||
|
||||
public void insertToOpeningModuleList(ModuleIdentification id, ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {
|
||||
vOpeningModuleList.addElement(new OpeningModuleType(id, xmlMsa));
|
||||
}
|
||||
|
||||
public OpeningModuleType getOpeningModuleByIndex(int index) {
|
||||
if (index > -1 && index < vOpeningModuleList.size()) {
|
||||
return vOpeningModuleList.elementAt(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OpeningModuleType getOpeningModuleById(ModuleIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningModuleList.elementAt(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int findIndexOfListById(ModuleIdentification id) {
|
||||
for (int index = 0; index < vOpeningModuleList.size(); index++) {
|
||||
if (vOpeningModuleList.elementAt(index).getId().equals(id)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void removeFromOpeningModuleListByIndex(int index) {
|
||||
if (index > -1 && index < vOpeningModuleList.size()) {
|
||||
vOpeningModuleList.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromOpeningModuleListById(ModuleIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningModuleList.removeElementAt(findIndexOfListById(id));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllFromOpeningModuleList() {
|
||||
vOpeningModuleList.removeAllElements();
|
||||
}
|
||||
|
||||
public ModuleSurfaceAreaDocument.ModuleSurfaceArea getModuleSurfaceAreaFromId(ModuleIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningModuleList.elementAt(index).getXmlMsa();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean existsModule(ModuleIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setModuleSaved(ModuleIdentification id, boolean isSaved) {
|
||||
setModuleSaved(findIndexOfListById(id), isSaved);
|
||||
}
|
||||
|
||||
public void setModuleSaved(int index, boolean isSaved) {
|
||||
if (index > -1) {
|
||||
vOpeningModuleList.elementAt(index).setSaved(isSaved);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getModuleSaved(ModuleIdentification id) {
|
||||
return getModuleSaved(findIndexOfListById(id));
|
||||
}
|
||||
|
||||
public boolean getModuleSaved(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningModuleList.elementAt(index).isSaved();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setModuleOpen(ModuleIdentification id, boolean isOpen) {
|
||||
setModuleOpen(findIndexOfListById(id), isOpen);
|
||||
}
|
||||
|
||||
public void setModuleOpen(int index, boolean isOpen) {
|
||||
if (index > -1) {
|
||||
vOpeningModuleList.elementAt(index).setOpen(isOpen);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getModuleOpen(ModuleIdentification id) {
|
||||
return getModuleOpen(findIndexOfListById(id));
|
||||
}
|
||||
|
||||
public boolean getModuleOpen(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningModuleList.elementAt(index).isOpen();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTreePathById(ModuleIdentification id, Set<TreePath> treePath) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningModuleList.elementAt(index).setTreePath(treePath);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<TreePath> getTreePathById(ModuleIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningModuleList.elementAt(index).getTreePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<TreePath> getTreePathByIndex(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningModuleList.elementAt(index).getTreePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ModuleIdentification getIdByPath(String path) {
|
||||
ModuleIdentification id = new ModuleIdentification(null, null, null, path);
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningModuleList.elementAt(index).getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ModuleIdentification getIdByGuidVersion(String guid, String version) {
|
||||
for (int index = 0; index < vOpeningModuleList.size(); index++) {
|
||||
ModuleIdentification id = vOpeningModuleList.elementAt(index).getId();
|
||||
if (version != null) {
|
||||
if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {
|
||||
return id;
|
||||
}
|
||||
} else {
|
||||
if (id.getGuid().equals(guid)) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setNew(ModuleIdentification id, boolean isNew) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningModuleList.elementAt(index).setNew(isNew);
|
||||
}
|
||||
}
|
||||
|
||||
public void closeAll() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
this.setModuleOpen(index, false);
|
||||
}
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return vOpeningModuleList.size();
|
||||
}
|
||||
|
||||
public boolean isSaved() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
if (!this.getModuleSaved(index)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
if (this.getModuleOpen(index)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define opening module type
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
|
||||
public class OpeningModuleType extends OpeningFileType{
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa = null;
|
||||
|
||||
private ModuleIdentification id = null;
|
||||
|
||||
public OpeningModuleType() {
|
||||
|
||||
}
|
||||
|
||||
public OpeningModuleType(ModuleIdentification identification, ModuleSurfaceAreaDocument.ModuleSurfaceArea msa) {
|
||||
this.id = identification;
|
||||
this.xmlMsa = msa;
|
||||
}
|
||||
|
||||
public ModuleSurfaceAreaDocument.ModuleSurfaceArea getXmlMsa() {
|
||||
return xmlMsa;
|
||||
}
|
||||
|
||||
public void setXmlMsa(ModuleSurfaceAreaDocument.ModuleSurfaceArea xmlMsa) {
|
||||
this.xmlMsa = xmlMsa;
|
||||
}
|
||||
|
||||
public ModuleIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(ModuleIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,224 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define opening package list
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.tianocore.PackageSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
public class OpeningPackageList {
|
||||
private Vector<OpeningPackageType> vOpeningPackageList = new Vector<OpeningPackageType>();
|
||||
|
||||
public OpeningPackageList() {
|
||||
|
||||
}
|
||||
|
||||
public Vector<OpeningPackageType> getVOpeningPackageList() {
|
||||
return vOpeningPackageList;
|
||||
}
|
||||
|
||||
public void setVOpeningPackageList(Vector<OpeningPackageType> openingPackageList) {
|
||||
vOpeningPackageList = openingPackageList;
|
||||
}
|
||||
|
||||
public void insertToOpeningPackageList(PackageIdentification id, PackageSurfaceAreaDocument.PackageSurfaceArea xmlMsa) {
|
||||
vOpeningPackageList.addElement(new OpeningPackageType(id, xmlMsa));
|
||||
}
|
||||
|
||||
public OpeningPackageType getOpeningPackageByIndex(int index) {
|
||||
if (index > -1 && index < vOpeningPackageList.size()) {
|
||||
return vOpeningPackageList.elementAt(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OpeningPackageType getOpeningPackageById(PackageIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPackageList.elementAt(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int findIndexOfListById(PackageIdentification id) {
|
||||
for (int index = 0; index < vOpeningPackageList.size(); index++) {
|
||||
if (vOpeningPackageList.elementAt(index).getId().equals(id)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void removeFromOpeningPackageListByIndex(int index) {
|
||||
if (index > -1 && index < vOpeningPackageList.size()) {
|
||||
vOpeningPackageList.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromOpeningPackageListById(PackageIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningPackageList.removeElementAt(findIndexOfListById(id));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllFromOpeningPackageList() {
|
||||
vOpeningPackageList.removeAllElements();
|
||||
}
|
||||
|
||||
public PackageSurfaceAreaDocument.PackageSurfaceArea getPackageSurfaceAreaFromId(PackageIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPackageList.elementAt(index).getXmlSpd();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean existsPackage(PackageIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setPackageSaved(PackageIdentification id, boolean isSaved) {
|
||||
setPackageSaved(findIndexOfListById(id), isSaved);
|
||||
}
|
||||
|
||||
public void setPackageSaved(int index, boolean isSaved) {
|
||||
if (index > -1) {
|
||||
vOpeningPackageList.elementAt(index).setSaved(isSaved);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getPackageSaved(PackageIdentification id) {
|
||||
return getPackageSaved(findIndexOfListById(id));
|
||||
}
|
||||
|
||||
public boolean getPackageSaved(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningPackageList.elementAt(index).isSaved();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPackageOpen(PackageIdentification id, boolean isOpem) {
|
||||
setPackageOpen(findIndexOfListById(id), isOpem);
|
||||
}
|
||||
|
||||
public void setPackageOpen(int index, boolean isOpem) {
|
||||
if (index > -1) {
|
||||
vOpeningPackageList.elementAt(index).setOpen(isOpem);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getPackageOpen(PackageIdentification id) {
|
||||
return getPackageOpen(findIndexOfListById(id));
|
||||
}
|
||||
|
||||
public boolean getPackageOpen(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningPackageList.elementAt(index).isOpen();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTreePathById(PackageIdentification id, Set<TreePath> treePath) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningPackageList.elementAt(index).setTreePath(treePath);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<TreePath> getTreePathById(PackageIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPackageList.elementAt(index).getTreePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<TreePath> getTreePathByIndex(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningPackageList.elementAt(index).getTreePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PackageIdentification getIdByPath(String path) {
|
||||
PackageIdentification id = new PackageIdentification(null, null, null, path);
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPackageList.elementAt(index).getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PackageIdentification getIdByGuidVersion(String guid, String version) {
|
||||
for (int index = 0; index < vOpeningPackageList.size(); index++) {
|
||||
PackageIdentification id = vOpeningPackageList.elementAt(index).getId();
|
||||
if (version != null) {
|
||||
if (id.getGuid().equals(guid) && id.getVersion().equals(version)) {
|
||||
return id;
|
||||
}
|
||||
} else {
|
||||
if (id.getGuid().equals(guid)) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setNew(PackageIdentification id, boolean isNew) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningPackageList.elementAt(index).setNew(isNew);
|
||||
}
|
||||
}
|
||||
|
||||
public void closeAll() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
this.setPackageOpen(index, false);
|
||||
}
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return vOpeningPackageList.size();
|
||||
}
|
||||
|
||||
public boolean isSaved() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
if (!this.getPackageSaved(index)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
if (this.getPackageOpen(index)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define opening package type
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import org.tianocore.PackageSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
public class OpeningPackageType extends OpeningFileType {
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd = null;
|
||||
|
||||
private PackageIdentification id = null;
|
||||
|
||||
public OpeningPackageType() {
|
||||
|
||||
}
|
||||
|
||||
public OpeningPackageType(PackageIdentification identification, PackageSurfaceAreaDocument.PackageSurfaceArea spd) {
|
||||
this.id = identification;
|
||||
this.xmlSpd = spd;
|
||||
}
|
||||
|
||||
public PackageSurfaceAreaDocument.PackageSurfaceArea getXmlSpd() {
|
||||
return xmlSpd;
|
||||
}
|
||||
|
||||
public void setXmlSpd(PackageSurfaceAreaDocument.PackageSurfaceArea xmlSpd) {
|
||||
this.xmlSpd = xmlSpd;
|
||||
}
|
||||
|
||||
public PackageIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(PackageIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,210 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define opening package list
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.tianocore.PlatformSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
|
||||
public class OpeningPlatformList {
|
||||
|
||||
private Vector<OpeningPlatformType> vOpeningPlatformList = new Vector<OpeningPlatformType>();
|
||||
|
||||
public OpeningPlatformList() {
|
||||
|
||||
}
|
||||
|
||||
public Vector<OpeningPlatformType> getVOpeningPlatformList() {
|
||||
return vOpeningPlatformList;
|
||||
}
|
||||
|
||||
public void setVOpeningPlatformList(Vector<OpeningPlatformType> openingPlatformList) {
|
||||
vOpeningPlatformList = openingPlatformList;
|
||||
}
|
||||
|
||||
public void insertToOpeningPlatformList(PlatformIdentification id, PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {
|
||||
vOpeningPlatformList.addElement(new OpeningPlatformType(id, xmlFpd));
|
||||
}
|
||||
|
||||
public OpeningPlatformType getOpeningPlatformByIndex(int index) {
|
||||
if (index > -1 && index < vOpeningPlatformList.size()) {
|
||||
return vOpeningPlatformList.elementAt(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OpeningPlatformType getOpeningPlatformById(PlatformIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPlatformList.elementAt(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int findIndexOfListById(PlatformIdentification id) {
|
||||
for (int index = 0; index < vOpeningPlatformList.size(); index++) {
|
||||
if (vOpeningPlatformList.elementAt(index).getId().equals(id)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void removeFromOpeningPlatformListByIndex(int index) {
|
||||
if (index > -1 && index < vOpeningPlatformList.size()) {
|
||||
vOpeningPlatformList.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromOpeningPlatformListById(PlatformIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningPlatformList.removeElementAt(findIndexOfListById(id));
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAllFromOpeningPlatformList() {
|
||||
vOpeningPlatformList.removeAllElements();
|
||||
}
|
||||
|
||||
public PlatformSurfaceAreaDocument.PlatformSurfaceArea getPlatformSurfaceAreaFromId(PlatformIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPlatformList.elementAt(index).getXmlFpd();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean existsPlatform(PlatformIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void setPlatformSaved(PlatformIdentification id, boolean isSaved) {
|
||||
setPlatformSaved(findIndexOfListById(id), isSaved);
|
||||
}
|
||||
|
||||
public void setPlatformSaved(int index, boolean isSaved) {
|
||||
if (index > -1) {
|
||||
vOpeningPlatformList.elementAt(index).setSaved(isSaved);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getPlatformSaved(PlatformIdentification id) {
|
||||
return getPlatformSaved(findIndexOfListById(id));
|
||||
}
|
||||
|
||||
public boolean getPlatformSaved(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningPlatformList.elementAt(index).isSaved();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setPlatformOpen(PlatformIdentification id, boolean isOpen) {
|
||||
setPlatformOpen(findIndexOfListById(id), isOpen);
|
||||
}
|
||||
|
||||
public void setPlatformOpen(int index, boolean isOpen) {
|
||||
if (index > -1) {
|
||||
vOpeningPlatformList.elementAt(index).setOpen(isOpen);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getPlatformOpen(PlatformIdentification id) {
|
||||
return getPlatformOpen(findIndexOfListById(id));
|
||||
}
|
||||
|
||||
public boolean getPlatformOpen(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningPlatformList.elementAt(index).isOpen();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setTreePathById(PlatformIdentification id, Set<TreePath> treePath) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningPlatformList.elementAt(index).setTreePath(treePath);
|
||||
}
|
||||
}
|
||||
|
||||
public Set<TreePath> getTreePathById(PlatformIdentification id) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPlatformList.elementAt(index).getTreePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Set<TreePath> getTreePathByIndex(int index) {
|
||||
if (index > -1) {
|
||||
return vOpeningPlatformList.elementAt(index).getTreePath();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PlatformIdentification getIdByPath(String path) {
|
||||
PlatformIdentification id = new PlatformIdentification(null, null, null, path);
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
return vOpeningPlatformList.elementAt(index).getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setNew(PlatformIdentification id, boolean isNew) {
|
||||
int index = findIndexOfListById(id);
|
||||
if (index > -1) {
|
||||
vOpeningPlatformList.elementAt(index).setNew(isNew);
|
||||
}
|
||||
}
|
||||
|
||||
public void closeAll() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
this.setPlatformOpen(index, false);
|
||||
}
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return vOpeningPlatformList.size();
|
||||
}
|
||||
|
||||
public boolean isSaved() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
if (!this.getPlatformSaved(index)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
for (int index = 0; index < this.size(); index++) {
|
||||
if (this.getPlatformOpen(index)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define opening platform type
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import org.tianocore.PlatformSurfaceAreaDocument;
|
||||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
|
||||
public class OpeningPlatformType extends OpeningFileType {
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd = null;
|
||||
|
||||
private PlatformIdentification id = null;
|
||||
|
||||
public OpeningPlatformType() {
|
||||
|
||||
}
|
||||
|
||||
public OpeningPlatformType(PlatformIdentification identification, PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {
|
||||
this.id = identification;
|
||||
this.xmlFpd = fpd;
|
||||
}
|
||||
|
||||
public PlatformSurfaceAreaDocument.PlatformSurfaceArea getXmlFpd() {
|
||||
return xmlFpd;
|
||||
}
|
||||
|
||||
public void setXmlFpd(PlatformSurfaceAreaDocument.PlatformSurfaceArea xmlFpd) {
|
||||
this.xmlFpd = xmlFpd;
|
||||
}
|
||||
|
||||
public PlatformIdentification getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(PlatformIdentification id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Tool Chain Configuration Identification
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
public class ToolChainConfigId {
|
||||
|
||||
public static final String COMMENTS = "#";
|
||||
|
||||
public static final String EQUALS = "=";
|
||||
|
||||
private String name = "";
|
||||
|
||||
private String value = "";
|
||||
|
||||
public ToolChainConfigId(String strName, String strValue) {
|
||||
this.name = strName;
|
||||
this.value = strValue;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public boolean equals(ToolChainConfigId id) {
|
||||
if (this.name.equals(id.name)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Tool Chain Configuration Vector
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.Identifications;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
|
||||
public class ToolChainConfigVector {
|
||||
|
||||
private Vector<ToolChainConfigId> vToolChainConfigs = new Vector<ToolChainConfigId>();
|
||||
|
||||
public int findToolChainConfigs(ToolChainConfigId sfi) {
|
||||
for (int index = 0; index < vToolChainConfigs.size(); index++) {
|
||||
if (vToolChainConfigs.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findToolChainConfigs(String name) {
|
||||
for (int index = 0; index < vToolChainConfigs.size(); index++) {
|
||||
if (vToolChainConfigs.elementAt(index).getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ToolChainConfigId getToolChainConfigs(int index) {
|
||||
if (index > -1) {
|
||||
return vToolChainConfigs.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getToolChainConfigs(index).getName());
|
||||
v.addElement(getToolChainConfigs(index).getValue());
|
||||
return v;
|
||||
}
|
||||
|
||||
public void addToolChainConfigs(ToolChainConfigId arg0) {
|
||||
vToolChainConfigs.addElement(arg0);
|
||||
}
|
||||
|
||||
public void updateToolChainConfigs(ToolChainConfigId arg0, int arg1) {
|
||||
vToolChainConfigs.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeToolChainConfigs(ToolChainConfigId arg0) {
|
||||
int index = findToolChainConfigs(arg0);
|
||||
if (index > -1) {
|
||||
vToolChainConfigs.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeToolChainConfigs(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vToolChainConfigs.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
vToolChainConfigs = new Vector<ToolChainConfigId>();
|
||||
}
|
||||
|
||||
public Vector<String> getToolChainConfigsName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vToolChainConfigs.size(); index++) {
|
||||
v.addElement(vToolChainConfigs.get(index).getName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public Vector<String> getToolChainConfigsValue() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vToolChainConfigs.size(); index++) {
|
||||
v.addElement(vToolChainConfigs.get(index).getValue());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vToolChainConfigs.size();
|
||||
}
|
||||
|
||||
public void saveFile(String file) throws IOException {
|
||||
if (size() > 0) {
|
||||
FileWriter fw = new FileWriter(file);
|
||||
BufferedWriter bw = new BufferedWriter(fw);
|
||||
for (int index = 0; index < size(); index++) {
|
||||
String line = this.getToolChainConfigs(index).getName() + " " + ToolChainConfigId.EQUALS + " "
|
||||
+ this.getToolChainConfigs(index).getValue();
|
||||
bw.write(line);
|
||||
bw.newLine();
|
||||
}
|
||||
bw.flush();
|
||||
bw.close();
|
||||
fw.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@param file
|
||||
@throws IOException
|
||||
@throws FileNotFoundException
|
||||
|
||||
**/
|
||||
public void parseFile(String file) throws IOException {
|
||||
FileReader fr = new FileReader(file);
|
||||
BufferedReader br = new BufferedReader(fr);
|
||||
String line = br.readLine();
|
||||
while (line != null) {
|
||||
parseLine(line);
|
||||
line = br.readLine();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Parse the input string and add name, value to vector
|
||||
|
||||
@param line
|
||||
|
||||
**/
|
||||
private void parseLine(String line) {
|
||||
String name = "";
|
||||
String value = "";
|
||||
if (line.indexOf(ToolChainConfigId.COMMENTS) != 0 && line.indexOf(ToolChainConfigId.EQUALS) > -1) {
|
||||
name = line.substring(0, line.indexOf(ToolChainConfigId.EQUALS)).trim();
|
||||
value = line.substring(line.indexOf(ToolChainConfigId.EQUALS) + 1).trim();
|
||||
this.addToolChainConfigs(new ToolChainConfigId(name, value));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,255 @@
|
||||
/** @file
|
||||
|
||||
The file is used to provides static interfaces to save log and error 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.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
/**
|
||||
The class is used to provides static interfaces to save log and error information
|
||||
|
||||
**/
|
||||
public class Log {
|
||||
|
||||
//
|
||||
//Log file
|
||||
//
|
||||
private static File fleLogFile = null;
|
||||
|
||||
//
|
||||
//Wrn file
|
||||
//
|
||||
private static File fleWrnFile = null;
|
||||
|
||||
//
|
||||
//Err file
|
||||
//
|
||||
private static File fleErrFile = null;
|
||||
|
||||
//
|
||||
//Log file name
|
||||
//
|
||||
static String strLogFileName = "Log.log";
|
||||
|
||||
//
|
||||
//Wrn file name
|
||||
//
|
||||
static String strWrnFileName = "Wrn.log";
|
||||
|
||||
//
|
||||
//Err file name
|
||||
//
|
||||
static String strErrFileName = "Err.log";
|
||||
|
||||
/**
|
||||
Main class, used for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
//Log.log("Test", "test");
|
||||
//Log.err("Test1", "test1");
|
||||
Log
|
||||
.wrn("aaa bbbbbb cccccccccccc ddddddddddd eeeeeeeeee fffffffffff gggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhh iiiii jjjj kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk lll mmm nn poooooooooooooooooooooooooooooooooooooooooooop");
|
||||
Log.wrn("Incorrect data type for ModuleEntryPoint");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Call writeToLogFile to save log item and log information to log file
|
||||
|
||||
@param strItem The log item
|
||||
@param strLog The log information
|
||||
|
||||
**/
|
||||
public static void log(String strItem, String strLog) {
|
||||
try {
|
||||
writeToLogFile(strItem + ":" + strLog);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Call writeToLogFile to save log information to log file
|
||||
|
||||
@param strLog The log information
|
||||
|
||||
**/
|
||||
public static void log(String strLog) {
|
||||
try {
|
||||
writeToLogFile(strLog);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Call writeToWrnFile to save wrn item and wrn information to wrn file
|
||||
|
||||
@param strItem The wrn item
|
||||
@param strLog The wrn information
|
||||
|
||||
**/
|
||||
public static void wrn(String strItem, String strWrn) {
|
||||
try {
|
||||
writeToWrnFile("Warning when " + strItem + "::" + strWrn);
|
||||
showWrnMessage(strWrn);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Call writeToWrnFile to save wrn information to wrn file
|
||||
|
||||
@param strLog The wrn information
|
||||
|
||||
**/
|
||||
public static void wrn(String strWrn) {
|
||||
try {
|
||||
writeToWrnFile("Warning::" + strWrn);
|
||||
showWrnMessage("Warning::" + strWrn);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Call writeToErrFile to save err item and err information to err file
|
||||
|
||||
@param strItem The err item
|
||||
@param strLog The err information
|
||||
|
||||
**/
|
||||
public static void err(String strItem, String strErr) {
|
||||
try {
|
||||
writeToErrFile("Error when " + strItem + "::" + strErr);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Call writeToErrFile to save err information to err file
|
||||
|
||||
@param strLog The err information
|
||||
|
||||
**/
|
||||
public static void err(String strErr) {
|
||||
try {
|
||||
writeToErrFile("Error::" + strErr);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Brings up a dialog to show err message
|
||||
When the message's length > defined max length, wrap the text to the next line.
|
||||
|
||||
@param strErr The input data of err message
|
||||
|
||||
**/
|
||||
private static void showWrnMessage(String strErr) {
|
||||
String strReturn = Tools.wrapStringByWord(strErr);
|
||||
JOptionPane
|
||||
.showConfirmDialog(null, strReturn, "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
Open log file and write log information
|
||||
|
||||
@param strLog The log information
|
||||
@throws IOException
|
||||
|
||||
**/
|
||||
private static void writeToLogFile(String strLog) throws IOException {
|
||||
try {
|
||||
if (fleLogFile == null) {
|
||||
fleLogFile = new File(strLogFileName);
|
||||
fleLogFile.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(fleLogFile, true);
|
||||
fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
|
||||
fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Open wrn file and write wrn information
|
||||
|
||||
@param strLog The log information
|
||||
@throws IOException
|
||||
|
||||
**/
|
||||
private static void writeToWrnFile(String strLog) throws IOException {
|
||||
try {
|
||||
if (fleWrnFile == null) {
|
||||
fleWrnFile = new File(strWrnFileName);
|
||||
fleWrnFile.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(fleWrnFile, true);
|
||||
fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
|
||||
fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Open err file and write err information
|
||||
|
||||
@param strLog The log information
|
||||
@throws IOException
|
||||
|
||||
**/
|
||||
private static void writeToErrFile(String strLog) throws IOException {
|
||||
try {
|
||||
if (fleErrFile == null) {
|
||||
fleErrFile = new File(strErrFileName);
|
||||
fleErrFile.createNewFile();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(fleErrFile, true);
|
||||
fos.write((Tools.getCurrentDateTime() + DataType.DOS_LINE_SEPARATOR).getBytes());
|
||||
fos.write((strLog + DataType.DOS_LINE_SEPARATOR).getBytes());
|
||||
fos.flush();
|
||||
fos.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/** @file
|
||||
|
||||
The file provides interface to open xml file.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.tianocore.FrameworkDatabaseDocument;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
||||
import org.tianocore.PackageSurfaceAreaDocument;
|
||||
import org.tianocore.PlatformSurfaceAreaDocument;
|
||||
import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
|
||||
|
||||
public class OpenFile {
|
||||
/**
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Open specificed Msa file and read its content
|
||||
|
||||
@param strMsaFilePath The input data of Msa File Path
|
||||
|
||||
**/
|
||||
public static ModuleSurfaceArea openMsaFile(String strMsaFilePath) throws IOException, XmlException, Exception {
|
||||
Log.log("Open Msa", strMsaFilePath);
|
||||
File msaFile = new File(strMsaFilePath);
|
||||
ModuleSurfaceAreaDocument xmlMsaDoc = (ModuleSurfaceAreaDocument) XmlObject.Factory.parse(msaFile);
|
||||
return xmlMsaDoc.getModuleSurfaceArea();
|
||||
}
|
||||
|
||||
/**
|
||||
Open specificed Spd file and read its content
|
||||
|
||||
@param strSpdFilePath The input data of Spd File Path
|
||||
|
||||
**/
|
||||
public static PackageSurfaceArea openSpdFile(String strSpdFilePath) throws IOException, XmlException, Exception {
|
||||
Log.log("Open Spd", strSpdFilePath);
|
||||
File spdFile = new File(strSpdFilePath);
|
||||
PackageSurfaceAreaDocument xmlSpdDoc = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(spdFile);
|
||||
return xmlSpdDoc.getPackageSurfaceArea();
|
||||
}
|
||||
|
||||
/**
|
||||
Open specificed Fpd file and read its content
|
||||
|
||||
@param strFpdFilePath The input data of Fpd File Path
|
||||
|
||||
**/
|
||||
public static PlatformSurfaceArea openFpdFile(String strFpdFilePath) throws IOException, XmlException,
|
||||
Exception {
|
||||
Log.log("Open Fpd", strFpdFilePath);
|
||||
File fpdFile = new File(strFpdFilePath);
|
||||
PlatformSurfaceAreaDocument xmlFpdDoc = null;
|
||||
xmlFpdDoc = (PlatformSurfaceAreaDocument) XmlObject.Factory.parse(fpdFile);
|
||||
return xmlFpdDoc.getPlatformSurfaceArea();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Open specificed Framework Database file and read its content
|
||||
|
||||
*/
|
||||
public static FrameworkDatabase openFrameworkDb(String strDbFilePath) throws IOException, XmlException, Exception {
|
||||
Log.log("Open Framework Database", strDbFilePath);
|
||||
File db = new File(strDbFilePath);
|
||||
FrameworkDatabaseDocument xmlDb = null;
|
||||
xmlDb = (FrameworkDatabaseDocument) XmlObject.Factory.parse(db);
|
||||
return xmlDb.getFrameworkDatabase();
|
||||
}
|
||||
}
|
@ -0,0 +1,334 @@
|
||||
/** @file
|
||||
|
||||
The file provides interface to save xml file.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.xmlbeans.XmlCursor;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
import org.tianocore.FrameworkDatabaseDocument;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
||||
import org.tianocore.PackageSurfaceAreaDocument;
|
||||
import org.tianocore.PlatformSurfaceAreaDocument;
|
||||
import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
|
||||
|
||||
public class SaveFile {
|
||||
|
||||
/**
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
|
||||
private static void createDirectory(String path) throws Exception {
|
||||
File f = new File(path);
|
||||
path = f.getParent();
|
||||
FileOperation.newFolder(path);
|
||||
}
|
||||
|
||||
/**
|
||||
Save file as msa
|
||||
|
||||
**/
|
||||
public static void saveMsaFile(String path, ModuleSurfaceArea msa) throws Exception {
|
||||
//
|
||||
// Create the file's directory first
|
||||
//
|
||||
createDirectory(path);
|
||||
|
||||
//
|
||||
// Remove all empty top level elements
|
||||
//
|
||||
XmlObject o = msa.getLibraryClassDefinitions();
|
||||
if (o != null) {
|
||||
if (msa.getLibraryClassDefinitions().getLibraryClassList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getSourceFiles();
|
||||
if (o != null) {
|
||||
if (msa.getSourceFiles().getFilenameList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getPackageDependencies();
|
||||
if (o != null) {
|
||||
if (msa.getPackageDependencies().getPackageList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getProtocols();
|
||||
if (o != null) {
|
||||
if (msa.getProtocols().getProtocolList().size() <= 0
|
||||
&& msa.getProtocols().getProtocolNotifyList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getEvents();
|
||||
if (o != null) {
|
||||
if (msa.getEvents().getCreateEvents() != null || msa.getEvents().getSignalEvents() != null) {
|
||||
if (msa.getEvents().getCreateEvents() != null && msa.getEvents().getCreateEvents().getEventTypesList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
if (msa.getEvents().getSignalEvents() != null && msa.getEvents().getSignalEvents().getEventTypesList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
} else {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getHobs();
|
||||
if (o != null) {
|
||||
if (msa.getHobs().getHobTypesList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getPPIs();
|
||||
if (o != null) {
|
||||
if (msa.getPPIs().getPpiList().size() <= 0 && msa.getPPIs().getPpiNotifyList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getVariables();
|
||||
if (o != null) {
|
||||
if (msa.getVariables().getVariableList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getBootModes();
|
||||
if (o != null) {
|
||||
if (msa.getBootModes().getBootModeList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getSystemTables();
|
||||
if (o != null) {
|
||||
if (msa.getSystemTables().getSystemTableCNamesList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getDataHubs();
|
||||
if (o != null) {
|
||||
if (msa.getDataHubs().getDataHubRecordList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getHiiPackages();
|
||||
if (o != null) {
|
||||
if (msa.getHiiPackages().getHiiPackageList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getGuids();
|
||||
if (o != null) {
|
||||
if (msa.getGuids().getGuidCNamesList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getExterns();
|
||||
if (o != null) {
|
||||
if (msa.getExterns().getExternList().size() <= 0 && msa.getExterns().getSpecificationList().size() <= 0
|
||||
&& msa.getExterns().getPcdIsDriver() == null) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
o = msa.getPcdCoded();
|
||||
if (o != null) {
|
||||
if (msa.getPcdCoded().getPcdEntryList().size() <= 0) {
|
||||
XmlCursor xmlCursor = o.newCursor();
|
||||
xmlCursor.removeXml();
|
||||
xmlCursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
ModuleSurfaceAreaDocument msaDoc = ModuleSurfaceAreaDocument.Factory.newInstance();
|
||||
File f = new File(path);
|
||||
|
||||
//
|
||||
//Init namespace
|
||||
//
|
||||
XmlCursor cursor = XmlConfig.setupXmlCursor(msa.newCursor());
|
||||
|
||||
//
|
||||
//Config file format
|
||||
//
|
||||
XmlOptions options = XmlConfig.setupXmlOptions();
|
||||
|
||||
//
|
||||
//Create finial doc
|
||||
//
|
||||
msaDoc.addNewModuleSurfaceArea();
|
||||
msaDoc.setModuleSurfaceArea((ModuleSurfaceArea) cursor.getObject());
|
||||
//
|
||||
//Save the file
|
||||
//
|
||||
msaDoc.save(f, options);
|
||||
cursor.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
Save file as spd
|
||||
|
||||
**/
|
||||
public static void saveSpdFile(String path, PackageSurfaceArea spd) throws Exception {
|
||||
//
|
||||
// Create the file's directory first
|
||||
//
|
||||
createDirectory(path);
|
||||
|
||||
PackageSurfaceAreaDocument spdDoc = PackageSurfaceAreaDocument.Factory.newInstance();
|
||||
File f = new File(path);
|
||||
|
||||
//
|
||||
//Init namespace
|
||||
//
|
||||
XmlCursor cursor = XmlConfig.setupXmlCursor(spd.newCursor());
|
||||
|
||||
//
|
||||
//Config file format
|
||||
//
|
||||
XmlOptions options = XmlConfig.setupXmlOptions();
|
||||
|
||||
//
|
||||
//Create finial doc
|
||||
//
|
||||
spdDoc.addNewPackageSurfaceArea();
|
||||
spdDoc.setPackageSurfaceArea((PackageSurfaceArea) cursor.getObject());
|
||||
//
|
||||
//Save the file
|
||||
//
|
||||
spdDoc.save(f, options);
|
||||
cursor.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
Save file as fpd
|
||||
|
||||
**/
|
||||
public static void saveFpdFile(String path, PlatformSurfaceArea fpd) throws Exception {
|
||||
//
|
||||
// Create the file's directory first
|
||||
//
|
||||
createDirectory(path);
|
||||
|
||||
PlatformSurfaceAreaDocument fpdDoc = PlatformSurfaceAreaDocument.Factory.newInstance();
|
||||
File f = new File(path);
|
||||
|
||||
//
|
||||
//Init namespace
|
||||
//
|
||||
XmlCursor cursor = XmlConfig.setupXmlCursor(fpd.newCursor());
|
||||
|
||||
//
|
||||
//Config file format
|
||||
//
|
||||
XmlOptions options = XmlConfig.setupXmlOptions();
|
||||
|
||||
//
|
||||
//Create finial doc
|
||||
//
|
||||
fpdDoc.addNewPlatformSurfaceArea();
|
||||
fpdDoc.setPlatformSurfaceArea((PlatformSurfaceArea) cursor.getObject());
|
||||
//
|
||||
//Save the file
|
||||
//
|
||||
fpdDoc.save(f, options);
|
||||
cursor.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
Save file as framework db
|
||||
|
||||
**/
|
||||
public static void saveDbFile(String path, FrameworkDatabase db) throws Exception {
|
||||
FrameworkDatabaseDocument dbDoc = FrameworkDatabaseDocument.Factory.newInstance();
|
||||
File f = new File(path);
|
||||
|
||||
//
|
||||
//Init namespace
|
||||
//
|
||||
XmlCursor cursor = XmlConfig.setupXmlCursor(db.newCursor());
|
||||
|
||||
//
|
||||
//Config file format
|
||||
//
|
||||
XmlOptions options = XmlConfig.setupXmlOptions();
|
||||
|
||||
//
|
||||
//Create finial doc
|
||||
//
|
||||
dbDoc.addNewFrameworkDatabase();
|
||||
dbDoc.setFrameworkDatabase((FrameworkDatabase) cursor.getObject());
|
||||
|
||||
//
|
||||
//Save the file
|
||||
//
|
||||
dbDoc.save(f, options);
|
||||
cursor.dispose();
|
||||
}
|
||||
}
|
@ -0,0 +1,378 @@
|
||||
/** @file
|
||||
|
||||
The file is used to provide all kinds of sorting method
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
|
||||
public class Sort {
|
||||
|
||||
/**
|
||||
Sort all elements in the vector as the specific sort type
|
||||
|
||||
@param v The vector need to be sorted
|
||||
@param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
|
||||
|
||||
**/
|
||||
public static void sortVectorString(Vector<String> v, int mode) {
|
||||
if (v != null) {
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
String temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all elements of vector and return sorted sequence
|
||||
|
||||
@param v The vector need to be sorted
|
||||
@param mode Sort type DataType.Sort_Type_Ascendin and DataType.Sort_Type_Descending
|
||||
@return Vector<Integer> The sorted sequence
|
||||
|
||||
**/
|
||||
public static Vector<Integer> getVectorSortSequence(Vector<String> v, int mode) {
|
||||
Vector<Integer> vSequence = new Vector<Integer>();
|
||||
//
|
||||
// Init sequence
|
||||
//
|
||||
if (v != null) {
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
vSequence.addElement(index);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// sort and get new sequence
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).compareTo(v.get(indexI)) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).compareTo(v.get(indexJ)) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
//
|
||||
// Swap strings
|
||||
//
|
||||
String tempStr = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(tempStr, indexJ);
|
||||
|
||||
//
|
||||
// Swap sequences
|
||||
//
|
||||
int tempInt = vSequence.get(indexI);
|
||||
vSequence.setElementAt(vSequence.get(indexJ), indexI);
|
||||
vSequence.setElementAt(tempInt, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vSequence;
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all elements of vector as input sequence
|
||||
|
||||
@param v The vector need to be sorted
|
||||
@param vSequence The sort sequence should be followed
|
||||
|
||||
**/
|
||||
public static void sortVectorString(Vector<String> v, Vector<Integer> vSequence) {
|
||||
if (v != null && vSequence != null && v.size() == vSequence.size()) {
|
||||
Vector<String> tempV = new Vector<String>();
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
tempV.addElement(v.get(index));
|
||||
}
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
v.setElementAt(tempV.get(vSequence.get(index)), index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all modules
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortModules(Vector<ModuleIdentification> v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
ModuleIdentification temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all packages
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortPackages(Vector<PackageIdentification> v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
PackageIdentification temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all platforms
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortPlatforms(Vector<PlatformIdentification> v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).getName().compareTo(v.get(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).getName().compareTo(v.get(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
PlatformIdentification temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all pcd entries
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortPcds(PcdVector v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.getPcd(indexJ).getName().compareTo(v.getPcd(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.getPcd(indexI).getName().compareTo(v.getPcd(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
PcdIdentification temp = v.getPcd(indexI);
|
||||
v.setPcd(v.getPcd(indexJ), indexI);
|
||||
v.setPcd(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all ppi entries
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortPpis(PpisVector v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.getPpis(indexJ).getName().compareTo(v.getPpis(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.getPpis(indexI).getName().compareTo(v.getPpis(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
PpisIdentification temp = v.getPpis(indexI);
|
||||
v.setPpis(v.getPpis(indexJ), indexI);
|
||||
v.setPpis(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all protocol entries
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortProtocols(ProtocolsVector v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.getProtocols(indexJ).getName().compareTo(v.getProtocols(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.getProtocols(indexI).getName().compareTo(v.getProtocols(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
ProtocolsIdentification temp = v.getProtocols(indexI);
|
||||
v.setProtocols(v.getProtocols(indexJ), indexI);
|
||||
v.setProtocols(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all guid entries
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortGuids(GuidsVector v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.getGuids(indexJ).getName().compareTo(v.getGuids(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.getGuids(indexI).getName().compareTo(v.getGuids(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
GuidsIdentification temp = v.getGuids(indexI);
|
||||
v.setGuids(v.getGuids(indexJ), indexI);
|
||||
v.setGuids(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all pcd coded entries
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortPcdCodeds(PcdCodedVector v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.getPcdCoded(indexJ).getName().compareTo(v.getPcdCoded(indexI).getName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.getPcdCoded(indexI).getName().compareTo(v.getPcdCoded(indexJ).getName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
PcdCodedIdentification temp = v.getPcdCoded(indexI);
|
||||
v.setPcdCoded(v.getPcdCoded(indexJ), indexI);
|
||||
v.setPcdCoded(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all pcd coded entries
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortLibraryClass(LibraryClassVector v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.getLibraryClass(indexJ).getLibraryClassName().compareTo(
|
||||
v.getLibraryClass(indexI)
|
||||
.getLibraryClassName()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.getLibraryClass(indexI).getLibraryClassName().compareTo(
|
||||
v.getLibraryClass(indexJ)
|
||||
.getLibraryClassName()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
LibraryClassIdentification temp = v.getLibraryClass(indexI);
|
||||
v.setLibraryClass(v.getLibraryClass(indexJ), indexI);
|
||||
v.setLibraryClass(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Sort all objects of a vector based on the object's "toString"
|
||||
|
||||
@param v
|
||||
@param mode
|
||||
|
||||
**/
|
||||
public static void sortObjectVector(Vector<Object> v, int mode) {
|
||||
if (v != null) {
|
||||
//
|
||||
// sort by name
|
||||
//
|
||||
for (int indexI = 0; indexI < v.size(); indexI++) {
|
||||
for (int indexJ = indexI + 1; indexJ < v.size(); indexJ++) {
|
||||
if ((v.get(indexJ).toString().compareTo(v.get(indexI).toString()) < 0 && mode == DataType.SORT_TYPE_ASCENDING)
|
||||
|| (v.get(indexI).toString().compareTo(v.get(indexJ).toString()) < 0 && mode == DataType.SORT_TYPE_DESCENDING)) {
|
||||
Object temp = v.get(indexI);
|
||||
v.setElementAt(v.get(indexJ), indexI);
|
||||
v.setElementAt(temp, indexJ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,656 @@
|
||||
/** @file
|
||||
|
||||
The file is used to provides some useful interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.MsaHeaderDocument.MsaHeader;
|
||||
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||
import org.tianocore.PlatformHeaderDocument.PlatformHeader;
|
||||
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
|
||||
import org.tianocore.SpdHeaderDocument.SpdHeader;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
import org.tianocore.frameworkwizard.platform.PlatformIdentification;
|
||||
|
||||
/**
|
||||
The class is used to provides some useful interfaces
|
||||
|
||||
**/
|
||||
public class Tools {
|
||||
|
||||
//
|
||||
// The dir user selected to create new package in
|
||||
//
|
||||
public static String dirForNewSpd = null;
|
||||
|
||||
/**
|
||||
Get current date and time and format it as "yyyy-MM-dd HH:mm"
|
||||
|
||||
@return formatted current date and time
|
||||
|
||||
**/
|
||||
public static String getCurrentDateTime() {
|
||||
Date now = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
return sdf.format(now);
|
||||
}
|
||||
|
||||
/**
|
||||
Generate a UUID
|
||||
|
||||
@return the created UUID
|
||||
|
||||
**/
|
||||
public static String generateUuidString() {
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
Use current file separator in the path
|
||||
|
||||
@param strPath
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String convertPathToCurrentOsType(String strPath) {
|
||||
strPath = strPath.replace(DataType.DOS_FILE_SEPARATOR, DataType.FILE_SEPARATOR);
|
||||
strPath = strPath.replace(DataType.UNIX_FILE_SEPARATOR, DataType.FILE_SEPARATOR);
|
||||
return strPath;
|
||||
}
|
||||
|
||||
/**
|
||||
Use Unix file separator in the path
|
||||
|
||||
@param strPath
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String convertPathToUnixType(String strPath) {
|
||||
strPath = strPath.replace(DataType.DOS_FILE_SEPARATOR, DataType.UNIX_FILE_SEPARATOR);
|
||||
return strPath;
|
||||
}
|
||||
|
||||
/**
|
||||
Use Dos file separator in the path
|
||||
|
||||
@param strPath
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String convertPathToDosType(String strPath) {
|
||||
strPath = strPath.replace(DataType.UNIX_FILE_SEPARATOR, DataType.DOS_FILE_SEPARATOR);
|
||||
return strPath;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all system properties and output to the console
|
||||
|
||||
**/
|
||||
public static void getSystemProperties() {
|
||||
System.out.println(System.getProperty("java.class.version"));
|
||||
System.out.println(System.getProperty("java.class.path"));
|
||||
System.out.println(System.getProperty("java.ext.dirs"));
|
||||
System.out.println(System.getProperty("os.name"));
|
||||
System.out.println(System.getProperty("os.arch"));
|
||||
System.out.println(System.getProperty("os.version"));
|
||||
System.out.println(System.getProperty("file.separator"));
|
||||
System.out.println(System.getProperty("path.separator"));
|
||||
System.out.println(System.getProperty("line.separator"));
|
||||
System.out.println(System.getProperty("user.name"));
|
||||
System.out.println(System.getProperty("user.home"));
|
||||
System.out.println(System.getProperty("user.dir"));
|
||||
System.out.println(System.getProperty("PATH"));
|
||||
|
||||
System.out.println(System.getenv("PROCESSOR_REVISION"));
|
||||
}
|
||||
|
||||
/**
|
||||
Generate selection items for JComboBox by input vector
|
||||
|
||||
**/
|
||||
public static void generateComboBoxByVector(JComboBox jcb, Vector<String> vector) {
|
||||
if (jcb != null) {
|
||||
jcb.removeAllItems();
|
||||
}
|
||||
if (vector != null) {
|
||||
for (int index = 0; index < vector.size(); index++) {
|
||||
jcb.addItem(vector.elementAt(index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Generate selection items for JList by input vector
|
||||
|
||||
**/
|
||||
public static void generateListByVector(JList jl, Vector<String> vector) {
|
||||
if (jl != null) {
|
||||
DefaultListModel listModel = (DefaultListModel) jl.getModel();
|
||||
listModel.removeAllElements();
|
||||
|
||||
if (vector != null) {
|
||||
for (int index = 0; index < vector.size(); index++) {
|
||||
listModel.addElement(vector.get(index));
|
||||
}
|
||||
}
|
||||
|
||||
if (listModel.size() > 0) {
|
||||
jl.setSelectedIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get path only from a path
|
||||
|
||||
@param filePath
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String getFilePathOnly(String filePath) {
|
||||
String path = filePath.substring(0, filePath.length() - getFileNameOnly(filePath).length());
|
||||
if (path.endsWith(DataType.FILE_SEPARATOR)) {
|
||||
path = path.substring(0, path.length() - DataType.FILE_SEPARATOR.length());
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
Get file name from a path
|
||||
|
||||
@param filePath
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String getFileNameOnly(String filePath) {
|
||||
File f = new File(filePath);
|
||||
return f.getAbsoluteFile().getName();
|
||||
}
|
||||
|
||||
public static String getFileNameWithoutExt(String filePath) {
|
||||
filePath = getFileNameOnly(filePath);
|
||||
filePath = filePath.substring(0, filePath.lastIndexOf(DataType.FILE_EXT_SEPARATOR));
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
Get relative path
|
||||
|
||||
@param wholePath
|
||||
@param commonPath
|
||||
@return wholePath - commonPath
|
||||
|
||||
**/
|
||||
public static String getRelativePath(String wholePath, String commonPath) {
|
||||
String path = "";
|
||||
int i = 0;
|
||||
i = wholePath.indexOf(commonPath);
|
||||
if (i > -1) {
|
||||
i = i + commonPath.length();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
path = wholePath.substring(i);
|
||||
//
|
||||
// remove file separator of head
|
||||
//
|
||||
if (path.indexOf(DataType.DOS_FILE_SEPARATOR) == 0) {
|
||||
path = path.substring(0 + DataType.DOS_FILE_SEPARATOR.length());
|
||||
}
|
||||
if (path.indexOf(DataType.UNIX_FILE_SEPARATOR) == 0) {
|
||||
path = path.substring(0 + DataType.DOS_FILE_SEPARATOR.length());
|
||||
}
|
||||
//
|
||||
// remove file separator of rear
|
||||
//
|
||||
if (path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
|
||||
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
|
||||
}
|
||||
if (path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
|
||||
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
|
||||
}
|
||||
//
|
||||
// convert to UNIX format
|
||||
//
|
||||
path = Tools.convertPathToUnixType(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert List ot Vector
|
||||
|
||||
@param list
|
||||
@return
|
||||
|
||||
**/
|
||||
public static Vector<String> convertListToVector(List list) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int index = 0; index < list.size(); index++) {
|
||||
v.addElement(list.get(index).toString());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/**
|
||||
If the input path missing ext, append the ext to the path
|
||||
|
||||
@param path
|
||||
@param type
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String addPathExt(String path, int type) {
|
||||
String match = "";
|
||||
if (type == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
|
||||
match = DataType.FILE_EXT_SEPARATOR + DataType.MODULE_SURFACE_AREA_EXT;
|
||||
}
|
||||
if (type == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
|
||||
match = DataType.FILE_EXT_SEPARATOR + DataType.PACKAGE_SURFACE_AREA_EXT;
|
||||
}
|
||||
if (type == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
|
||||
match = DataType.FILE_EXT_SEPARATOR + DataType.PLATFORM_SURFACE_AREA_EXT;
|
||||
}
|
||||
if (type == DataType.RETURN_TYPE_TEXT) {
|
||||
match = DataType.FILE_EXT_SEPARATOR + DataType.TEXT_FILE_EXT;
|
||||
}
|
||||
if (type == DataType.RETURN_TYPE_FAR_SURFACE_AREA) {
|
||||
match = DataType.FILE_EXT_SEPARATOR + DataType.FAR_SURFACE_AREA_EXT;
|
||||
}
|
||||
if (path.length() <= match.length()) {
|
||||
path = path + match;
|
||||
return path;
|
||||
}
|
||||
if (!(path.substring(path.length() - match.length())).equals(match)) {
|
||||
path = path + match;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
Show a message box
|
||||
|
||||
@param arg0
|
||||
|
||||
**/
|
||||
public static void showInformationMessage(String arg0) {
|
||||
JOptionPane.showConfirmDialog(null, arg0, "Info", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
if the string doesn't end with a file separator, append it to the string
|
||||
|
||||
@param arg0
|
||||
@return
|
||||
|
||||
**/
|
||||
public static String addFileSeparator(String arg0) {
|
||||
if (!arg0.endsWith(DataType.FILE_SEPARATOR)) {
|
||||
arg0 = arg0 + DataType.FILE_SEPARATOR;
|
||||
}
|
||||
return arg0;
|
||||
}
|
||||
|
||||
/**
|
||||
Wrap single line long input string to multiple short line string by word
|
||||
|
||||
@param arg0 input string
|
||||
@return wraped string
|
||||
|
||||
**/
|
||||
public static String wrapStringByWord(String arg0) {
|
||||
int intMaxLength = 40;
|
||||
String strReturn = "";
|
||||
String strTemp = "";
|
||||
boolean isCopied = true;
|
||||
|
||||
//
|
||||
// Convert string to array by " "
|
||||
//
|
||||
String s[] = arg0.split(" ");
|
||||
if (arg0.indexOf(" ") == -1) {
|
||||
s[0] = arg0;
|
||||
}
|
||||
|
||||
//
|
||||
// Add each string of array one by one
|
||||
//
|
||||
for (int index = 0; index < s.length; index++) {
|
||||
String ss = s[index];
|
||||
isCopied = false;
|
||||
//
|
||||
// The word length > defined line length
|
||||
//
|
||||
if (ss.length() > intMaxLength) {
|
||||
//
|
||||
// Finish previous line
|
||||
//
|
||||
if (!isCopied) {
|
||||
strReturn = strReturn + strTemp + DataType.LINE_SEPARATOR;
|
||||
strTemp = "";
|
||||
}
|
||||
//
|
||||
// Separater to short lines
|
||||
//
|
||||
while (ss.length() > 0) {
|
||||
if (ss.length() > intMaxLength) {
|
||||
strReturn = strReturn + s[index].substring(0, intMaxLength - 1) + DataType.UNIX_LINE_SEPARATOR;
|
||||
ss = ss.substring(intMaxLength);
|
||||
isCopied = true;
|
||||
} else {
|
||||
strTemp = ss;
|
||||
ss = "";
|
||||
isCopied = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((strTemp + " " + ss).length() <= intMaxLength) {
|
||||
strTemp = strTemp + " " + ss;
|
||||
continue;
|
||||
} else {
|
||||
strReturn = strReturn + strTemp + DataType.LINE_SEPARATOR;
|
||||
if ((index == s.length - 1) && (!ss.equals(""))) {
|
||||
strReturn = strReturn + ss;
|
||||
} else {
|
||||
strTemp = ss + " ";
|
||||
}
|
||||
isCopied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCopied) {
|
||||
strReturn = strReturn + strTemp;
|
||||
}
|
||||
|
||||
return strReturn;
|
||||
}
|
||||
|
||||
public static String convertUnicodeHexStringToString(String str) {
|
||||
//
|
||||
// Handle if str is null or empty
|
||||
//
|
||||
if (str == null) {
|
||||
return "";
|
||||
}
|
||||
if (str.equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String returnString = "";
|
||||
String[] strArray = str.split(" ");
|
||||
for (int index = 0; index < strArray.length; index++) {
|
||||
String s = strArray[index];
|
||||
if (s.length() == 6 && s.indexOf(DataType.HEX_STRING_HEADER) == 0) {
|
||||
s = s.substring(DataType.HEX_STRING_HEADER.length());
|
||||
} else {
|
||||
Log.err("convertUnicodeHexStringToString", "Incorrect input string: " + str);
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// Change hex to dec
|
||||
//
|
||||
int dec = Integer.parseInt(s, 16);
|
||||
|
||||
returnString = returnString + (char) (dec);
|
||||
}
|
||||
return returnString;
|
||||
}
|
||||
|
||||
/**
|
||||
Convert input string to unicode hex string
|
||||
|
||||
@param str input string
|
||||
@return unicode hex string
|
||||
|
||||
**/
|
||||
public static String convertStringToUnicodeHexString(String str) {
|
||||
//
|
||||
// Handle if str is null or empty
|
||||
//
|
||||
if (str == null) {
|
||||
return "";
|
||||
}
|
||||
if (str.equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
//
|
||||
// convert string to hex string
|
||||
//
|
||||
String hexString = "";
|
||||
for (int index = 0; index < str.length(); index++) {
|
||||
int codePoint = str.codePointAt(index);
|
||||
String s = Integer.toHexString(codePoint);
|
||||
//
|
||||
// Make the string to four length
|
||||
//
|
||||
if (s.length() == 3) {
|
||||
s = "0" + s;
|
||||
} else if (s.length() == 2) {
|
||||
s = "00" + s;
|
||||
} else if (s.length() == 1) {
|
||||
s = "000" + s;
|
||||
}
|
||||
|
||||
//
|
||||
// Add the string to return hex string
|
||||
//
|
||||
hexString = hexString + DataType.HEX_STRING_HEADER + s + " ";
|
||||
}
|
||||
|
||||
//
|
||||
// return hex string
|
||||
//
|
||||
return hexString.trim();
|
||||
}
|
||||
|
||||
public static ModuleIdentification getId(String path, ModuleSurfaceArea msa) {
|
||||
MsaHeader head = msa.getMsaHeader();
|
||||
String name = head.getModuleName();
|
||||
String guid = head.getGuidValue();
|
||||
String version = head.getVersion();
|
||||
ModuleIdentification id = new ModuleIdentification(name, guid, version, path);
|
||||
return id;
|
||||
}
|
||||
|
||||
public static PackageIdentification getId(String path, PackageSurfaceArea spd) {
|
||||
SpdHeader head = spd.getSpdHeader();
|
||||
String name = head.getPackageName();
|
||||
String guid = head.getGuidValue();
|
||||
String version = head.getVersion();
|
||||
PackageIdentification id = new PackageIdentification(name, guid, version, path);
|
||||
return id;
|
||||
}
|
||||
|
||||
public static PlatformIdentification getId(String path, PlatformSurfaceArea fpd) {
|
||||
PlatformHeader head = fpd.getPlatformHeader();
|
||||
String name = head.getPlatformName();
|
||||
String guid = head.getGuidValue();
|
||||
String version = head.getVersion();
|
||||
PlatformIdentification id = new PlatformIdentification(name, guid, version, path);
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* To reset the width of input component via container width
|
||||
*
|
||||
* @param c
|
||||
* @param containerWidth
|
||||
*
|
||||
*/
|
||||
public static void resizeComponentWidth(Component c, int containerWidth, int preferredWidth) {
|
||||
int newWidth = c.getPreferredSize().width + (containerWidth - preferredWidth);
|
||||
if (newWidth < c.getPreferredSize().width) {
|
||||
newWidth = c.getPreferredSize().width;
|
||||
}
|
||||
c.setSize(new java.awt.Dimension(newWidth, c.getHeight()));
|
||||
c.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* To reset the height of input component via container height
|
||||
*
|
||||
* @param c
|
||||
* @param containerHeight
|
||||
*
|
||||
*/
|
||||
public static void resizeComponentHeight(Component c, int containerHeight, int preferredHeight) {
|
||||
int newHeight = c.getPreferredSize().height + (containerHeight - preferredHeight);
|
||||
if (newHeight < c.getPreferredSize().height) {
|
||||
newHeight = c.getPreferredSize().height;
|
||||
}
|
||||
c.setSize(new java.awt.Dimension(c.getWidth(), newHeight));
|
||||
c.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* To reset the size of input component via container size
|
||||
*
|
||||
* @param c
|
||||
* @param containerWidth
|
||||
* @param containerHeight
|
||||
*
|
||||
*/
|
||||
public static void resizeComponent(Component c, int containerWidth, int containerHeight, int preferredWidth,
|
||||
int preferredHeight) {
|
||||
resizeComponentWidth(c, containerWidth, preferredWidth);
|
||||
resizeComponentHeight(c, containerHeight, preferredHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* To relocate the input component
|
||||
*
|
||||
* @param c
|
||||
* @param containerWidth
|
||||
* @param spaceToRight
|
||||
*
|
||||
*/
|
||||
public static void relocateComponentX(Component c, int containerWidth, int preferredWidth, int spaceToRight) {
|
||||
int intGapToRight = spaceToRight + c.getPreferredSize().width;
|
||||
int newLocationX = containerWidth - intGapToRight;
|
||||
if (newLocationX < preferredWidth - intGapToRight) {
|
||||
newLocationX = preferredWidth - intGapToRight;
|
||||
}
|
||||
c.setLocation(newLocationX, c.getLocation().y);
|
||||
c.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* To relocate the input component
|
||||
*
|
||||
* @param c
|
||||
* @param containerHeight
|
||||
* @param spaceToBottom
|
||||
*
|
||||
*/
|
||||
public static void relocateComponentY(Component c, int containerHeight, int preferredHeight, int spaceToBottom) {
|
||||
int intGapToBottom = spaceToBottom + c.getPreferredSize().height;
|
||||
int newLocationY = containerHeight - intGapToBottom;
|
||||
if (newLocationY < preferredHeight - spaceToBottom) {
|
||||
newLocationY = preferredHeight - spaceToBottom;
|
||||
}
|
||||
c.setLocation(c.getLocation().x, newLocationY);
|
||||
c.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
* To relocate the input component
|
||||
*
|
||||
* @param c
|
||||
* @param containerWidth
|
||||
* @param containerHeight
|
||||
* @param spaceToBottom
|
||||
* @param spaceToRight
|
||||
*
|
||||
*/
|
||||
public static void relocateComponent(Component c, int containerWidth, int containerHeight, int preferredWidht,
|
||||
int preferredHeight, int spaceToRight, int spaceToBottom) {
|
||||
relocateComponentX(c, containerWidth, preferredWidht, spaceToRight);
|
||||
relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);
|
||||
}
|
||||
|
||||
/**
|
||||
Move the component to the center of screen
|
||||
|
||||
@param c
|
||||
@param width
|
||||
|
||||
**/
|
||||
public static void centerComponent(Component c, int width) {
|
||||
c.setLocation(width / 2 - c.getWidth() / 2, c.getLocation().y);
|
||||
c.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
Move the component to the center of screen and adjust the y location
|
||||
|
||||
@param c
|
||||
@param width
|
||||
|
||||
**/
|
||||
public static void centerComponent(Component c, int width, int containerHeight, int preferredHeight,
|
||||
int spaceToBottom) {
|
||||
relocateComponentY(c, containerHeight, preferredHeight, spaceToBottom);
|
||||
centerComponent(c, width);
|
||||
}
|
||||
|
||||
/**
|
||||
Find the count of searchString in wholeString
|
||||
|
||||
@param wholeString
|
||||
@param searchString
|
||||
@return
|
||||
|
||||
**/
|
||||
public static int getSpecificStringCount(String wholeString, String searchString) {
|
||||
int count = 0;
|
||||
count = wholeString.split(searchString).length;
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 static boolean isEmpty(String strValue) {
|
||||
if (strValue.length() > 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/** @file
|
||||
|
||||
The file is used to config XML file format
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common;
|
||||
|
||||
import org.apache.xmlbeans.XmlCursor;
|
||||
import org.apache.xmlbeans.XmlOptions;
|
||||
|
||||
public class XmlConfig {
|
||||
public static XmlCursor setupXmlCursor(XmlCursor cursor) {
|
||||
String uri = "http://www.TianoCore.org/2006/Edk2.0";
|
||||
cursor.push();
|
||||
cursor.toNextToken();
|
||||
cursor.insertNamespace("", uri);
|
||||
cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
|
||||
cursor.pop();
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public static XmlOptions setupXmlOptions() {
|
||||
XmlOptions options = new XmlOptions();
|
||||
options.setCharacterEncoding("UTF-8");
|
||||
options.setSavePrettyPrint();
|
||||
options.setSavePrettyPrintIndent(2);
|
||||
return options;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,877 @@
|
||||
/** @file
|
||||
|
||||
The file is used to provide Find funtions in workspace
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.find;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
|
||||
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
|
||||
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.GlobalData;
|
||||
import org.tianocore.frameworkwizard.common.Sort;
|
||||
import org.tianocore.frameworkwizard.common.Tools;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Guids.GuidsVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdCodedVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Ppis.PpisVector;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsIdentification;
|
||||
import org.tianocore.frameworkwizard.module.Identifications.Protocols.ProtocolsVector;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
public class Find {
|
||||
|
||||
private final static String SEPERATOR = ".";
|
||||
|
||||
/**
|
||||
Get all ppi entries from workspace
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static PpisVector getAllPpisVector() {
|
||||
PpisVector pv = new PpisVector();
|
||||
ModuleSurfaceArea msa = null;
|
||||
ModuleIdentification mid = null;
|
||||
PpisIdentification pid = null;
|
||||
|
||||
//
|
||||
// Go through each module one by one
|
||||
//
|
||||
if (GlobalData.openingModuleList.size() > 0) {
|
||||
for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
|
||||
msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
|
||||
mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
|
||||
|
||||
if (msa.getPPIs() != null) {
|
||||
if (msa.getPPIs().getPpiList().size() > 0) {
|
||||
for (int index = 0; index < msa.getPPIs().getPpiList().size(); index++) {
|
||||
String arg0 = msa.getPPIs().getPpiList().get(index).getPpiCName();
|
||||
String arg1 = DataType.PPI_TYPE_PPI;
|
||||
String arg2 = null;
|
||||
if (msa.getPPIs().getPpiList().get(index).getUsage() != null) {
|
||||
arg2 = msa.getPPIs().getPpiList().get(index).getUsage().toString();
|
||||
}
|
||||
|
||||
String arg3 = msa.getPPIs().getPpiList().get(index).getFeatureFlag();
|
||||
Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiList().get(index)
|
||||
.getSupArchList());
|
||||
String arg5 = msa.getPPIs().getPpiList().get(index).getHelpText();
|
||||
|
||||
pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
pid.setBelongModule(mid);
|
||||
|
||||
//
|
||||
// Find which package declares it
|
||||
//
|
||||
for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
|
||||
PackageSurfaceArea spd = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getXmlSpd();
|
||||
PackageIdentification packageId = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getId();
|
||||
if (spd.getPpiDeclarations() != null) {
|
||||
for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()
|
||||
.size(); indexOfPpis++) {
|
||||
if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()
|
||||
.equals(arg0)) {
|
||||
pid.setDeclaredBy(packageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pid.getDeclaredBy() == null) {
|
||||
pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
|
||||
}
|
||||
|
||||
pv.addPpis(pid);
|
||||
}
|
||||
}
|
||||
if (msa.getPPIs().getPpiNotifyList().size() > 0) {
|
||||
for (int index = 0; index < msa.getPPIs().getPpiNotifyList().size(); index++) {
|
||||
String arg0 = msa.getPPIs().getPpiNotifyList().get(index).getPpiNotifyCName();
|
||||
String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;
|
||||
String arg2 = null;
|
||||
if (msa.getPPIs().getPpiNotifyList().get(index).getUsage() != null) {
|
||||
arg2 = msa.getPPIs().getPpiNotifyList().get(index).getUsage().toString();
|
||||
}
|
||||
|
||||
String arg3 = msa.getPPIs().getPpiNotifyList().get(index).getFeatureFlag();
|
||||
Vector<String> arg4 = Tools.convertListToVector(msa.getPPIs().getPpiNotifyList().get(index)
|
||||
.getSupArchList());
|
||||
String arg5 = msa.getPPIs().getPpiNotifyList().get(index).getHelpText();
|
||||
|
||||
pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
pid.setBelongModule(mid);
|
||||
|
||||
//
|
||||
// Find which package declares it
|
||||
//
|
||||
for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
|
||||
PackageSurfaceArea spd = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getXmlSpd();
|
||||
PackageIdentification packageId = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getId();
|
||||
if (spd.getPpiDeclarations() != null) {
|
||||
for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList()
|
||||
.size(); indexOfPpis++) {
|
||||
if (spd.getPpiDeclarations().getEntryList().get(indexOfPpis).getCName()
|
||||
.equals(arg0)) {
|
||||
pid.setDeclaredBy(packageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pid.getDeclaredBy() == null) {
|
||||
pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
|
||||
}
|
||||
|
||||
pv.addPpis(pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sort.sortPpis(pv, DataType.SORT_TYPE_ASCENDING);
|
||||
return pv;
|
||||
}
|
||||
|
||||
/**
|
||||
Re-org all ppi entries for find table
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static Vector<PpiId> getAllPpisForFind() {
|
||||
Vector<PpiId> ppi = new Vector<PpiId>();
|
||||
PpisVector pv = Find.getAllPpisVector();
|
||||
boolean isAdded = false;
|
||||
boolean isProduced = false;
|
||||
|
||||
//
|
||||
// Go through pv to add item as new format to ppi one by one
|
||||
//
|
||||
for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
|
||||
isAdded = false;
|
||||
PpisIdentification pvId = pv.getPpis(indexOfPv);
|
||||
|
||||
//
|
||||
// First check if produced or not
|
||||
//
|
||||
if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
||||
|| pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
||||
isProduced = true;
|
||||
} else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
|
||||
|| pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
||||
isProduced = false;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the sting "PackageName.ModuleName"
|
||||
//
|
||||
String tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
|
||||
|
||||
//
|
||||
// Check if the item has been added in
|
||||
// If added, append package name and new module name
|
||||
// If not added, add a new one first
|
||||
//
|
||||
for (int indexOfPpi = 0; indexOfPpi < ppi.size(); indexOfPpi++) {
|
||||
PpiId ppiId = ppi.get(indexOfPpi);
|
||||
|
||||
if (pvId.getName().equals(ppiId.getName())) {
|
||||
if (isProduced) {
|
||||
ppi.get(indexOfPpi).setProducedModules(ppiId.getProducedModules() + "<br>" + tmp);
|
||||
} else if (!isProduced) {
|
||||
ppi.get(indexOfPpi).setConsumedModules(ppiId.getConsumedModules() + "<br>" + tmp);
|
||||
}
|
||||
isAdded = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add a new one
|
||||
//
|
||||
if (!isAdded) {
|
||||
if (isProduced) {
|
||||
ppi
|
||||
.addElement(new PpiId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy().getName()));
|
||||
} else if (!isProduced) {
|
||||
ppi
|
||||
.addElement(new PpiId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy().getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ppi;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all protocol entries from workspace
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static ProtocolsVector getAllProtocolsVector() {
|
||||
ProtocolsVector pv = new ProtocolsVector();
|
||||
ModuleSurfaceArea msa = null;
|
||||
ModuleIdentification mid = null;
|
||||
ProtocolsIdentification pid = null;
|
||||
|
||||
//
|
||||
// Go through each module one by one
|
||||
//
|
||||
if (GlobalData.openingModuleList.size() > 0) {
|
||||
for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
|
||||
msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
|
||||
mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
|
||||
|
||||
if (msa.getProtocols() != null) {
|
||||
if (msa.getProtocols().getProtocolList().size() > 0) {
|
||||
for (int index = 0; index < msa.getProtocols().getProtocolList().size(); index++) {
|
||||
String arg0 = msa.getProtocols().getProtocolList().get(index).getProtocolCName();
|
||||
String arg1 = DataType.PROTOCOL_TYPE_PROTOCOL;
|
||||
String arg2 = null;
|
||||
if (msa.getProtocols().getProtocolList().get(index).getUsage() != null) {
|
||||
arg2 = msa.getProtocols().getProtocolList().get(index).getUsage().toString();
|
||||
}
|
||||
|
||||
String arg3 = msa.getProtocols().getProtocolList().get(index).getFeatureFlag();
|
||||
Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolList()
|
||||
.get(index).getSupArchList());
|
||||
String arg5 = msa.getProtocols().getProtocolList().get(index).getHelpText();
|
||||
|
||||
pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
pid.setBelongModule(mid);
|
||||
|
||||
//
|
||||
// Find which package declares it
|
||||
//
|
||||
for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
|
||||
PackageSurfaceArea spd = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getXmlSpd();
|
||||
PackageIdentification packageId = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getId();
|
||||
if (spd.getProtocolDeclarations() != null) {
|
||||
for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()
|
||||
.getEntryList().size(); indexOfProtocols++) {
|
||||
if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)
|
||||
.getCName().equals(arg0)) {
|
||||
pid.setDeclaredBy(packageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pid.getDeclaredBy() == null) {
|
||||
pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
|
||||
}
|
||||
pv.addProtocols(pid);
|
||||
}
|
||||
}
|
||||
if (msa.getProtocols().getProtocolNotifyList().size() > 0) {
|
||||
for (int index = 0; index < msa.getProtocols().getProtocolNotifyList().size(); index++) {
|
||||
String arg0 = msa.getProtocols().getProtocolNotifyList().get(index)
|
||||
.getProtocolNotifyCName();
|
||||
String arg1 = DataType.PPI_TYPE_PPI_NOTIFY;
|
||||
String arg2 = null;
|
||||
if (msa.getProtocols().getProtocolNotifyList().get(index).getUsage() != null) {
|
||||
arg2 = msa.getProtocols().getProtocolNotifyList().get(index).getUsage().toString();
|
||||
}
|
||||
|
||||
String arg3 = msa.getProtocols().getProtocolNotifyList().get(index).getFeatureFlag();
|
||||
Vector<String> arg4 = Tools.convertListToVector(msa.getProtocols().getProtocolNotifyList()
|
||||
.get(index).getSupArchList());
|
||||
String arg5 = msa.getProtocols().getProtocolNotifyList().get(index).getHelpText();
|
||||
|
||||
pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
pid.setBelongModule(mid);
|
||||
|
||||
//
|
||||
// Find which package declares it
|
||||
//
|
||||
for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
|
||||
PackageSurfaceArea spd = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getXmlSpd();
|
||||
PackageIdentification packageId = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getId();
|
||||
if (spd.getProtocolDeclarations() != null) {
|
||||
for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations()
|
||||
.getEntryList().size(); indexOfProtocols++) {
|
||||
if (spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols)
|
||||
.getCName().equals(arg0)) {
|
||||
pid.setDeclaredBy(packageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pid.getDeclaredBy() == null) {
|
||||
pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
|
||||
}
|
||||
|
||||
pv.addProtocols(pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sort.sortProtocols(pv, DataType.SORT_TYPE_ASCENDING);
|
||||
return pv;
|
||||
}
|
||||
|
||||
/**
|
||||
Re-org all protocol entries for find table
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static Vector<ProtocolId> getAllProtocolsForFind() {
|
||||
Vector<ProtocolId> protocol = new Vector<ProtocolId>();
|
||||
ProtocolsVector pv = Find.getAllProtocolsVector();
|
||||
boolean isAdded = false;
|
||||
boolean isProduced = false;
|
||||
|
||||
//
|
||||
// Go through pv to add item as new format to ppi one by one
|
||||
//
|
||||
for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
|
||||
isAdded = false;
|
||||
ProtocolsIdentification pvId = pv.getProtocols(indexOfPv);
|
||||
|
||||
//
|
||||
// First check if produced or not
|
||||
//
|
||||
if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
||||
|| pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
||||
isProduced = true;
|
||||
} else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
|
||||
|| pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
||||
isProduced = false;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the sting "PackageName.ModuleName"
|
||||
//
|
||||
String tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
|
||||
|
||||
//
|
||||
// Check if the item has been added in
|
||||
// If added, append package name and new module name
|
||||
// If not added, add a new one first
|
||||
//
|
||||
for (int indexOfProtocol = 0; indexOfProtocol < protocol.size(); indexOfProtocol++) {
|
||||
ProtocolId protocolId = protocol.get(indexOfProtocol);
|
||||
|
||||
if (pvId.getName().equals(protocolId.getName())) {
|
||||
if (isProduced) {
|
||||
protocol.get(indexOfProtocol)
|
||||
.setProducedModules(protocolId.getProducedModules() + "<br>" + tmp);
|
||||
} else if (!isProduced) {
|
||||
protocol.get(indexOfProtocol)
|
||||
.setConsumedModules(protocolId.getConsumedModules() + "<br>" + tmp);
|
||||
}
|
||||
isAdded = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add a new one
|
||||
//
|
||||
if (!isAdded) {
|
||||
if (isProduced) {
|
||||
protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy()
|
||||
.getName()));
|
||||
} else if (!isProduced) {
|
||||
protocol.addElement(new ProtocolId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy()
|
||||
.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return protocol;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all protocol entries from workspace
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static GuidsVector getAllGuidsVector() {
|
||||
GuidsVector gv = new GuidsVector();
|
||||
ModuleSurfaceArea msa = null;
|
||||
ModuleIdentification mid = null;
|
||||
GuidsIdentification gid = null;
|
||||
|
||||
//
|
||||
// Go through each module one by one
|
||||
//
|
||||
if (GlobalData.openingModuleList.size() > 0) {
|
||||
for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
|
||||
msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
|
||||
mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
|
||||
|
||||
if (msa.getGuids() != null) {
|
||||
if (msa.getGuids().getGuidCNamesList().size() > 0) {
|
||||
for (int index = 0; index < msa.getGuids().getGuidCNamesList().size(); index++) {
|
||||
String arg0 = msa.getGuids().getGuidCNamesList().get(index).getGuidCName();
|
||||
String arg1 = null;
|
||||
if (msa.getGuids().getGuidCNamesList().get(index).getUsage() != null) {
|
||||
arg1 = msa.getGuids().getGuidCNamesList().get(index).getUsage().toString();
|
||||
}
|
||||
|
||||
String arg2 = msa.getGuids().getGuidCNamesList().get(index).getFeatureFlag();
|
||||
Vector<String> arg3 = Tools.convertListToVector(msa.getGuids().getGuidCNamesList()
|
||||
.get(index).getSupArchList());
|
||||
String arg4 = msa.getGuids().getGuidCNamesList().get(index).getHelpText();
|
||||
|
||||
gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);
|
||||
gid.setBelongModule(mid);
|
||||
|
||||
//
|
||||
// Find which package declares it
|
||||
//
|
||||
for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
|
||||
PackageSurfaceArea spd = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getXmlSpd();
|
||||
PackageIdentification packageId = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getId();
|
||||
if (spd.getGuidDeclarations() != null) {
|
||||
for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList()
|
||||
.size(); indexOfGuids++) {
|
||||
if (spd.getGuidDeclarations().getEntryList().get(indexOfGuids).getCName()
|
||||
.equals(arg0)) {
|
||||
gid.setDeclaredBy(packageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gid.getDeclaredBy() == null) {
|
||||
gid.setDeclaredBy(new PackageIdentification("", "", "", ""));
|
||||
}
|
||||
|
||||
gv.addGuids(gid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sort.sortGuids(gv, DataType.SORT_TYPE_ASCENDING);
|
||||
return gv;
|
||||
}
|
||||
|
||||
/**
|
||||
Re-org all guid entries for find table
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static Vector<GuidId> getAllGuidsForFind() {
|
||||
Vector<GuidId> guid = new Vector<GuidId>();
|
||||
GuidsVector gv = Find.getAllGuidsVector();
|
||||
boolean isAdded = false;
|
||||
boolean isProduced = false;
|
||||
|
||||
//
|
||||
// Go through pv to add item as new format to ppi one by one
|
||||
//
|
||||
for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {
|
||||
isAdded = false;
|
||||
GuidsIdentification gvId = gv.getGuids(indexOfGv);
|
||||
|
||||
//
|
||||
// First check if produced or not
|
||||
//
|
||||
if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
||||
|| gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
||||
isProduced = true;
|
||||
} else if (gvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
|
||||
|| gvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
||||
isProduced = false;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the sting "PackageName.ModuleName"
|
||||
//
|
||||
String tmp = gvId.getBelongModule().getPackageId().getName() + SEPERATOR + gvId.getBelongModule().getName();
|
||||
|
||||
//
|
||||
// Check if the item has been added in
|
||||
// If added, append package name and new module name
|
||||
// If not added, add a new one first
|
||||
//
|
||||
for (int indexOfGuid = 0; indexOfGuid < guid.size(); indexOfGuid++) {
|
||||
GuidId guidId = guid.get(indexOfGuid);
|
||||
|
||||
if (gvId.getName().equals(guidId.getName())) {
|
||||
if (isProduced) {
|
||||
guid.get(indexOfGuid).setProducedModules(guidId.getProducedModules() + "<br>" + tmp);
|
||||
} else if (!isProduced) {
|
||||
guid.get(indexOfGuid).setConsumedModules(guidId.getConsumedModules() + "<br>" + tmp);
|
||||
}
|
||||
isAdded = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add a new one
|
||||
//
|
||||
if (!isAdded) {
|
||||
if (isProduced) {
|
||||
guid.addElement(new GuidId(gvId.getName(), "GUID", tmp, null, gvId.getDeclaredBy().getName()));
|
||||
} else if (!isProduced) {
|
||||
guid.addElement(new GuidId(gvId.getName(), "GUID", null, tmp, gvId.getDeclaredBy().getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return guid;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all pcd coded entries from workspace
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static PcdCodedVector getAllPcdCodedVector() {
|
||||
PcdCodedVector pv = new PcdCodedVector();
|
||||
ModuleSurfaceArea msa = null;
|
||||
ModuleIdentification mid = null;
|
||||
PcdCodedIdentification pid = null;
|
||||
|
||||
//
|
||||
// Go through each module one by one
|
||||
//
|
||||
if (GlobalData.openingModuleList.size() > 0) {
|
||||
for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
|
||||
msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
|
||||
mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
|
||||
|
||||
if (msa.getPcdCoded() != null) {
|
||||
if (msa.getPcdCoded().getPcdEntryList().size() > 0) {
|
||||
for (int index = 0; index < msa.getPcdCoded().getPcdEntryList().size(); index++) {
|
||||
|
||||
String arg0 = msa.getPcdCoded().getPcdEntryList().get(index).getCName();
|
||||
String arg1 = msa.getPcdCoded().getPcdEntryList().get(index).getTokenSpaceGuidCName();
|
||||
|
||||
String arg2 = msa.getPcdCoded().getPcdEntryList().get(index).getFeatureFlag();
|
||||
Vector<String> arg3 = Tools.convertListToVector(msa.getPcdCoded().getPcdEntryList()
|
||||
.get(index).getSupArchList());
|
||||
|
||||
String arg4 = msa.getPcdCoded().getPcdEntryList().get(index).getDefaultValue();
|
||||
String arg5 = msa.getPcdCoded().getPcdEntryList().get(index).getHelpText();
|
||||
String arg6 = null;
|
||||
if (msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType() != null) {
|
||||
arg6 = msa.getPcdCoded().getPcdEntryList().get(index).getPcdItemType().toString();
|
||||
}
|
||||
String arg7 = null;
|
||||
if (msa.getPcdCoded().getPcdEntryList().get(index).getUsage() != null) {
|
||||
arg7 = msa.getPcdCoded().getPcdEntryList().get(index).getUsage().toString();
|
||||
}
|
||||
pid = new PcdCodedIdentification(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
||||
pid.setBelongModule(mid);
|
||||
|
||||
//
|
||||
// Find which package declares it
|
||||
//
|
||||
for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
|
||||
PackageSurfaceArea spd = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getXmlSpd();
|
||||
PackageIdentification packageId = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getId();
|
||||
if (spd.getPcdDeclarations() != null) {
|
||||
for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList()
|
||||
.size(); indexOfPcds++) {
|
||||
if (spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds).getCName()
|
||||
.equals(arg0)) {
|
||||
pid.setDeclaredBy(packageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pid.getDeclaredBy() == null) {
|
||||
pid.setDeclaredBy(new PackageIdentification("", "", "", ""));
|
||||
}
|
||||
|
||||
pv.addPcdCoded(pid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sort.sortPcdCodeds(pv, DataType.SORT_TYPE_ASCENDING);
|
||||
return pv;
|
||||
}
|
||||
|
||||
/**
|
||||
Re-org all guid entries for find table
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static Vector<PcdId> getAllPcdCodedForFind() {
|
||||
Vector<PcdId> pcd = new Vector<PcdId>();
|
||||
PcdCodedVector pv = Find.getAllPcdCodedVector();
|
||||
boolean isAdded = false;
|
||||
boolean isProduced = false;
|
||||
|
||||
//
|
||||
// Go through pv to add item as new format to ppi one by one
|
||||
//
|
||||
for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {
|
||||
isAdded = false;
|
||||
PcdCodedIdentification pvId = pv.getPcdCoded(indexOfPv);
|
||||
|
||||
//
|
||||
// First check if produced or not
|
||||
//
|
||||
if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
||||
|| pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
||||
isProduced = true;
|
||||
} else if (pvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
|
||||
|| pvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
||||
isProduced = false;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the sting "PackageName.ModuleName"
|
||||
//
|
||||
String tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();
|
||||
|
||||
//
|
||||
// Check if the item has been added in
|
||||
// If added, append package name and new module name
|
||||
// If not added, add a new one first
|
||||
//
|
||||
for (int indexOfGuid = 0; indexOfGuid < pcd.size(); indexOfGuid++) {
|
||||
PcdId pcdId = pcd.get(indexOfGuid);
|
||||
|
||||
if (pvId.getName().equals(pcdId.getName())) {
|
||||
if (isProduced) {
|
||||
pcd.get(indexOfGuid).setProducedModules(pcdId.getProducedModules() + "<br>" + tmp);
|
||||
} else if (!isProduced) {
|
||||
pcd.get(indexOfGuid).setConsumedModules(pcdId.getConsumedModules() + "<br>" + tmp);
|
||||
}
|
||||
isAdded = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add a new one
|
||||
//
|
||||
if (!isAdded) {
|
||||
if (isProduced) {
|
||||
pcd
|
||||
.addElement(new PcdId(pvId.getName(), pvId.getType(), tmp, null, pvId.getDeclaredBy().getName()));
|
||||
} else if (!isProduced) {
|
||||
pcd
|
||||
.addElement(new PcdId(pvId.getName(), pvId.getType(), null, tmp, pvId.getDeclaredBy().getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pcd;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all library class entries from workspace
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static LibraryClassVector getAllLibraryClassVector() {
|
||||
LibraryClassVector lcv = new LibraryClassVector();
|
||||
ModuleSurfaceArea msa = null;
|
||||
ModuleIdentification mid = null;
|
||||
LibraryClassIdentification lcid = null;
|
||||
|
||||
//
|
||||
// Go through each module one by one
|
||||
//
|
||||
if (GlobalData.openingModuleList.size() > 0) {
|
||||
for (int indexOfModule = 0; indexOfModule < GlobalData.openingModuleList.size(); indexOfModule++) {
|
||||
msa = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getXmlMsa();
|
||||
mid = GlobalData.openingModuleList.getOpeningModuleByIndex(indexOfModule).getId();
|
||||
|
||||
if (msa.getLibraryClassDefinitions() != null) {
|
||||
LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();
|
||||
if (lcd.getLibraryClassList().size() > 0) {
|
||||
for (int index = 0; index < lcd.getLibraryClassList().size(); index++) {
|
||||
String name = lcd.getLibraryClassList().get(index).getKeyword();
|
||||
String usage = null;
|
||||
if (lcd.getLibraryClassList().get(index).getUsage() != null) {
|
||||
usage = lcd.getLibraryClassList().get(index).getUsage().toString();
|
||||
}
|
||||
String version = lcd.getLibraryClassList().get(index).getRecommendedInstanceVersion();
|
||||
String guid = lcd.getLibraryClassList().get(index).getRecommendedInstanceGuid();
|
||||
String featureFlag = lcd.getLibraryClassList().get(index).getFeatureFlag();
|
||||
Vector<String> arch = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
|
||||
.getSupArchList());
|
||||
Vector<String> module = Tools.convertListToVector(lcd.getLibraryClassList().get(index)
|
||||
.getSupModuleList());
|
||||
String help = lcd.getLibraryClassList().get(index).getHelpText();
|
||||
lcid = new LibraryClassIdentification(name, usage, version, guid, arch, featureFlag,
|
||||
module, help);
|
||||
lcid.setBelongModule(mid);
|
||||
|
||||
//
|
||||
// Find which package declares it
|
||||
//
|
||||
for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {
|
||||
PackageSurfaceArea spd = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getXmlSpd();
|
||||
PackageIdentification packageId = GlobalData.openingPackageList
|
||||
.getOpeningPackageByIndex(
|
||||
indexOfPackage)
|
||||
.getId();
|
||||
if (spd.getLibraryClassDeclarations() != null) {
|
||||
for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd
|
||||
.getLibraryClassDeclarations()
|
||||
.getLibraryClassList()
|
||||
.size(); indexOfLibraryClass++) {
|
||||
if (spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass)
|
||||
.getName().equals(name)) {
|
||||
lcid.setDeclaredBy(packageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lcid.getDeclaredBy() == null) {
|
||||
lcid.setDeclaredBy(new PackageIdentification("", "", "", ""));
|
||||
}
|
||||
|
||||
lcv.addLibraryClass(lcid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sort.sortLibraryClass(lcv, DataType.SORT_TYPE_ASCENDING);
|
||||
return lcv;
|
||||
}
|
||||
|
||||
/**
|
||||
Re-org all guid entries for find table
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public static Vector<LibraryClassId> getAllLibraryClassForFind() {
|
||||
Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();
|
||||
LibraryClassVector lcv = Find.getAllLibraryClassVector();
|
||||
boolean isAdded = false;
|
||||
boolean isProduced = false;
|
||||
|
||||
//
|
||||
// Go through pv to add item as new format to ppi one by one
|
||||
//
|
||||
for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {
|
||||
isAdded = false;
|
||||
LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);
|
||||
|
||||
//
|
||||
// First check if produced or not
|
||||
//
|
||||
if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
||||
|| lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
||||
isProduced = true;
|
||||
} else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)
|
||||
|| lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
||||
isProduced = false;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the sting "PackageName.ModuleName"
|
||||
//
|
||||
String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR
|
||||
+ lcvId.getBelongModule().getName();
|
||||
|
||||
//
|
||||
// Check if the item has been added in
|
||||
// If added, append package name and new module name
|
||||
// If not added, add a new one first
|
||||
//
|
||||
for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {
|
||||
LibraryClassId lcId = libraryClass.get(indexOfGuid);
|
||||
|
||||
if (lcvId.getLibraryClassName().equals(lcId.getName())) {
|
||||
if (isProduced) {
|
||||
libraryClass.get(indexOfGuid).setProducedModules(lcId.getProducedModules() + "<br>" + tmp);
|
||||
} else if (!isProduced) {
|
||||
libraryClass.get(indexOfGuid).setConsumedModules(lcId.getConsumedModules() + "<br>" + tmp);
|
||||
}
|
||||
isAdded = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add a new one
|
||||
//
|
||||
if (!isAdded) {
|
||||
if (isProduced) {
|
||||
libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", tmp, null,
|
||||
lcvId.getDeclaredBy().getName()));
|
||||
} else if (!isProduced) {
|
||||
libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", null, tmp,
|
||||
lcvId.getDeclaredBy().getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return libraryClass;
|
||||
}
|
||||
}
|
@ -0,0 +1,478 @@
|
||||
/** @file
|
||||
|
||||
The file is used to show a table with all defined PPIs
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.find;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
import javax.swing.table.DefaultTableCellRenderer;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.IDefaultTableModel;
|
||||
import org.tianocore.frameworkwizard.common.Log;
|
||||
import org.tianocore.frameworkwizard.common.Tools;
|
||||
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||
|
||||
public class FindResult extends IFrame implements TableModelListener {
|
||||
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -2448484533878401714L;
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private JTable jTable = null;
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JScrollPane jScrollPane = null;
|
||||
|
||||
private JScrollPane jScrollPaneTable = null;
|
||||
|
||||
private JButton jButtonClose = null;
|
||||
|
||||
//
|
||||
// Not used by UI
|
||||
//
|
||||
private IDefaultTableModel model = null;
|
||||
|
||||
private String method = "";
|
||||
|
||||
private static FindResult findPpisResult = null;
|
||||
|
||||
private static FindResult findProtocolsResult = null;
|
||||
|
||||
private static FindResult findGuidsResult = null;
|
||||
|
||||
private static FindResult findPcdsResult = null;
|
||||
|
||||
private static FindResult findLibraryClassResult = null;
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public FindResult(String method) {
|
||||
super();
|
||||
init(method);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void init(String method) {
|
||||
this.setSize(600, 500);
|
||||
this.setContentPane(getJScrollPane());
|
||||
this.setTitle("Find Result");
|
||||
this.setResizable(true);
|
||||
this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
this.centerWindow();
|
||||
|
||||
//
|
||||
// max the window
|
||||
//
|
||||
//this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
this.method = method;
|
||||
this.showTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jContentPane
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.add(getJScrollPaneTable(), null);
|
||||
jContentPane.add(getJButtonClose(), null);
|
||||
jContentPane.setPreferredSize(new java.awt.Dimension(585, 445));
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/**
|
||||
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 jScrollPaneTable
|
||||
|
||||
@return javax.swing.JScrollPane
|
||||
**/
|
||||
private JScrollPane getJScrollPaneTable() {
|
||||
if (jScrollPaneTable == null) {
|
||||
jScrollPaneTable = new JScrollPane();
|
||||
jScrollPaneTable.setBounds(new java.awt.Rectangle(0, 0, 585, 395));
|
||||
jScrollPaneTable.setPreferredSize(new Dimension(585, 395));
|
||||
jScrollPaneTable.setViewportView(getJTable());
|
||||
}
|
||||
return jScrollPaneTable;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jTable
|
||||
|
||||
@return javax.swing.JTable
|
||||
**/
|
||||
private JTable getJTable() {
|
||||
if (jTable == null) {
|
||||
model = new IDefaultTableModel();
|
||||
jTable = new JTable(model);
|
||||
|
||||
model.addColumn("Name");
|
||||
model.addColumn("Type");
|
||||
model.addColumn("Produced by");
|
||||
model.addColumn("Consumed by");
|
||||
model.addColumn("Declared by");
|
||||
|
||||
jTable.getColumn("Name").setCellRenderer(new MyTableCellRenderer());
|
||||
jTable.getColumn("Type").setCellRenderer(new MyTableCellRenderer());
|
||||
jTable.getColumn("Produced by").setCellRenderer(new MyTableCellRenderer());
|
||||
jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());
|
||||
jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());
|
||||
|
||||
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
jTable.getModel().addTableModelListener(this);
|
||||
}
|
||||
return jTable;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jButtonAdd
|
||||
|
||||
@return javax.swing.JButton jButtonAdd
|
||||
|
||||
**/
|
||||
private JButton getJButtonClose() {
|
||||
if (jButtonClose == null) {
|
||||
jButtonClose = new JButton();
|
||||
jButtonClose.setText("Close");
|
||||
jButtonClose.addActionListener(this);
|
||||
jButtonClose.setBounds(new java.awt.Rectangle(255, 415, 80, 20));
|
||||
jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));
|
||||
}
|
||||
return jButtonClose;
|
||||
}
|
||||
|
||||
public static FindResult getInstance(String method) {
|
||||
if (method.equals("PPI")) {
|
||||
if (findPpisResult == null) {
|
||||
findPpisResult = new FindResult(method);
|
||||
}
|
||||
findPpisResult.init(method);
|
||||
return findPpisResult;
|
||||
}
|
||||
|
||||
if (method.equals("PROTOCOL")) {
|
||||
if (findProtocolsResult == null) {
|
||||
findProtocolsResult = new FindResult(method);
|
||||
}
|
||||
findProtocolsResult.init(method);
|
||||
return findProtocolsResult;
|
||||
}
|
||||
|
||||
if (method.equals("GUID")) {
|
||||
if (findGuidsResult == null) {
|
||||
findGuidsResult = new FindResult(method);
|
||||
}
|
||||
findGuidsResult.init(method);
|
||||
return findGuidsResult;
|
||||
}
|
||||
|
||||
if (method.equals("PCD")) {
|
||||
if (findPcdsResult == null) {
|
||||
findPcdsResult = new FindResult(method);
|
||||
}
|
||||
findPcdsResult.init(method);
|
||||
return findPcdsResult;
|
||||
}
|
||||
|
||||
if (method.equals("LIBRARY_CLASS")) {
|
||||
if (findLibraryClassResult == null) {
|
||||
findLibraryClassResult = new FindResult(method);
|
||||
}
|
||||
findLibraryClassResult.init(method);
|
||||
return findLibraryClassResult;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
Clear all table rows
|
||||
|
||||
**/
|
||||
private void clearAll() {
|
||||
if (model != null) {
|
||||
for (int index = model.getRowCount() - 1; index >= 0; index--) {
|
||||
model.removeRow(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Read content of vector and put then into table
|
||||
|
||||
**/
|
||||
private void showTable() {
|
||||
clearAll();
|
||||
|
||||
if (this.method.equals("PPI")) {
|
||||
Vector<PpiId> vPpi = Find.getAllPpisForFind();
|
||||
|
||||
if (vPpi.size() > 0) {
|
||||
|
||||
for (int index = 0; index < vPpi.size(); index++) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(vPpi.elementAt(index).getName());
|
||||
v.addElement(vPpi.elementAt(index).getType());
|
||||
String strProducedModules = vPpi.elementAt(index).getProducedModules();
|
||||
if (strProducedModules.indexOf("<br>") == 0) {
|
||||
strProducedModules = strProducedModules.substring("<br>".length());
|
||||
}
|
||||
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
|
||||
v.addElement("<html>" + strProducedModules + "</html>");
|
||||
|
||||
String strConsumedModules = vPpi.elementAt(index).getConsumedModules();
|
||||
if (strConsumedModules.indexOf("<br>") == 0) {
|
||||
strConsumedModules = strConsumedModules.substring("<br>".length());
|
||||
}
|
||||
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
|
||||
v.addElement("<html>" + strConsumedModules + "</html>");
|
||||
|
||||
v.addElement(vPpi.elementAt(index).getDeclaredBy());
|
||||
|
||||
model.addRow(v);
|
||||
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
|
||||
}
|
||||
} else {
|
||||
Log.wrn("Find PPIs", "No PPI found!!!");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.method.equals("PROTOCOL")) {
|
||||
Vector<ProtocolId> vProtocol = Find.getAllProtocolsForFind();
|
||||
|
||||
if (vProtocol.size() > 0) {
|
||||
|
||||
for (int index = 0; index < vProtocol.size(); index++) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(vProtocol.elementAt(index).getName());
|
||||
v.addElement(vProtocol.elementAt(index).getType());
|
||||
String strProducedModules = vProtocol.elementAt(index).getProducedModules();
|
||||
if (strProducedModules.indexOf("<br>") == 0) {
|
||||
strProducedModules = strProducedModules.substring("<br>".length());
|
||||
}
|
||||
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
|
||||
v.addElement("<html>" + strProducedModules + "</html>");
|
||||
|
||||
String strConsumedModules = vProtocol.elementAt(index).getConsumedModules();
|
||||
if (strConsumedModules.indexOf("<br>") == 0) {
|
||||
strConsumedModules = strConsumedModules.substring("<br>".length());
|
||||
}
|
||||
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
|
||||
v.addElement("<html>" + strConsumedModules + "</html>");
|
||||
|
||||
v.addElement(vProtocol.elementAt(index).getDeclaredBy());
|
||||
|
||||
model.addRow(v);
|
||||
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
|
||||
}
|
||||
} else {
|
||||
Log.wrn("Find PROTOCOLs", "No PROTOCOL found!!!");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.method.equals("GUID")) {
|
||||
Vector<GuidId> vGuid = Find.getAllGuidsForFind();
|
||||
|
||||
if (vGuid.size() > 0) {
|
||||
|
||||
for (int index = 0; index < vGuid.size(); index++) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(vGuid.elementAt(index).getName());
|
||||
v.addElement("GUID");
|
||||
String strProducedModules = vGuid.elementAt(index).getProducedModules();
|
||||
if (strProducedModules.indexOf("<br>") == 0) {
|
||||
strProducedModules = strProducedModules.substring("<br>".length());
|
||||
}
|
||||
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
|
||||
v.addElement("<html>" + strProducedModules + "</html>");
|
||||
|
||||
String strConsumedModules = vGuid.elementAt(index).getConsumedModules();
|
||||
if (strConsumedModules.indexOf("<br>") == 0) {
|
||||
strConsumedModules = strConsumedModules.substring("<br>".length());
|
||||
}
|
||||
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
|
||||
v.addElement("<html>" + strConsumedModules + "</html>");
|
||||
|
||||
v.addElement(vGuid.elementAt(index).getDeclaredBy());
|
||||
|
||||
model.addRow(v);
|
||||
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
|
||||
}
|
||||
} else {
|
||||
Log.wrn("Find GUIDs", "No GUID found!!!");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.method.equals("PCD")) {
|
||||
Vector<PcdId> vPcd = Find.getAllPcdCodedForFind();
|
||||
|
||||
if (vPcd.size() > 0) {
|
||||
|
||||
for (int index = 0; index < vPcd.size(); index++) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(vPcd.elementAt(index).getName());
|
||||
v.addElement(vPcd.elementAt(index).getType());
|
||||
String strProducedModules = vPcd.elementAt(index).getProducedModules();
|
||||
if (strProducedModules.indexOf("<br>") == 0) {
|
||||
strProducedModules = strProducedModules.substring("<br>".length());
|
||||
}
|
||||
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
|
||||
v.addElement("<html>" + strProducedModules + "</html>");
|
||||
|
||||
String strConsumedModules = vPcd.elementAt(index).getConsumedModules();
|
||||
if (strConsumedModules.indexOf("<br>") == 0) {
|
||||
strConsumedModules = strConsumedModules.substring("<br>".length());
|
||||
}
|
||||
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
|
||||
v.addElement("<html>" + strConsumedModules + "</html>");
|
||||
|
||||
v.addElement(vPcd.elementAt(index).getDeclaredBy());
|
||||
|
||||
model.addRow(v);
|
||||
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
|
||||
}
|
||||
} else {
|
||||
Log.wrn("Find PCDs", "No PCD found!!!");
|
||||
}
|
||||
}
|
||||
|
||||
if (this.method.equals("LIBRARY_CLASS")) {
|
||||
Vector<LibraryClassId> vLibraryClass = Find.getAllLibraryClassForFind();
|
||||
|
||||
if (vLibraryClass.size() > 0) {
|
||||
|
||||
for (int index = 0; index < vLibraryClass.size(); index++) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(vLibraryClass.elementAt(index).getName());
|
||||
v.addElement(vLibraryClass.elementAt(index).getType());
|
||||
String strProducedModules = vLibraryClass.elementAt(index).getProducedModules();
|
||||
if (strProducedModules.indexOf("<br>") == 0) {
|
||||
strProducedModules = strProducedModules.substring("<br>".length());
|
||||
}
|
||||
int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");
|
||||
v.addElement("<html>" + strProducedModules + "</html>");
|
||||
|
||||
String strConsumedModules = vLibraryClass.elementAt(index).getConsumedModules();
|
||||
if (strConsumedModules.indexOf("<br>") == 0) {
|
||||
strConsumedModules = strConsumedModules.substring("<br>".length());
|
||||
}
|
||||
int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");
|
||||
v.addElement("<html>" + strConsumedModules + "</html>");
|
||||
|
||||
v.addElement(vLibraryClass.elementAt(index).getDeclaredBy());
|
||||
|
||||
model.addRow(v);
|
||||
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
|
||||
}
|
||||
} else {
|
||||
Log.wrn("Find Library Classes", "No Library Class found!!!");
|
||||
}
|
||||
}
|
||||
|
||||
this.jTable.repaint();
|
||||
this.jTable.updateUI();
|
||||
}
|
||||
|
||||
public void tableChanged(TableModelEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (arg0.getSource() == this.jButtonClose) {
|
||||
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
|
||||
*
|
||||
* Override componentResized to resize all components when frame's size is changed
|
||||
*/
|
||||
public void componentResized(ComponentEvent arg0) {
|
||||
int intCurrentWidth = this.getJContentPane().getWidth();
|
||||
int intCurrentHeight = this.getJContentPane().getHeight();
|
||||
int intPreferredWidth = this.getJContentPane().getPreferredSize().width;
|
||||
int intPreferredHeight = this.getJContentPane().getPreferredSize().height;
|
||||
|
||||
Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,
|
||||
intPreferredHeight);
|
||||
Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,
|
||||
DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
|
||||
*
|
||||
* Override windowClosing to popup warning message to confirm quit
|
||||
*
|
||||
*/
|
||||
public void windowClosing(WindowEvent arg0) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
class MyTableCellRenderer extends DefaultTableCellRenderer {
|
||||
///
|
||||
///
|
||||
///
|
||||
private static final long serialVersionUID = -2082787479305255946L;
|
||||
|
||||
public void setValue(Object value) {
|
||||
this.setVerticalAlignment(SwingConstants.TOP);
|
||||
super.setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define GUID Identification used by find function
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.find;
|
||||
|
||||
public class GuidId {
|
||||
|
||||
private String name = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private String producedModules = null;
|
||||
|
||||
private String consumedModules = null;
|
||||
|
||||
private String declaredBy = null;
|
||||
|
||||
public GuidId(String arg0, String arg1, String arg2, String arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
this.producedModules = (arg2 == null ? "" : arg2);
|
||||
this.consumedModules = (arg3 == null ? "" : arg3);
|
||||
this.declaredBy = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getConsumedModules() {
|
||||
return consumedModules;
|
||||
}
|
||||
|
||||
public void setConsumedModules(String consumedModules) {
|
||||
this.consumedModules = consumedModules;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProducedModules() {
|
||||
return producedModules;
|
||||
}
|
||||
|
||||
public void setProducedModules(String producedModules) {
|
||||
this.producedModules = producedModules;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeclaredBy() {
|
||||
return declaredBy;
|
||||
}
|
||||
|
||||
public void setDeclaredBy(String declaredBy) {
|
||||
this.declaredBy = declaredBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Library Class Identification used by find function
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.find;
|
||||
|
||||
public class LibraryClassId {
|
||||
|
||||
private String name = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private String producedModules = null;
|
||||
|
||||
private String consumedModules = null;
|
||||
|
||||
private String declaredBy = null;
|
||||
|
||||
public LibraryClassId(String arg0, String arg1, String arg2, String arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
this.producedModules = (arg2 == null ? "" : arg2);
|
||||
this.consumedModules = (arg3 == null ? "" : arg3);
|
||||
this.declaredBy = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getConsumedModules() {
|
||||
return consumedModules;
|
||||
}
|
||||
|
||||
public void setConsumedModules(String consumedModules) {
|
||||
this.consumedModules = consumedModules;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProducedModules() {
|
||||
return producedModules;
|
||||
}
|
||||
|
||||
public void setProducedModules(String producedModules) {
|
||||
this.producedModules = producedModules;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeclaredBy() {
|
||||
return declaredBy;
|
||||
}
|
||||
|
||||
public void setDeclaredBy(String declaredBy) {
|
||||
this.declaredBy = declaredBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define GUID Identification used by find function
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.find;
|
||||
|
||||
public class PcdId {
|
||||
|
||||
private String name = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private String producedModules = null;
|
||||
|
||||
private String consumedModules = null;
|
||||
|
||||
private String declaredBy = null;
|
||||
|
||||
public PcdId(String arg0, String arg1, String arg2, String arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
this.producedModules = (arg2 == null ? "" : arg2);
|
||||
this.consumedModules = (arg3 == null ? "" : arg3);
|
||||
this.declaredBy = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getConsumedModules() {
|
||||
return consumedModules;
|
||||
}
|
||||
|
||||
public void setConsumedModules(String consumedModules) {
|
||||
this.consumedModules = consumedModules;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProducedModules() {
|
||||
return producedModules;
|
||||
}
|
||||
|
||||
public void setProducedModules(String producedModules) {
|
||||
this.producedModules = producedModules;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeclaredBy() {
|
||||
return declaredBy;
|
||||
}
|
||||
|
||||
public void setDeclaredBy(String declaredBy) {
|
||||
this.declaredBy = declaredBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define PPI Identification used by find function
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.find;
|
||||
|
||||
public class PpiId {
|
||||
|
||||
private String name = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private String producedModules = null;
|
||||
|
||||
private String consumedModules = null;
|
||||
|
||||
private String declaredBy = null;
|
||||
|
||||
public PpiId(String arg0, String arg1, String arg2, String arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
this.producedModules = (arg2 == null ? "" : arg2);
|
||||
this.consumedModules = (arg3 == null ? "" : arg3);
|
||||
this.declaredBy = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getConsumedModules() {
|
||||
return consumedModules;
|
||||
}
|
||||
|
||||
public void setConsumedModules(String consumedModules) {
|
||||
this.consumedModules = consumedModules;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProducedModules() {
|
||||
return producedModules;
|
||||
}
|
||||
|
||||
public void setProducedModules(String producedModules) {
|
||||
this.producedModules = producedModules;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeclaredBy() {
|
||||
return declaredBy;
|
||||
}
|
||||
|
||||
public void setDeclaredBy(String declaredBy) {
|
||||
this.declaredBy = declaredBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define PROTOCOL Identification used by find function
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.find;
|
||||
|
||||
public class ProtocolId {
|
||||
|
||||
private String name = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private String producedModules = null;
|
||||
|
||||
private String consumedModules = null;
|
||||
|
||||
private String declaredBy = null;
|
||||
|
||||
public ProtocolId(String arg0, String arg1, String arg2, String arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
this.producedModules = (arg2 == null ? "" : arg2);
|
||||
this.consumedModules = (arg3 == null ? "" : arg3);
|
||||
this.declaredBy = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getConsumedModules() {
|
||||
return consumedModules;
|
||||
}
|
||||
|
||||
public void setConsumedModules(String consumedModules) {
|
||||
this.consumedModules = consumedModules;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getProducedModules() {
|
||||
return producedModules;
|
||||
}
|
||||
|
||||
public void setProducedModules(String producedModules) {
|
||||
this.producedModules = producedModules;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getDeclaredBy() {
|
||||
return declaredBy;
|
||||
}
|
||||
|
||||
public void setDeclaredBy(String declaredBy) {
|
||||
this.declaredBy = declaredBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
/** @file
|
||||
|
||||
The file is used to provid 6 kinds of arch in one jpanel
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
|
||||
public class ArchCheckBox extends JPanel {
|
||||
|
||||
///
|
||||
/// Define class members
|
||||
///
|
||||
private static final long serialVersionUID = 4792669775676953990L;
|
||||
|
||||
private JCheckBox jCheckBoxIa32 = null;
|
||||
|
||||
private JCheckBox jCheckBoxX64 = null;
|
||||
|
||||
private JCheckBox jCheckBoxIpf = null;
|
||||
|
||||
private JCheckBox jCheckBoxEbc = null;
|
||||
|
||||
private JCheckBox jCheckBoxArm = null;
|
||||
|
||||
private JCheckBox jCheckBoxPpc = null;
|
||||
|
||||
/**
|
||||
* This method initializes jCheckBoxIa32
|
||||
*
|
||||
* @return javax.swing.JCheckBox
|
||||
*/
|
||||
private JCheckBox getJCheckBoxIa32() {
|
||||
if (jCheckBoxIa32 == null) {
|
||||
jCheckBoxIa32 = new JCheckBox();
|
||||
jCheckBoxIa32.setBounds(new java.awt.Rectangle(0, 0, 55, 20));
|
||||
jCheckBoxIa32.setText("IA32");
|
||||
jCheckBoxIa32.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
|
||||
}
|
||||
return jCheckBoxIa32;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jCheckBoxX64
|
||||
*
|
||||
* @return javax.swing.JCheckBox
|
||||
*/
|
||||
private JCheckBox getJCheckBoxX64() {
|
||||
if (jCheckBoxX64 == null) {
|
||||
jCheckBoxX64 = new JCheckBox();
|
||||
jCheckBoxX64.setBounds(new java.awt.Rectangle(55, 0, 53, 20));
|
||||
jCheckBoxX64.setText("X64");
|
||||
jCheckBoxX64.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
|
||||
}
|
||||
return jCheckBoxX64;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jCheckBoxIpf
|
||||
*
|
||||
* @return javax.swing.JCheckBox
|
||||
*/
|
||||
private JCheckBox getJCheckBoxIpf() {
|
||||
if (jCheckBoxIpf == null) {
|
||||
jCheckBoxIpf = new JCheckBox();
|
||||
jCheckBoxIpf.setBounds(new java.awt.Rectangle(108, 0, 52, 20));
|
||||
jCheckBoxIpf.setText("IPF");
|
||||
jCheckBoxIpf.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
|
||||
}
|
||||
return jCheckBoxIpf;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jCheckBoxEbc
|
||||
*
|
||||
* @return javax.swing.JCheckBox
|
||||
*/
|
||||
private JCheckBox getJCheckBoxEbc() {
|
||||
if (jCheckBoxEbc == null) {
|
||||
jCheckBoxEbc = new JCheckBox();
|
||||
jCheckBoxEbc.setBounds(new java.awt.Rectangle(160, 0, 53, 20));
|
||||
jCheckBoxEbc.setText("EBC");
|
||||
jCheckBoxEbc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
|
||||
}
|
||||
return jCheckBoxEbc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jCheckBoxArm
|
||||
*
|
||||
* @return javax.swing.JCheckBox
|
||||
*/
|
||||
private JCheckBox getJCheckBoxArm() {
|
||||
if (jCheckBoxArm == null) {
|
||||
jCheckBoxArm = new JCheckBox();
|
||||
jCheckBoxArm.setBounds(new java.awt.Rectangle(213, 0, 54, 20));
|
||||
jCheckBoxArm.setText("ARM");
|
||||
jCheckBoxArm.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
|
||||
}
|
||||
return jCheckBoxArm;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes jCheckBoxPpc
|
||||
*
|
||||
* @return javax.swing.JCheckBox
|
||||
*/
|
||||
private JCheckBox getJCheckBoxPpc() {
|
||||
if (jCheckBoxPpc == null) {
|
||||
jCheckBoxPpc = new JCheckBox();
|
||||
jCheckBoxPpc.setBounds(new java.awt.Rectangle(267, 0, 53, 20));
|
||||
jCheckBoxPpc.setText("PPC");
|
||||
jCheckBoxPpc.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
|
||||
}
|
||||
return jCheckBoxPpc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
public ArchCheckBox() {
|
||||
super();
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private void initialize() {
|
||||
this.setSize(320, 20);
|
||||
this.setLayout(null);
|
||||
this.add(getJCheckBoxIa32(), null);
|
||||
this.add(getJCheckBoxX64(), null);
|
||||
this.add(getJCheckBoxIpf(), null);
|
||||
this.add(getJCheckBoxEbc(), null);
|
||||
this.add(getJCheckBoxArm(), null);
|
||||
this.add(getJCheckBoxPpc(), null);
|
||||
this.setToolTipText(DataType.SUP_ARCH_LIST_HELP_TEXT);
|
||||
}
|
||||
|
||||
public Vector<String> getSelectedItemsVector() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
|
||||
v.addElement(jCheckBoxIa32.getText());
|
||||
}
|
||||
if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
|
||||
v.addElement(jCheckBoxX64.getText());
|
||||
}
|
||||
if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
|
||||
v.addElement(jCheckBoxIpf.getText());
|
||||
}
|
||||
if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
|
||||
v.addElement(jCheckBoxEbc.getText());
|
||||
}
|
||||
if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
|
||||
v.addElement(jCheckBoxArm.getText());
|
||||
}
|
||||
if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
|
||||
v.addElement(jCheckBoxPpc.getText());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public String getSelectedItemsString() {
|
||||
String s = "";
|
||||
if (this.jCheckBoxIa32.isSelected() && this.jCheckBoxIa32.isEnabled()) {
|
||||
s = s + jCheckBoxIa32.getText() + " ";
|
||||
}
|
||||
if (this.jCheckBoxX64.isSelected() && this.jCheckBoxX64.isEnabled()) {
|
||||
s = s + jCheckBoxX64.getText() + " ";
|
||||
}
|
||||
if (this.jCheckBoxIpf.isSelected() && this.jCheckBoxIpf.isEnabled()) {
|
||||
s = s + jCheckBoxIpf.getText() + " ";
|
||||
}
|
||||
if (this.jCheckBoxEbc.isSelected() && this.jCheckBoxEbc.isEnabled()) {
|
||||
s = s + jCheckBoxEbc.getText() + " ";
|
||||
}
|
||||
if (this.jCheckBoxArm.isSelected() && this.jCheckBoxArm.isEnabled()) {
|
||||
s = s + jCheckBoxArm.getText() + " ";
|
||||
}
|
||||
if (this.jCheckBoxPpc.isSelected() && this.jCheckBoxPpc.isEnabled()) {
|
||||
s = s + jCheckBoxPpc.getText() + " ";
|
||||
}
|
||||
return s.trim();
|
||||
}
|
||||
|
||||
public void setAllItemsSelected(boolean isSelected) {
|
||||
this.jCheckBoxIa32.setSelected(isSelected);
|
||||
this.jCheckBoxX64.setSelected(isSelected);
|
||||
this.jCheckBoxIpf.setSelected(isSelected);
|
||||
this.jCheckBoxEbc.setSelected(isSelected);
|
||||
this.jCheckBoxArm.setSelected(isSelected);
|
||||
this.jCheckBoxPpc.setSelected(isSelected);
|
||||
}
|
||||
|
||||
public void setSelectedItems(Vector<String> v) {
|
||||
setAllItemsSelected(false);
|
||||
if (v != null) {
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
|
||||
this.jCheckBoxIa32.setSelected(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
|
||||
this.jCheckBoxIpf.setSelected(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxX64.getText())) {
|
||||
this.jCheckBoxX64.setSelected(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
|
||||
this.jCheckBoxEbc.setSelected(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxArm.getText())) {
|
||||
this.jCheckBoxArm.setSelected(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
|
||||
this.jCheckBoxPpc.setSelected(true);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setAllItemsEnabled(boolean isEnabled) {
|
||||
this.jCheckBoxIa32.setEnabled(isEnabled);
|
||||
this.jCheckBoxX64.setEnabled(isEnabled);
|
||||
this.jCheckBoxIpf.setEnabled(isEnabled);
|
||||
this.jCheckBoxEbc.setEnabled(isEnabled);
|
||||
this.jCheckBoxArm.setEnabled(isEnabled);
|
||||
this.jCheckBoxPpc.setEnabled(isEnabled);
|
||||
}
|
||||
|
||||
public void setEnabledItems(Vector<String> v) {
|
||||
setAllItemsEnabled(false);
|
||||
if (v != null) {
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
|
||||
this.jCheckBoxIa32.setEnabled(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
|
||||
this.jCheckBoxIpf.setEnabled(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxX64.getText())) {
|
||||
this.jCheckBoxX64.setEnabled(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
|
||||
this.jCheckBoxEbc.setEnabled(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxArm.getText())) {
|
||||
this.jCheckBoxArm.setEnabled(true);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
|
||||
this.jCheckBoxPpc.setEnabled(true);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setDisabledItems(Vector<String> v) {
|
||||
setAllItemsEnabled(true);
|
||||
if (v != null) {
|
||||
for (int index = 0; index < v.size(); index++) {
|
||||
if (v.get(index).equals(this.jCheckBoxIa32.getText())) {
|
||||
this.jCheckBoxIa32.setEnabled(false);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxIpf.getText())) {
|
||||
this.jCheckBoxIpf.setEnabled(false);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxX64.getText())) {
|
||||
this.jCheckBoxX64.setEnabled(false);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxEbc.getText())) {
|
||||
this.jCheckBoxEbc.setEnabled(false);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxArm.getText())) {
|
||||
this.jCheckBoxArm.setEnabled(false);
|
||||
continue;
|
||||
}
|
||||
if (v.get(index).equals(this.jCheckBoxPpc.getText())) {
|
||||
this.jCheckBoxPpc.setEnabled(false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,263 @@
|
||||
/** @file
|
||||
|
||||
The file is used to popup a exit confirmation window when program exists
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
The class is used to popup a exit confirmation window when program exists
|
||||
It extends JDialog and implements ActionListener and WindowListener
|
||||
|
||||
**/
|
||||
public class ExitConfirm extends JDialog implements ActionListener, WindowListener {
|
||||
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -5875921789385911029L;
|
||||
|
||||
private JPanel jContentPane = null;
|
||||
|
||||
private JLabel jLabelMessage = null;
|
||||
|
||||
private JLabel jLabelResume = null;
|
||||
|
||||
private JLabel jLabelExit = null;
|
||||
|
||||
private JButton jButtonResume = null;
|
||||
|
||||
private JButton jButtonExit = null;
|
||||
|
||||
public boolean isCancel = false;
|
||||
|
||||
/**
|
||||
This method initializes jButtonResume
|
||||
|
||||
@return javax.swing.JButton jButtonResume
|
||||
|
||||
**/
|
||||
private JButton getJButtonResume() {
|
||||
if (jButtonResume == null) {
|
||||
jButtonResume = new JButton();
|
||||
jButtonResume.setText("Resume");
|
||||
jButtonResume.setSize(new java.awt.Dimension(90, 20));
|
||||
jButtonResume.setLocation(new java.awt.Point(150, 105));
|
||||
jButtonResume.setMnemonic('R');
|
||||
jButtonResume.addActionListener(this);
|
||||
}
|
||||
return jButtonResume;
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jButtonExit
|
||||
|
||||
@return javax.swing.JButton jButtonExit
|
||||
|
||||
**/
|
||||
private JButton getJButtonExit() {
|
||||
if (jButtonExit == null) {
|
||||
jButtonExit = new JButton();
|
||||
jButtonExit.setText("Exit");
|
||||
jButtonExit.setSize(new java.awt.Dimension(90, 20));
|
||||
jButtonExit.setLocation(new java.awt.Point(260, 105));
|
||||
jButtonExit.setMnemonic('x');
|
||||
jButtonExit.addActionListener(this);
|
||||
}
|
||||
return jButtonExit;
|
||||
}
|
||||
|
||||
/**
|
||||
Main clasee, reserved for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public ExitConfirm(IFrame parentFrame, boolean modal) {
|
||||
super(parentFrame, modal);
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes this
|
||||
|
||||
@return void
|
||||
|
||||
**/
|
||||
private void initialize() {
|
||||
this.setSize(500, 170);
|
||||
this.setTitle("Exit");
|
||||
this.setResizable(false);
|
||||
this.setContentPane(getJContentPane());
|
||||
this.addWindowListener(this);
|
||||
//
|
||||
//Set DO_NOTHING_ON_CLOSE when click Close button on title bar
|
||||
//
|
||||
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
centerWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes jContentPane
|
||||
|
||||
@return javax.swing.JPanel jContentPane
|
||||
|
||||
**/
|
||||
private JPanel getJContentPane() {
|
||||
if (jContentPane == null) {
|
||||
jLabelExit = new JLabel();
|
||||
jLabelExit.setSize(new java.awt.Dimension(450, 20));
|
||||
jLabelExit.setLocation(new java.awt.Point(25, 70));
|
||||
jLabelResume = new JLabel();
|
||||
jLabelResume.setSize(new java.awt.Dimension(450, 20));
|
||||
jLabelResume.setLocation(new java.awt.Point(25, 40));
|
||||
jLabelMessage = new JLabel();
|
||||
jLabelMessage.setSize(new java.awt.Dimension(450, 20));
|
||||
jLabelMessage.setLocation(new java.awt.Point(25, 10));
|
||||
jContentPane = new JPanel();
|
||||
jContentPane.setLayout(null);
|
||||
jContentPane.add(jLabelMessage, null);
|
||||
jContentPane.add(jLabelResume, null);
|
||||
jContentPane.add(jLabelExit, null);
|
||||
jContentPane.add(getJButtonResume(), null);
|
||||
jContentPane.add(getJButtonExit(), null);
|
||||
}
|
||||
return jContentPane;
|
||||
}
|
||||
|
||||
/**
|
||||
Call setWarningMessage to set messages of frame when it is used for Setup
|
||||
|
||||
**/
|
||||
public void setSetupMessage() {
|
||||
String strTitle = "Exit Setup";
|
||||
String strMessage = "Setup is not complete. If you quit now, the program will not be installed.";
|
||||
String strResume = "You may run the setup program at a later time to complete the installation.";
|
||||
String strExit = "To continue installing, click Resume. To quit the Setup program, click Exit.";
|
||||
setWarningMessage(strTitle, strMessage, strResume, strExit);
|
||||
}
|
||||
|
||||
/**
|
||||
Call setWarningMessage to set messages of frame when it is used for Module Main GUI
|
||||
|
||||
**/
|
||||
public void setModuleMessage() {
|
||||
String strTitle = "Exit";
|
||||
String strMessage = "Do you really want to quit now?";
|
||||
String strResume = "All unsaved module information will be lost.";
|
||||
String strExit = "To continue editing the module, click Resume. To quit the program, click Exit.";
|
||||
setWarningMessage(strTitle, strMessage, strResume, strExit);
|
||||
}
|
||||
|
||||
/**
|
||||
Set message information via input data
|
||||
|
||||
@param strTitle The title value
|
||||
@param strMessage The main message value
|
||||
@param strResume The resume message value
|
||||
@param strExit The exit message value
|
||||
|
||||
**/
|
||||
private void setWarningMessage(String strTitle, String strMessage, String strResume, String strExit) {
|
||||
this.setTitle(strTitle);
|
||||
jLabelMessage.setText(strMessage);
|
||||
jLabelResume.setText(strResume);
|
||||
jLabelExit.setText(strExit);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
|
||||
*
|
||||
* Override actionPerformed to listern all actions
|
||||
*
|
||||
*/
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
//
|
||||
//Set isCancel true when click button "Exit"
|
||||
//
|
||||
Object obj = arg0.getSource();
|
||||
if (obj == jButtonResume) {
|
||||
isCancel = false;
|
||||
}
|
||||
if (obj == jButtonExit) {
|
||||
isCancel = true;
|
||||
}
|
||||
this.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
Make the window in the center of the screen
|
||||
|
||||
**/
|
||||
private void centerWindow() {
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
|
||||
}
|
||||
|
||||
public void windowActivated(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowClosed(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowClosing(WindowEvent arg0) {
|
||||
isCancel = false;
|
||||
this.setVisible(false);
|
||||
}
|
||||
|
||||
public void windowDeactivated(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowDeiconified(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowIconified(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowOpened(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,195 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override JComboBox to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
The class is used to override JComboBox to provides customized interfaces
|
||||
It extends JComboBox implements KeyListener, MouseListener and FocusListener
|
||||
|
||||
|
||||
|
||||
**/
|
||||
public class IComboBox extends JComboBox implements KeyListener, MouseListener, FocusListener {
|
||||
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -1940262568168458911L;
|
||||
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
|
||||
*
|
||||
* Override focusLost to exit edit mode
|
||||
*
|
||||
*/
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
this.closeEdit();
|
||||
}
|
||||
|
||||
/**
|
||||
Main class, used for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
JFrame jf = new JFrame();
|
||||
jf.setSize(500, 200);
|
||||
JPanel jp = new JPanel();
|
||||
jp.setLayout(null);
|
||||
IComboBox icb = new IComboBox();
|
||||
jp.add(icb, null);
|
||||
jf.setContentPane(jp);
|
||||
jf.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public IComboBox() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes this
|
||||
|
||||
**/
|
||||
private void init() {
|
||||
this.setSize(320, 20);
|
||||
this.setEditable(false);
|
||||
this.editor.addActionListener(this);
|
||||
this.addMouseListener(this);
|
||||
this.addKeyListener(this);
|
||||
this.getEditor().getEditorComponent().addKeyListener(this);
|
||||
this.getEditor().getEditorComponent().addFocusListener(this);
|
||||
this.setToolTipText("<html>Double Click to add an entry, then finish by press ENTER.<br>"
|
||||
+ "Selecting DELETE will remove selected entry.</html>");
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
|
||||
*
|
||||
* Override keyReleased to listen key action
|
||||
*
|
||||
*/
|
||||
public void keyReleased(KeyEvent arg0) {
|
||||
//
|
||||
//Add new item to list when press ENTER
|
||||
//
|
||||
if (arg0.getSource() == this.getEditor().getEditorComponent()) {
|
||||
if (arg0.getKeyCode() == KeyEvent.VK_ENTER) {
|
||||
String strCurrentText = this.getEditor().getItem().toString().trim();
|
||||
if (strCurrentText.length() == 0) {
|
||||
if (this.getItemCount() > 0) {
|
||||
this.setSelectedIndex(0);
|
||||
}
|
||||
} else {
|
||||
this.addItem(strCurrentText);
|
||||
this.setSelectedItem(strCurrentText);
|
||||
}
|
||||
this.setEditable(false);
|
||||
}
|
||||
|
||||
if (arg0.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
closeEdit();
|
||||
}
|
||||
}
|
||||
|
||||
if (arg0.getSource() == this) {
|
||||
//
|
||||
//Remove item from the list when press DEL
|
||||
//
|
||||
if (arg0.getKeyCode() == KeyEvent.VK_DELETE) {
|
||||
int intSelected = this.getSelectedIndex();
|
||||
if (intSelected > -1) {
|
||||
this.removeItemAt(this.getSelectedIndex());
|
||||
if (this.getItemCount() > 0) {
|
||||
this.setSelectedIndex(0);
|
||||
} else {
|
||||
this.removeAllItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void keyTyped(KeyEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
|
||||
*
|
||||
* Override mouseClicked to enter edit mode when double click mouse
|
||||
*
|
||||
*/
|
||||
public void mouseClicked(MouseEvent arg0) {
|
||||
if (arg0.getClickCount() == 2) {
|
||||
this.setEditable(true);
|
||||
this.getEditor().setItem("");
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Exit edit mode
|
||||
|
||||
**/
|
||||
private void closeEdit() {
|
||||
this.setEditable(false);
|
||||
this.getEditor().setItem("");
|
||||
}
|
||||
}
|
@ -0,0 +1,280 @@
|
||||
/** @file
|
||||
|
||||
|
||||
The file is used to override DefaultMutableTreeNode to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
||||
|
||||
/**
|
||||
The class is used to override DefaultMutableTreeNode to provides customized interfaces
|
||||
It extends DefaultMutableTreeNode
|
||||
|
||||
|
||||
|
||||
**/
|
||||
public class IDefaultMutableTreeNode extends DefaultMutableTreeNode {
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -1947340717458069548L;
|
||||
|
||||
//
|
||||
// Static final definitions for all kinds of node
|
||||
//
|
||||
public static final int MSA_HEADER = 100;
|
||||
|
||||
public static final int MSA_LIBRARYCLASSDEFINITIONS = 101;
|
||||
|
||||
public static final int MSA_PACKAGEDEPENDENCIES = 102;
|
||||
|
||||
public static final int MSA_SOURCEFILES = 103;
|
||||
|
||||
public static final int MSA_PROTOCOLS = 104;
|
||||
|
||||
public static final int MSA_EVENTS = 105;
|
||||
|
||||
public static final int MSA_HOBS = 106;
|
||||
|
||||
public static final int MSA_PPIS = 107;
|
||||
|
||||
public static final int MSA_VARIABLES = 108;
|
||||
|
||||
public static final int MSA_BOOTMODES = 109;
|
||||
|
||||
public static final int MSA_SYSTEMTABLES = 110;
|
||||
|
||||
public static final int MSA_DATAHUBS = 111;
|
||||
|
||||
public static final int MSA_HIIPACKAGES = 112;
|
||||
|
||||
public static final int MSA_GUIDS = 113;
|
||||
|
||||
public static final int MSA_EXTERNS = 114;
|
||||
|
||||
public static final int MSA_PCDS = 115;
|
||||
|
||||
public static final int MSA_BUILDOPTIONS = 117;
|
||||
|
||||
public static final int MSA_USEREXTENSIONS = 118;
|
||||
|
||||
public static final int MSA_MODULEDEFINITIONS = 119;
|
||||
|
||||
public static final int SPD_HEADER = 200;
|
||||
|
||||
public static final int SPD_LIBRARYCLASSDECLARATIONS = 201;
|
||||
|
||||
public static final int SPD_MSAFILES = 202;
|
||||
|
||||
public static final int SPD_PACKAGEHEADERS = 203;
|
||||
|
||||
public static final int SPD_GUIDDECLARATIONS = 204;
|
||||
|
||||
public static final int SPD_PROTOCOLDECLARATIONS = 205;
|
||||
|
||||
public static final int SPD_PPIDECLARATIONS = 206;
|
||||
|
||||
public static final int SPD_PCDDECLARATIONS = 207;
|
||||
|
||||
public static final int SPD_PACKAGEDEFINITIONS = 208;
|
||||
|
||||
public static final int SPD_INDUSTRYSTDINCLUDES = 209;
|
||||
|
||||
public static final int FPD_PLATFORMHEADER = 300;
|
||||
|
||||
public static final int FPD_FLASH = 301;
|
||||
|
||||
public static final int FPD_FRAMEWORKMODULES = 302;
|
||||
|
||||
public static final int FPD_PCDDYNAMICBUILDDECLARATIONS = 303;
|
||||
|
||||
public static final int FPD_BUILDOPTIONS = 304;
|
||||
|
||||
public static final int FPD_PLATFORMDEFINITIONS = 305;
|
||||
|
||||
public static final int WORKSPACE = 0;
|
||||
|
||||
public static final int MODULE_DESCRIPTION = 1;
|
||||
|
||||
public static final int PACKAGE_DESCRIPTION = 2;
|
||||
|
||||
public static final int PLATFORM_DESCRIPTION = 3;
|
||||
|
||||
public static final int MODULE = 4;
|
||||
|
||||
public static final int PACKAGE = 5;
|
||||
|
||||
public static final int PLATFORM = 6;
|
||||
|
||||
public static final int MODULE_PACKAGE = 7;
|
||||
|
||||
public static final int MODULE_PACKAGE_LIBRARY = 8;
|
||||
|
||||
public static final int MODULE_PACKAGE_MODULE = 9;
|
||||
|
||||
//
|
||||
//Static final definitions for operation
|
||||
//
|
||||
public static final int OPERATION_NULL = 0;
|
||||
|
||||
public static final int OPERATION_ADD = 1;
|
||||
|
||||
public static final int OPERATION_UPDATE = 2;
|
||||
|
||||
public static final int OPERATION_DELETE = 4;
|
||||
|
||||
public static final int OPERATION_ADD_UPDATE = 3;
|
||||
|
||||
public static final int OPERATION_ADD_DELETE = 5;
|
||||
|
||||
public static final int OPERATION_UPDATE_DELETE = 6;
|
||||
|
||||
public static final int OPERATION_ADD_UPDATE_DELETE = 7;
|
||||
|
||||
//
|
||||
//Define 4 node attributes
|
||||
//
|
||||
private int category = 0;
|
||||
|
||||
private String nodeName = "";
|
||||
|
||||
private boolean isOpening = false;
|
||||
|
||||
private Identification id = null;
|
||||
|
||||
private IDefaultMutableTreeNode belongNode = null;
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public IDefaultMutableTreeNode() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
This is the overrided constructor
|
||||
Init clase members with input data
|
||||
|
||||
@param strNodeName The name of node
|
||||
@param intCategory The category of node
|
||||
@param bolIsOpened to identify if the node is opening or not
|
||||
@param identification The Identification of node
|
||||
|
||||
**/
|
||||
public IDefaultMutableTreeNode(String strNodeName, int intCategory, boolean bolIsOpening,
|
||||
Identification identification, IDefaultMutableTreeNode idmtBelongNode) {
|
||||
super(strNodeName);
|
||||
this.nodeName = strNodeName;
|
||||
this.category = intCategory;
|
||||
this.isOpening = bolIsOpening;
|
||||
this.id = identification;
|
||||
this.belongNode = idmtBelongNode;
|
||||
}
|
||||
|
||||
/**
|
||||
Get category of node
|
||||
|
||||
@return The category of node
|
||||
|
||||
**/
|
||||
public int getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
/**
|
||||
Set category of node
|
||||
|
||||
@param category The input data of node category
|
||||
|
||||
**/
|
||||
public void setCategory(int category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
Get name of node
|
||||
|
||||
@return The name of node
|
||||
|
||||
**/
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
/**
|
||||
Set name of node
|
||||
|
||||
@param nodeName The input data of node name
|
||||
|
||||
**/
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
/**
|
||||
Get identification of node
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public Identification getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
Set identification of node
|
||||
|
||||
@param id
|
||||
|
||||
**/
|
||||
public void setId(Identification id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
get isOpening of node
|
||||
|
||||
@return
|
||||
|
||||
**/
|
||||
public boolean isOpening() {
|
||||
return isOpening;
|
||||
}
|
||||
|
||||
/**
|
||||
Set isOpening of node
|
||||
|
||||
@param isOpening
|
||||
|
||||
**/
|
||||
public void setOpening(boolean isOpening) {
|
||||
this.isOpening = isOpening;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.nodeName;
|
||||
}
|
||||
|
||||
public IDefaultMutableTreeNode getBelongNode() {
|
||||
return belongNode;
|
||||
}
|
||||
|
||||
public void setBelongNode(IDefaultMutableTreeNode belongNode) {
|
||||
this.belongNode = belongNode;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override DefaultDesktopManager to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import javax.swing.DefaultDesktopManager;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
/**
|
||||
The class is used to override DefaultDesktopManager to provides customized interfaces
|
||||
It extends DefaultDesktopManager
|
||||
|
||||
|
||||
|
||||
**/
|
||||
public class IDesktopManager extends DefaultDesktopManager {
|
||||
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -4596986878722011062L;
|
||||
|
||||
/**
|
||||
Main class, reserved for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.DesktopManager#dragFrame(javax.swing.JComponent, int, int)
|
||||
*
|
||||
* Override dragFrame to do nothing to forbid internalframe to be draged
|
||||
*
|
||||
*/
|
||||
public void dragFrame(JComponent f, int newX, int newY) {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.DesktopManager#endDraggingFrame(javax.swing.JComponent)
|
||||
*
|
||||
* Override endDraggingFrame to do nothing to forbid internalframe to be draged
|
||||
*
|
||||
*/
|
||||
public void endDraggingFrame(JComponent f) {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.DesktopManager#beginResizingFrame(javax.swing.JComponent, int)
|
||||
*
|
||||
* Override beginResizingFrame to do nothing to forbid internalframe to be draged
|
||||
*
|
||||
*/
|
||||
public void beginResizingFrame(JComponent f, int direction) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override Dialog to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.Tools;
|
||||
|
||||
/**
|
||||
The class is used to override Dialog to provides customized interfaces
|
||||
It extends JDialog implements ActionListener
|
||||
|
||||
|
||||
|
||||
**/
|
||||
public class IDialog extends JDialog implements ActionListener {
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -7692623863358631984L;
|
||||
//
|
||||
//Define class members
|
||||
//
|
||||
private boolean isEdited = false;
|
||||
|
||||
public int returnType = DataType.RETURN_TYPE_CANCEL;
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Main class, used for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
IDialog id = new IDialog();
|
||||
id.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
**/
|
||||
public IDialog() {
|
||||
super();
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
This is the override constructor
|
||||
|
||||
@param parentFrame The parent frame which open the dialog
|
||||
@param modal true means the dialog is modal dialog; false means the dialog is not modal dialog
|
||||
**/
|
||||
public IDialog(IFrame parentFrame, boolean modal) {
|
||||
super(parentFrame, modal);
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
This is the override constructor
|
||||
|
||||
@param parentFrame The parent frame which open the dialog
|
||||
@param modal true means the dialog is modal dialog; false means the dialog is not modal dialog
|
||||
**/
|
||||
public IDialog(IDialog parentFrame, boolean modal) {
|
||||
super(parentFrame, modal);
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes this
|
||||
|
||||
**/
|
||||
private void initialize() {
|
||||
this.setResizable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
Start the dialog at the center of screen
|
||||
|
||||
@param intWidth The width of the dialog
|
||||
@param intHeight The height of the dialog
|
||||
|
||||
**/
|
||||
protected void centerWindow(int intWidth, int intHeight) {
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
Start the dialog at the center of screen
|
||||
|
||||
**/
|
||||
protected void centerWindow() {
|
||||
centerWindow(this.getSize().width, this.getSize().height);
|
||||
}
|
||||
|
||||
/**
|
||||
Get if the dialog has been edited
|
||||
|
||||
@retval true - The dialog has been edited
|
||||
@retval false - The dialog hasn't been edited
|
||||
|
||||
**/
|
||||
public boolean isEdited() {
|
||||
return isEdited;
|
||||
}
|
||||
|
||||
/**
|
||||
Set if the dialog has been edited
|
||||
|
||||
@param isEdited The input data which identify if the dialog has been edited
|
||||
|
||||
**/
|
||||
public void setEdited(boolean isEdited) {
|
||||
this.isEdited = isEdited;
|
||||
}
|
||||
|
||||
/**
|
||||
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) {
|
||||
return Tools.isEmpty(strValue);
|
||||
}
|
||||
|
||||
/**
|
||||
Display the dialog
|
||||
|
||||
**/
|
||||
public int showDialog() {
|
||||
this.setVisible(true);
|
||||
return returnType;
|
||||
}
|
||||
}
|
@ -0,0 +1,263 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override Frame to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.WindowListener;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.Tools;
|
||||
|
||||
/**
|
||||
The class is used to override Frame to provides customized interfaces
|
||||
It extends JFrame implements ActionListener and WindowListener
|
||||
|
||||
**/
|
||||
public class IFrame extends JFrame implements ActionListener, WindowListener, ComponentListener {
|
||||
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -3324138961029300427L;
|
||||
|
||||
//
|
||||
//Define class members
|
||||
//
|
||||
private ExitConfirm ec = null;
|
||||
|
||||
//
|
||||
// To indicate the status while quit
|
||||
// 0 - When setup (Default)
|
||||
// 1 - Whne editing module
|
||||
//
|
||||
private int intExitType = 0;
|
||||
|
||||
/**
|
||||
Main class, used for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
IFrame i = new IFrame();
|
||||
i.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public IFrame() {
|
||||
super();
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
This method initializes this
|
||||
|
||||
**/
|
||||
public void initialize() {
|
||||
this.setResizable(false);
|
||||
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
this.addWindowListener(this);
|
||||
this.addComponentListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
Start the dialog at the center of screen
|
||||
|
||||
@param intWidth The width of the dialog
|
||||
@param intHeight The height of the dialog
|
||||
|
||||
**/
|
||||
protected void centerWindow(int intWidth, int intHeight) {
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
Start the window full of the screen
|
||||
|
||||
**/
|
||||
protected void maxWindow() {
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
this.setLocation(0, 0);
|
||||
this.setSize(d);
|
||||
}
|
||||
|
||||
/**
|
||||
Start the dialog at the center of screen
|
||||
|
||||
**/
|
||||
protected void centerWindow() {
|
||||
centerWindow(this.getSize().width, this.getSize().height);
|
||||
}
|
||||
|
||||
/**
|
||||
Set the exit window type
|
||||
|
||||
@param ExitType The input data of ExitType
|
||||
|
||||
**/
|
||||
protected void setExitType(int ExitType) {
|
||||
this.intExitType = ExitType;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
|
||||
*
|
||||
* Override windowClosing to call this.onDisvisible()
|
||||
*
|
||||
*/
|
||||
public void windowClosing(WindowEvent arg0) {
|
||||
//this.onDisvisible();
|
||||
}
|
||||
|
||||
public void windowOpened(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowClosed(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowIconified(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowDeiconified(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowActivated(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void windowDeactivated(WindowEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Define the actions when exit
|
||||
|
||||
**/
|
||||
public void onExit() {
|
||||
ec = new ExitConfirm(this, true);
|
||||
//
|
||||
//Show different warning message via different ExitType
|
||||
//
|
||||
switch (intExitType) {
|
||||
case 0:
|
||||
ec.setSetupMessage();
|
||||
break;
|
||||
case 1:
|
||||
ec.setModuleMessage();
|
||||
break;
|
||||
}
|
||||
ec.setVisible(true);
|
||||
if (ec.isCancel) {
|
||||
this.dispose();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Define the actions when disvisible
|
||||
|
||||
**/
|
||||
public void onDisvisible() {
|
||||
ec = new ExitConfirm(this, true);
|
||||
//
|
||||
//Show different warning message via different ExitType
|
||||
//
|
||||
switch (intExitType) {
|
||||
case 0:
|
||||
ec.setSetupMessage();
|
||||
break;
|
||||
case 1:
|
||||
ec.setModuleMessage();
|
||||
break;
|
||||
}
|
||||
ec.setVisible(true);
|
||||
if (ec.isCancel) {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public int showSaveDialog() {
|
||||
return JOptionPane.showConfirmDialog(null, "Save all changed files?", "Save", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
|
||||
/**
|
||||
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) {
|
||||
return Tools.isEmpty(strValue);
|
||||
}
|
||||
|
||||
/**
|
||||
Display the dialog
|
||||
|
||||
**/
|
||||
public void showDialog() {
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public void componentResized(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void componentMoved(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void componentShown(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void componentHidden(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,216 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override JInternalFrame to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
|
||||
import javax.swing.JDesktopPane;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JInternalFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
import javax.swing.event.TableModelListener;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.Tools;
|
||||
|
||||
/**
|
||||
* The class is used to override JInternalFrame to provides customized
|
||||
* interfaces It extends JInternalFrame implements ActionListener
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class IInternalFrame extends JInternalFrame implements ActionListener, ComponentListener, ItemListener,
|
||||
FocusListener, ListSelectionListener, TableModelListener, MouseListener {
|
||||
|
||||
// /
|
||||
// / Define class Serial Version UID
|
||||
// /
|
||||
private static final long serialVersionUID = -609841772384875886L;
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private boolean isEdited = false;
|
||||
|
||||
/**
|
||||
* Main class, used for test
|
||||
*
|
||||
* @param args
|
||||
*
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
JFrame jf = new JFrame();
|
||||
JPanel jp = new JPanel();
|
||||
JDesktopPane jdp = new JDesktopPane();
|
||||
IInternalFrame itf = new IInternalFrame();
|
||||
jdp.add(itf, 1);
|
||||
jf.setContentPane(jp);
|
||||
jf.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default constructor
|
||||
*
|
||||
*/
|
||||
public IInternalFrame() {
|
||||
super();
|
||||
initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method initializes this
|
||||
*
|
||||
*/
|
||||
private void initialize() {
|
||||
this.setBounds(new java.awt.Rectangle(0, 0, 520, 545));
|
||||
this.setMinimumSize(new java.awt.Dimension(520, 545));
|
||||
this.addComponentListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get if the InternalFrame has been edited
|
||||
*
|
||||
* @retval true - The InternalFrame has been edited
|
||||
* @retval false - The InternalFrame hasn't been edited
|
||||
*
|
||||
*/
|
||||
public boolean isEdited() {
|
||||
return isEdited;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the InternalFrame has been edited
|
||||
*
|
||||
* @param isEdited
|
||||
* The input data which identify if the InternalFrame has been
|
||||
* edited
|
||||
*
|
||||
*/
|
||||
public void setEdited(boolean isEdited) {
|
||||
this.isEdited = isEdited;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return Tools.isEmpty(strValue);
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public void componentHidden(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void componentMoved(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void componentResized(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
public void componentShown(ComponentEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void showStandard() {
|
||||
|
||||
}
|
||||
|
||||
public void showAdvanced() {
|
||||
|
||||
}
|
||||
|
||||
public void showXML() {
|
||||
|
||||
}
|
||||
|
||||
public void itemStateChanged(ItemEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void focusGained(FocusEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void focusLost(FocusEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void valueChanged(ListSelectionEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void tableChanged(TableModelEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseClicked(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,231 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override JTree to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.Identifications.Identification;
|
||||
|
||||
/**
|
||||
The class is used to override JTree to provides customized interfaces
|
||||
It extends JTree
|
||||
|
||||
**/
|
||||
public class ITree extends JTree {
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -7907086164518295327L;
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
DefaultTreeModel treeModel = null;
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public ITree() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
This is the overrided constructor
|
||||
Init class members with input data
|
||||
|
||||
@param iDmtRoot The root node of the tree
|
||||
|
||||
**/
|
||||
public ITree(IDefaultMutableTreeNode iDmtRoot) {
|
||||
super(iDmtRoot);
|
||||
treeModel = (DefaultTreeModel) this.getModel();
|
||||
}
|
||||
|
||||
/**
|
||||
Get category of selected node
|
||||
|
||||
@return The category of selected node
|
||||
|
||||
**/
|
||||
public int getSelectCategory() {
|
||||
int intCategory = 0;
|
||||
TreePath path = this.getSelectionPath();
|
||||
IDefaultMutableTreeNode node = (IDefaultMutableTreeNode) path.getLastPathComponent();
|
||||
intCategory = node.getCategory();
|
||||
return intCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
Add input node as child node for current selected node
|
||||
|
||||
@param strNewNode The name of the node which need be added
|
||||
|
||||
**/
|
||||
public void addNode(String strNewNode) {
|
||||
DefaultMutableTreeNode parentNode = null;
|
||||
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(strNewNode);
|
||||
newNode.setAllowsChildren(true);
|
||||
TreePath parentPath = this.getSelectionPath();
|
||||
|
||||
/**
|
||||
* Get parent node of new node
|
||||
*/
|
||||
parentNode = (DefaultMutableTreeNode) (parentPath.getLastPathComponent());
|
||||
|
||||
/**
|
||||
* Insert new node
|
||||
*/
|
||||
treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
|
||||
this.scrollPathToVisible(new TreePath(newNode.getPath()));
|
||||
}
|
||||
|
||||
/**
|
||||
Add input node as child node for current selected node
|
||||
|
||||
@param newNode The node need be added
|
||||
|
||||
**/
|
||||
public void addNode(IDefaultMutableTreeNode newNode) {
|
||||
IDefaultMutableTreeNode parentNode = null;
|
||||
newNode.setAllowsChildren(true);
|
||||
TreePath parentPath = this.getSelectionPath();
|
||||
parentNode = (IDefaultMutableTreeNode) (parentPath.getLastPathComponent());
|
||||
treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
|
||||
this.scrollPathToVisible(new TreePath(newNode.getPath()));
|
||||
}
|
||||
|
||||
/**
|
||||
Add input node as child node for current selected node
|
||||
|
||||
@param newNode The node need be added
|
||||
|
||||
**/
|
||||
public void addNode(IDefaultMutableTreeNode parentNode, IDefaultMutableTreeNode newNode) {
|
||||
treeModel.insertNodeInto(newNode, parentNode, parentNode.getChildCount());
|
||||
this.scrollPathToVisible(new TreePath(newNode.getPath()));
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the selected node
|
||||
|
||||
@param strRemovedNode
|
||||
|
||||
**/
|
||||
public void removeSelectedNode() {
|
||||
TreePath treePath = this.getSelectionPath();
|
||||
removeNodeByPath(treePath);
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the node by tree path
|
||||
|
||||
@param strRemovedNode
|
||||
|
||||
**/
|
||||
public void removeNodeByPath(TreePath treePath) {
|
||||
if (treePath != null) {
|
||||
DefaultMutableTreeNode selectionNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();
|
||||
TreeNode parent = (TreeNode) selectionNode.getParent();
|
||||
if (parent != null) {
|
||||
treeModel.removeNodeFromParent(selectionNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Return a node by input tree path
|
||||
|
||||
@param treePath
|
||||
@return
|
||||
|
||||
**/
|
||||
public IDefaultMutableTreeNode getNodeByPath(TreePath treePath) {
|
||||
if (treePath != null) {
|
||||
IDefaultMutableTreeNode selectionNode = (IDefaultMutableTreeNode) treePath.getLastPathComponent();
|
||||
return selectionNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
Remove all child nodes under current node
|
||||
|
||||
**/
|
||||
public void removeNodeChildrenByPath(TreePath treePath) {
|
||||
if (treePath != null) {
|
||||
DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) treePath.getLastPathComponent();
|
||||
for (int index = currentNode.getChildCount() - 1; index > -1; index--) {
|
||||
treeModel.removeNodeFromParent((DefaultMutableTreeNode) currentNode.getChildAt(index));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Remove all nodes of the tree
|
||||
|
||||
**/
|
||||
public void removeAllNode() {
|
||||
DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) treeModel.getRoot();
|
||||
rootNode.removeAllChildren();
|
||||
treeModel.reload();
|
||||
}
|
||||
|
||||
public IDefaultMutableTreeNode getSelectNode() {
|
||||
TreePath treepath = this.getSelectionPath();
|
||||
IDefaultMutableTreeNode selectionNode = null;
|
||||
if (treepath != null) {
|
||||
selectionNode = (IDefaultMutableTreeNode) treepath.getLastPathComponent();
|
||||
}
|
||||
return selectionNode;
|
||||
}
|
||||
|
||||
public IDefaultMutableTreeNode getNodeById(IDefaultMutableTreeNode node, Identification id) {
|
||||
for (int index = 0; index < node.getChildCount(); index++) {
|
||||
IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) node.getChildAt(index);
|
||||
if (iNode.getId().equals(id)) {
|
||||
return iNode;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IDefaultMutableTreeNode getNodeById(IDefaultMutableTreeNode node, Identification id, int category) {
|
||||
for (int index = 0; index < node.getChildCount(); index++) {
|
||||
IDefaultMutableTreeNode iNode = (IDefaultMutableTreeNode) node.getChildAt(index);
|
||||
if (iNode.getId().equals(id) && iNode.getCategory() == category) {
|
||||
return iNode;
|
||||
}
|
||||
IDefaultMutableTreeNode childNode = getNodeById(iNode, id, category);
|
||||
if (childNode != null) {
|
||||
return childNode;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TreePath getPathOfNode(IDefaultMutableTreeNode node) {
|
||||
if (node != null) {
|
||||
TreePath treePath = new TreePath(treeModel.getPathToRoot(node));
|
||||
return treePath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override JLabel to provides customized interfaces
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
package org.tianocore.frameworkwizard.common.ui;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
|
||||
/**
|
||||
The class is used to override JLabel to provides customized interfaces
|
||||
|
||||
|
||||
|
||||
**/
|
||||
public class StarLabel extends JLabel {
|
||||
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -6702981027831543919L;
|
||||
|
||||
/**
|
||||
Main class, reserved for test
|
||||
|
||||
@param args
|
||||
|
||||
**/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
**/
|
||||
public StarLabel() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
To create a RED, BOLD and 14 size "*"
|
||||
|
||||
**/
|
||||
private void init() {
|
||||
this.setText("*");
|
||||
this.setSize(new java.awt.Dimension(10, 20));
|
||||
this.setForeground(java.awt.Color.red);
|
||||
this.setFont(new java.awt.Font("DialogInput", java.awt.Font.BOLD, 14));
|
||||
this.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
}
|
||||
}
|
@ -0,0 +1,178 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override JList to create a List with CheckBox 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.common.ui.iCheckBoxList;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import javax.swing.JList;
|
||||
|
||||
public class ICheckBoxList extends JList {
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -2843059688070447632L;
|
||||
|
||||
protected ICheckBoxListCellRenderer cellrenderer = new ICheckBoxListCellRenderer();
|
||||
|
||||
protected ICheckBoxListener listener = new ICheckBoxListener(this);
|
||||
|
||||
protected ICheckBoxListModel model = new ICheckBoxListModel();
|
||||
|
||||
/**
|
||||
This the default Constructor
|
||||
|
||||
**/
|
||||
public ICheckBoxList() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
This the override constructor to create checkbox item with input vector
|
||||
|
||||
@param options
|
||||
|
||||
**/
|
||||
public ICheckBoxList(Vector<ICheckBoxListItem> items) {
|
||||
if (items != null) {
|
||||
for (int index = 0; index < items.size(); index++) {
|
||||
model.addElement(items.elementAt(index));
|
||||
}
|
||||
}
|
||||
this.setCellRenderer(cellrenderer);
|
||||
this.setModel(model);
|
||||
this.addMouseListener(listener);
|
||||
this.addKeyListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
Set all items of the CheckBoxList component.
|
||||
|
||||
@param items
|
||||
|
||||
**/
|
||||
public void setAllItems(Vector<String> items) {
|
||||
if (items != null) {
|
||||
model.removeAllElements();
|
||||
for (int index = 0; index < items.size(); index++) {
|
||||
model.addElement(new ICheckBoxListItem(items.elementAt(index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get All Checked Items of the CheckBoxList component.
|
||||
|
||||
@return All Checked Items
|
||||
**/
|
||||
public Vector<ICheckBoxListItem> getAllCheckedItems() {
|
||||
Vector<ICheckBoxListItem> result = new Vector<ICheckBoxListItem>();
|
||||
|
||||
for (int i = 0; i < this.getModel().getSize(); i++) {
|
||||
if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
|
||||
result.addElement((ICheckBoxListItem) this.getModel().getElementAt(i));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
Get All Checked Items index of the CheckBoxList component.
|
||||
|
||||
@return All Checked Items index
|
||||
**/
|
||||
public Vector<Integer> getAllCheckedItemsIndex() {
|
||||
Vector<Integer> result = new Vector<Integer>();
|
||||
|
||||
for (int i = 0; i < this.getModel().getSize(); i++) {
|
||||
if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
|
||||
result.addElement(i);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
Get All Checked Items String of the CheckBoxList component.
|
||||
|
||||
@return Vector
|
||||
**/
|
||||
public Vector<String> getAllCheckedItemsString() {
|
||||
Vector<String> result = new Vector<String>();
|
||||
|
||||
for (int i = 0; i < this.getModel().getSize(); i++) {
|
||||
if (((ICheckBoxListItem) this.getModel().getElementAt(i)).isChecked()) {
|
||||
result.addElement(((ICheckBoxListItem) this.getModel().getElementAt(i)).text);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
Get All Items String of the CheckBoxList component.
|
||||
|
||||
@return Vector
|
||||
**/
|
||||
public Vector<String> getAllItemsString() {
|
||||
Vector<String> result = new Vector<String>();
|
||||
|
||||
for (int i = 0; i < this.getModel().getSize(); i++) {
|
||||
result.addElement(((ICheckBoxListItem) this.getModel().getElementAt(i)).text);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
Set Checked status for all input items.
|
||||
|
||||
**/
|
||||
public void initCheckedItem(boolean bool, Vector<String> items) {
|
||||
if (items != null && items.size() != 0) {
|
||||
for (int indexI = 0; indexI < items.size(); indexI++) {
|
||||
for (int indexJ = 0; indexJ < model.size(); indexJ++) {
|
||||
if (items.elementAt(indexI).equals(model.getAllElements().elementAt(indexJ).getText())) {
|
||||
ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(indexJ);
|
||||
listItem.setChecked(bool);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.validate();
|
||||
}
|
||||
|
||||
/**
|
||||
Set all items of the compontent checked
|
||||
|
||||
**/
|
||||
public void setAllItemsChecked() {
|
||||
initCheckedItem(true, this.getAllItemsString());
|
||||
}
|
||||
|
||||
/**
|
||||
Set all items of the compontent unchecked
|
||||
|
||||
**/
|
||||
public void setAllItemsUnchecked() {
|
||||
initCheckedItem(false, this.getAllItemsString());
|
||||
}
|
||||
|
||||
/**
|
||||
Remove all items of list
|
||||
|
||||
**/
|
||||
public void removeAllItem() {
|
||||
model.removeAllElements();
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/** @file
|
||||
|
||||
The file is used to create cell renderer for CheckBoxList 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.common.ui.iCheckBoxList;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.*;
|
||||
|
||||
class ICheckBoxListCellRenderer extends JCheckBox implements ListCellRenderer {
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -1718072217181674870L;
|
||||
|
||||
protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
|
||||
|
||||
/**
|
||||
This is the default Constructor
|
||||
|
||||
**/
|
||||
public ICheckBoxListCellRenderer() {
|
||||
super();
|
||||
setOpaque(true);
|
||||
setBorder(noFocusBorder);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
|
||||
* Override to get attribute of the ICheckListCellRenderer
|
||||
*
|
||||
*/
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
ICheckBoxListItem item = (ICheckBoxListItem) value;
|
||||
|
||||
setComponentOrientation(list.getComponentOrientation());
|
||||
|
||||
if (item.isChecked()) {
|
||||
setBackground(list.getSelectionBackground());
|
||||
setForeground(list.getSelectionForeground());
|
||||
} else {
|
||||
if (isSelected) {
|
||||
setBackground(Color.LIGHT_GRAY);
|
||||
setForeground(list.getForeground());
|
||||
} else {
|
||||
setBackground(list.getBackground());
|
||||
setForeground(list.getForeground());
|
||||
}
|
||||
}
|
||||
|
||||
if (value instanceof ICheckBoxListItem) {
|
||||
setText(item.getText());
|
||||
setSelected(item.isChecked());
|
||||
} else {
|
||||
setIcon(null);
|
||||
setText((value == null) ? "" : value.toString());
|
||||
}
|
||||
|
||||
setEnabled(list.isEnabled());
|
||||
setFont(list.getFont());
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/** @file
|
||||
|
||||
The file is used to create list item for CheckBox list
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
|
||||
|
||||
public class ICheckBoxListItem {
|
||||
|
||||
//
|
||||
// Define Class Members
|
||||
//
|
||||
protected String text;
|
||||
|
||||
protected boolean checked;
|
||||
|
||||
/**
|
||||
This is the default constructor to set check box item string
|
||||
|
||||
@param text
|
||||
|
||||
**/
|
||||
public ICheckBoxListItem(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
This is the override constructor to set check box item string and checked status
|
||||
|
||||
@param text
|
||||
@param checked
|
||||
|
||||
**/
|
||||
public ICheckBoxListItem(String text, boolean checked) {
|
||||
this.text = text;
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
/**
|
||||
set the checked status
|
||||
if true, set false
|
||||
if false, set true
|
||||
|
||||
**/
|
||||
public void invertChecked() {
|
||||
checked = !checked;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/** @file
|
||||
|
||||
The file is used to override DefaultListModel to create ICheckBoxListModel
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Vector;
|
||||
|
||||
public class ICheckBoxListModel extends DefaultListModel {
|
||||
///
|
||||
/// Define class Serial Version UID
|
||||
///
|
||||
private static final long serialVersionUID = -8617800969723991017L;
|
||||
|
||||
/**
|
||||
This is the default Constructor for the CheckBoxListModel object
|
||||
|
||||
**/
|
||||
public ICheckBoxListModel() {
|
||||
}
|
||||
|
||||
/**
|
||||
override DefaultListModel's add method
|
||||
|
||||
@param index
|
||||
@param item
|
||||
|
||||
**/
|
||||
public void add(int index, ICheckBoxListItem item) {
|
||||
super.add(index, item);
|
||||
}
|
||||
|
||||
/**
|
||||
Add one item at tail
|
||||
|
||||
@param item
|
||||
|
||||
**/
|
||||
public void addElement(ICheckBoxListItem item) {
|
||||
super.addElement(item);
|
||||
}
|
||||
|
||||
/**
|
||||
Get all elements of the list
|
||||
|
||||
**/
|
||||
public Vector<ICheckBoxListItem> getAllElements() {
|
||||
Vector<ICheckBoxListItem> items = new Vector<ICheckBoxListItem>();
|
||||
ICheckBoxListItem[] objs = new ICheckBoxListItem[this.size()];
|
||||
this.copyInto(objs);
|
||||
for (int i = 0; i < size(); i++) {
|
||||
items.addElement(objs[i]);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
/** @file
|
||||
|
||||
The file is used to create listener for Checkbox List
|
||||
|
||||
Copyright (c) 2006, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
package org.tianocore.frameworkwizard.common.ui.iCheckBoxList;
|
||||
|
||||
import java.awt.event.*;
|
||||
|
||||
class ICheckBoxListener implements MouseListener, KeyListener {
|
||||
|
||||
protected ICheckBoxList iCheckboxlist;
|
||||
|
||||
/**
|
||||
This is the default constructor
|
||||
|
||||
@param parent
|
||||
|
||||
**/
|
||||
public ICheckBoxListener(ICheckBoxList parent) {
|
||||
iCheckboxlist = parent;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
|
||||
* Override to deal with keyReleased event
|
||||
*
|
||||
*
|
||||
*/
|
||||
public void keyReleased(KeyEvent e) {
|
||||
Object[] selectedValues = iCheckboxlist.getSelectedValues();
|
||||
int[] selectedIndices = iCheckboxlist.getSelectedIndices();
|
||||
|
||||
for (int index = 0; index < selectedValues.length; index++) {
|
||||
ICheckBoxListItem item = (ICheckBoxListItem) selectedValues[index];
|
||||
|
||||
if (iCheckboxlist.isEnabled()) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
|
||||
//
|
||||
//if press space key, then reverse all selected item.
|
||||
//
|
||||
item.invertChecked();
|
||||
}
|
||||
((ICheckBoxListModel) iCheckboxlist.getModel()).setElementAt(item, selectedIndices[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
|
||||
* Override to deal with mouse clicked event
|
||||
*
|
||||
*/
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
int index = iCheckboxlist.locationToIndex(e.getPoint());
|
||||
ICheckBoxListItem item = null;
|
||||
item = (ICheckBoxListItem) iCheckboxlist.getModel().getElementAt(index);
|
||||
|
||||
if (item != null && iCheckboxlist.isEnabled()) {
|
||||
item.invertChecked();
|
||||
((ICheckBoxListModel) iCheckboxlist.getModel()).setElementAt(item, index);
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void keyPressed(KeyEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void keyTyped(KeyEvent arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,292 @@
|
||||
/** @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 static void main(String[] args){
|
||||
// try {
|
||||
// JarFile jarFile = new JarFile(new File("C:\\cvswork\\newEdk\\jar.jar.far"));
|
||||
// JarEntry je= jarFile.getJarEntry("MdePkg/MdePkg.spd");
|
||||
// InputStream is = jarFile.getInputStream(je);
|
||||
// byte[] buffer = new byte[1];
|
||||
// File tempFile = new File("C:\\cvswork\\newEdk\\tempFile");
|
||||
// File tfile2 = new File("C:\\cvswork\\newEdk\\tempFile1");
|
||||
// FileOutputStream fos1 = new FileOutputStream(tfile2);
|
||||
// FileOutputStream fos = new FileOutputStream(tempFile);
|
||||
// int size = is.read(buffer);
|
||||
// int totoalSize = size;
|
||||
// while ( size >= 0) {
|
||||
// fos.write(buffer);
|
||||
// size = is.read(buffer);
|
||||
// totoalSize = totoalSize + size;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//// is = jarFile.getInputStream(je);
|
||||
//// is.read(totalbuffer);
|
||||
//// fos.write(totalbuffer);
|
||||
// fos.close();
|
||||
// byte[] totalbuffer = new byte[(int)tempFile.length()];
|
||||
// FileInputStream fis = new FileInputStream(tempFile);
|
||||
// fis.read(totalbuffer);
|
||||
// fos1.write(totalbuffer);
|
||||
// fos1.close();
|
||||
// }catch(Exception e){
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
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.
|
||||
//
|
||||
byte[] buffer = new byte[1];
|
||||
File tempFile = new File("tempFile");
|
||||
FileOutputStream fos = new FileOutputStream(tempFile);
|
||||
int size = entryStream.read(buffer);
|
||||
while (size >= 0) {
|
||||
fos.write(buffer);
|
||||
size = entryStream.read(buffer);
|
||||
}
|
||||
|
||||
fos.close();
|
||||
byte[] totalBuffer = new byte[(int) tempFile.length()];
|
||||
FileInputStream fis = new FileInputStream(tempFile);
|
||||
fis.read(totalBuffer);
|
||||
//
|
||||
// Check Md5
|
||||
//
|
||||
if (!ffItem.getMd5Value().equalsIgnoreCase(FarMd5.md5(totalBuffer))){
|
||||
throw new Exception (ffItem.getRelativeFilename() + " MD5 Checksum is invaild!");
|
||||
}
|
||||
outputStream.write(totalBuffer);
|
||||
fis.close();
|
||||
tempFile.delete();
|
||||
} 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;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/** @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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/** @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 + "]";
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
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);
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/** @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]));
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/** @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;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
/** @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;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
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";
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
|
||||
}
|
@ -0,0 +1,960 @@
|
||||
/** @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;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/** @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);
|
||||
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/** @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);
|
||||
|
||||
}
|
@ -0,0 +1,357 @@
|
||||
/** @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(false);
|
||||
}
|
||||
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() == jButtonPrevious) {
|
||||
stepThree.setVisible(true);
|
||||
this.setVisible(false);
|
||||
} 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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("GUID");
|
||||
// model.addColumn("Version");
|
||||
// model.addColumn("Name");
|
||||
//
|
||||
// jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
// }
|
||||
// if (this.stepThree != null) {
|
||||
// prepareTable();
|
||||
// }
|
||||
// return jTable;
|
||||
// }
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,641 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,295 @@
|
||||
/** @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);
|
||||
stepFour.setVisible(true);
|
||||
} else {
|
||||
stepFour.setVisible(true);
|
||||
}
|
||||
this.setVisible(false);
|
||||
} 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;
|
||||
}
|
||||
}
|
@ -0,0 +1,322 @@
|
||||
/** @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.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 (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;
|
||||
}
|
||||
}
|
@ -0,0 +1,374 @@
|
||||
/** @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();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,351 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,362 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,483 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,315 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,417 @@
|
||||
/** @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;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Identification
|
||||
|
||||
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.module.Identifications.BootModes;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class BootModesIdentification {
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private String name = null;
|
||||
|
||||
private String usage = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
private String help = null;
|
||||
|
||||
public BootModesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.usage = (arg1 == null ? "" : arg1);
|
||||
this.featureFlag = (arg2 == null ? "" : arg2);
|
||||
this.supArchList = arg3;
|
||||
this.help = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(BootModesIdentification pi) {
|
||||
if (this.name.equals(pi.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setHelp(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Vector
|
||||
|
||||
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.module.Identifications.BootModes;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class BootModesVector {
|
||||
|
||||
private Vector<BootModesIdentification> vBootModes = new Vector<BootModesIdentification>();
|
||||
|
||||
public int findBootModes(BootModesIdentification sfi) {
|
||||
for (int index = 0; index < vBootModes.size(); index++) {
|
||||
if (vBootModes.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findBootModes(String name) {
|
||||
for (int index = 0; index < vBootModes.size(); index++) {
|
||||
if (vBootModes.elementAt(index).getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public BootModesIdentification getBootModes(int index) {
|
||||
if (index > -1) {
|
||||
return vBootModes.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addBootModes(BootModesIdentification arg0) {
|
||||
vBootModes.addElement(arg0);
|
||||
}
|
||||
|
||||
public void setBootModes(BootModesIdentification arg0, int arg1) {
|
||||
vBootModes.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeBootModes(BootModesIdentification arg0) {
|
||||
int index = findBootModes(arg0);
|
||||
if (index > -1) {
|
||||
vBootModes.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeBootModes(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vBootModes.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<BootModesIdentification> getvBootModes() {
|
||||
return vBootModes;
|
||||
}
|
||||
|
||||
public void setvBootModes(Vector<BootModesIdentification> BootModes) {
|
||||
vBootModes = BootModes;
|
||||
}
|
||||
|
||||
public Vector<String> getBootModesName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vBootModes.size(); index++) {
|
||||
v.addElement(vBootModes.get(index).getName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vBootModes.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getBootModes(index).getName());
|
||||
v.addElement(getBootModes(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Identification
|
||||
|
||||
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.module.Identifications.DataHubs;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class DataHubsIdentification {
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private String name = null;
|
||||
|
||||
private String usage = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
private String help = null;
|
||||
|
||||
public DataHubsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.usage = (arg1 == null ? "" : arg1);
|
||||
this.featureFlag = (arg2 == null ? "" : arg2);
|
||||
this.supArchList = arg3;
|
||||
this.help = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(DataHubsIdentification pi) {
|
||||
if (this.name.equals(pi.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setHelp(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Vector
|
||||
|
||||
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.module.Identifications.DataHubs;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class DataHubsVector {
|
||||
|
||||
private Vector<DataHubsIdentification> vDataHubs = new Vector<DataHubsIdentification>();
|
||||
|
||||
public int findDataHubs(DataHubsIdentification sfi) {
|
||||
for (int index = 0; index < vDataHubs.size(); index++) {
|
||||
if (vDataHubs.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findDataHubs(String name) {
|
||||
for (int index = 0; index < vDataHubs.size(); index++) {
|
||||
if (vDataHubs.elementAt(index).getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public DataHubsIdentification getDataHubs(int index) {
|
||||
if (index > -1) {
|
||||
return vDataHubs.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addDataHubs(DataHubsIdentification arg0) {
|
||||
vDataHubs.addElement(arg0);
|
||||
}
|
||||
|
||||
public void setDataHubs(DataHubsIdentification arg0, int arg1) {
|
||||
vDataHubs.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeDataHubs(DataHubsIdentification arg0) {
|
||||
int index = findDataHubs(arg0);
|
||||
if (index > -1) {
|
||||
vDataHubs.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeDataHubs(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vDataHubs.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<DataHubsIdentification> getvDataHubs() {
|
||||
return vDataHubs;
|
||||
}
|
||||
|
||||
public void setvDataHubs(Vector<DataHubsIdentification> DataHubs) {
|
||||
vDataHubs = DataHubs;
|
||||
}
|
||||
|
||||
public Vector<String> getDataHubsName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vDataHubs.size(); index++) {
|
||||
v.addElement(vDataHubs.get(index).getName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vDataHubs.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getDataHubs(index).getName());
|
||||
v.addElement(getDataHubs(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Identification
|
||||
|
||||
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.module.Identifications.Events;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class EventsIdentification {
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private String name = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private String usage = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
private String help = null;
|
||||
|
||||
private String group = null;
|
||||
|
||||
public EventsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5, String arg6) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
this.usage = (arg2 == null ? "" : arg2);
|
||||
this.featureFlag = (arg3 == null ? "" : arg3);
|
||||
this.supArchList = arg4;
|
||||
this.help = (arg5 == null ? "" : arg5);
|
||||
this.group = (arg6 == null ? "" : arg6);
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(EventsIdentification pi) {
|
||||
if (this.name.equals(pi.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setHelp(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Vector
|
||||
|
||||
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.module.Identifications.Events;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class EventsVector {
|
||||
|
||||
private Vector<EventsIdentification> vEvents = new Vector<EventsIdentification>();
|
||||
|
||||
public int findEvents(EventsIdentification sfi) {
|
||||
for (int index = 0; index < vEvents.size(); index++) {
|
||||
if (vEvents.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findEvents(String name) {
|
||||
for (int index = 0; index < vEvents.size(); index++) {
|
||||
if (vEvents.elementAt(index).getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public EventsIdentification getEvents(int index) {
|
||||
if (index > -1) {
|
||||
return vEvents.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addEvents(EventsIdentification arg0) {
|
||||
vEvents.addElement(arg0);
|
||||
}
|
||||
|
||||
public void setEvents(EventsIdentification arg0, int arg1) {
|
||||
vEvents.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeEvents(EventsIdentification arg0) {
|
||||
int index = findEvents(arg0);
|
||||
if (index > -1) {
|
||||
vEvents.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeEvents(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vEvents.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<EventsIdentification> getvEvents() {
|
||||
return vEvents;
|
||||
}
|
||||
|
||||
public void setvEvents(Vector<EventsIdentification> Events) {
|
||||
vEvents = Events;
|
||||
}
|
||||
|
||||
public Vector<String> getEventsName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vEvents.size(); index++) {
|
||||
v.addElement(vEvents.get(index).getName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vEvents.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getEvents(index).getName());
|
||||
v.addElement(getEvents(index).getType());
|
||||
v.addElement(getEvents(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Identification
|
||||
|
||||
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.module.Identifications.Externs;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.EnumerationData;
|
||||
|
||||
public class ExternsIdentification {
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private String name0 = null;
|
||||
|
||||
private String name1 = null;
|
||||
|
||||
private String name2 = null;
|
||||
|
||||
private String name3 = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
public ExternsIdentification(String arg0, String arg1) {
|
||||
this.name0 = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
}
|
||||
|
||||
public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4) {
|
||||
this.name0 = (arg0 == null ? "" : arg0);
|
||||
this.name1 = (arg1 == null ? "" : arg1);
|
||||
this.type = (arg2 == null ? "" : arg2);
|
||||
this.featureFlag = (arg3 == null ? "" : arg3);
|
||||
this.supArchList = arg4;
|
||||
}
|
||||
|
||||
public ExternsIdentification(String arg0, String arg1, String arg2, String arg3, String arg4, String arg5,
|
||||
Vector<String> arg6) {
|
||||
this.name0 = (arg0 == null ? "" : arg0);
|
||||
this.name1 = (arg1 == null ? "" : arg1);
|
||||
this.name2 = (arg2 == null ? "" : arg2);
|
||||
this.name3 = (arg3 == null ? "" : arg3);
|
||||
this.type = (arg4 == null ? "" : arg4);
|
||||
this.featureFlag = (arg5 == null ? "" : arg5);
|
||||
this.supArchList = arg6;
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(ExternsIdentification pi) {
|
||||
if (this.type.equals(pi.type)) {
|
||||
if (this.type.equals(EnumerationData.EXTERNS_SPECIFICATION)) {
|
||||
if (this.name0.equals(pi.name0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (this.type.equals(EnumerationData.EXTERNS_IMAGE)) {
|
||||
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (this.type.equals(EnumerationData.EXTERNS_LIBRARY)) {
|
||||
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (this.type.equals(EnumerationData.EXTERNS_CALL_BACK)) {
|
||||
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (this.type.equals(EnumerationData.EXTERNS_DRIVER)) {
|
||||
if (this.name0.equals(pi.name0) && this.name1.equals(pi.name1) && this.name2.equals(pi.name2) && this.name3.equals(pi.name3)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName0() {
|
||||
return name0;
|
||||
}
|
||||
|
||||
public void setName0(String name0) {
|
||||
this.name0 = name0;
|
||||
}
|
||||
|
||||
public String getName1() {
|
||||
return name1;
|
||||
}
|
||||
|
||||
public void setName1(String name1) {
|
||||
this.name1 = name1;
|
||||
}
|
||||
|
||||
public String getName2() {
|
||||
return name2;
|
||||
}
|
||||
|
||||
public void setName2(String name2) {
|
||||
this.name2 = name2;
|
||||
}
|
||||
|
||||
public String getName3() {
|
||||
return name3;
|
||||
}
|
||||
|
||||
public void setName3(String name3) {
|
||||
this.name3 = name3;
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Vector
|
||||
|
||||
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.module.Identifications.Externs;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.tianocore.frameworkwizard.common.DataType;
|
||||
import org.tianocore.frameworkwizard.common.EnumerationData;
|
||||
|
||||
public class ExternsVector {
|
||||
|
||||
private Vector<ExternsIdentification> vExterns = new Vector<ExternsIdentification>();
|
||||
|
||||
public int findExterns(ExternsIdentification sfi) {
|
||||
for (int index = 0; index < vExterns.size(); index++) {
|
||||
if (vExterns.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ExternsIdentification getExterns(int index) {
|
||||
if (index > -1) {
|
||||
return vExterns.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addExterns(ExternsIdentification arg0) {
|
||||
vExterns.addElement(arg0);
|
||||
}
|
||||
|
||||
public void setExterns(ExternsIdentification arg0, int arg1) {
|
||||
vExterns.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeExterns(ExternsIdentification arg0) {
|
||||
int index = findExterns(arg0);
|
||||
if (index > -1) {
|
||||
vExterns.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeExterns(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vExterns.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<ExternsIdentification> getvExterns() {
|
||||
return vExterns;
|
||||
}
|
||||
|
||||
public void setvExterns(Vector<ExternsIdentification> Externs) {
|
||||
vExterns = Externs;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vExterns.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
|
||||
//
|
||||
// For Specification
|
||||
//
|
||||
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_SPECIFICATION)) {
|
||||
v.addElement(getExterns(index).getType());
|
||||
v.addElement(getExterns(index).getType() + " Name");
|
||||
v.addElement(getExterns(index).getName0());
|
||||
return v;
|
||||
}
|
||||
|
||||
//
|
||||
// For Image
|
||||
//
|
||||
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_IMAGE)) {
|
||||
v.addElement(getExterns(index).getType());
|
||||
String name = "";
|
||||
String value = "";
|
||||
|
||||
name = EnumerationData.EXTERNS_MODULE_ENTRY_POINT;
|
||||
value = this.getExterns(index).getName0();
|
||||
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_MODULE_UNLOAD_IMAGE;
|
||||
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
|
||||
+ DataType.HTML_LINE_SEPARATOR;
|
||||
|
||||
v.addElement("<html>" + name + "<html>");
|
||||
v.addElement("<html>" + value + "<html>");
|
||||
return v;
|
||||
}
|
||||
|
||||
//
|
||||
// For Library
|
||||
//
|
||||
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_LIBRARY)) {
|
||||
v.addElement(getExterns(index).getType());
|
||||
String name = "";
|
||||
String value = "";
|
||||
|
||||
name = EnumerationData.EXTERNS_CONSTRUCTOR;
|
||||
value = this.getExterns(index).getName0();
|
||||
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DESTRUCTOR;
|
||||
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
|
||||
+ DataType.HTML_LINE_SEPARATOR;
|
||||
|
||||
v.addElement("<html>" + name + "<html>");
|
||||
v.addElement("<html>" + value + "<html>");
|
||||
return v;
|
||||
}
|
||||
|
||||
//
|
||||
// For Driver
|
||||
//
|
||||
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_DRIVER)) {
|
||||
v.addElement(getExterns(index).getType());
|
||||
String name = "";
|
||||
String value = "";
|
||||
|
||||
name = EnumerationData.EXTERNS_DRIVER_BINDING;
|
||||
value = this.getExterns(index).getName0();
|
||||
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_COMPONENT_NAME;
|
||||
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1();
|
||||
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_CONFIG;
|
||||
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName2();
|
||||
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_DRIVER_DIAG;
|
||||
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName3()
|
||||
+ DataType.HTML_LINE_SEPARATOR;
|
||||
|
||||
v.addElement("<html>" + name + "<html>");
|
||||
v.addElement("<html>" + value + "<html>");
|
||||
return v;
|
||||
}
|
||||
|
||||
//
|
||||
// For Call Back
|
||||
//
|
||||
if (this.getExterns(index).getType().equals(EnumerationData.EXTERNS_CALL_BACK)) {
|
||||
v.addElement(getExterns(index).getType());
|
||||
String name = "";
|
||||
String value = "";
|
||||
|
||||
name = EnumerationData.EXTERNS_VIRTUAL_ADDRESS_MAP_CALL_BACK;
|
||||
value = this.getExterns(index).getName0();
|
||||
name = name + DataType.HTML_LINE_SEPARATOR + EnumerationData.EXTERNS_EXIT_BOOT_SERVICES_CALL_BACK;
|
||||
value = value + DataType.HTML_LINE_SEPARATOR + this.getExterns(index).getName1()
|
||||
+ DataType.HTML_LINE_SEPARATOR;
|
||||
|
||||
v.addElement("<html>" + name + "<html>");
|
||||
v.addElement("<html>" + value + "<html>");
|
||||
return v;
|
||||
}
|
||||
|
||||
//
|
||||
// Return a empty v
|
||||
//
|
||||
return v;
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Identification
|
||||
|
||||
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.module.Identifications.Guids;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
public class GuidsIdentification {
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private String name = null;
|
||||
|
||||
private String usage = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
private String help = null;
|
||||
|
||||
private ModuleIdentification belongModule = null;
|
||||
|
||||
private PackageIdentification declaredBy = null;
|
||||
|
||||
public GuidsIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.usage = (arg1 == null ? "" : arg1);
|
||||
this.featureFlag = (arg2 == null ? "" : arg2);
|
||||
this.supArchList = arg3;
|
||||
this.help = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(GuidsIdentification pi) {
|
||||
if (this.name.equals(pi.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setHelp(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
|
||||
public ModuleIdentification getBelongModule() {
|
||||
return belongModule;
|
||||
}
|
||||
|
||||
public void setBelongModule(ModuleIdentification belongModule) {
|
||||
this.belongModule = belongModule;
|
||||
}
|
||||
|
||||
public PackageIdentification getDeclaredBy() {
|
||||
return declaredBy;
|
||||
}
|
||||
|
||||
public void setDeclaredBy(PackageIdentification declaredBy) {
|
||||
this.declaredBy = declaredBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Vector
|
||||
|
||||
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.module.Identifications.Guids;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuidsVector {
|
||||
|
||||
private Vector<GuidsIdentification> vGuids = new Vector<GuidsIdentification>();
|
||||
|
||||
public int findGuids(GuidsIdentification sfi) {
|
||||
for (int index = 0; index < vGuids.size(); index++) {
|
||||
if (vGuids.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findGuids(String name) {
|
||||
for (int index = 0; index < vGuids.size(); index++) {
|
||||
if (vGuids.elementAt(index).getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public GuidsIdentification getGuids(int index) {
|
||||
if (index > -1) {
|
||||
return vGuids.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addGuids(GuidsIdentification arg0) {
|
||||
vGuids.addElement(arg0);
|
||||
}
|
||||
|
||||
public void setGuids(GuidsIdentification arg0, int arg1) {
|
||||
vGuids.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeGuids(GuidsIdentification arg0) {
|
||||
int index = findGuids(arg0);
|
||||
if (index > -1) {
|
||||
vGuids.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeGuids(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vGuids.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<GuidsIdentification> getvGuids() {
|
||||
return vGuids;
|
||||
}
|
||||
|
||||
public void setvGuids(Vector<GuidsIdentification> Guids) {
|
||||
vGuids = Guids;
|
||||
}
|
||||
|
||||
public Vector<String> getGuidsName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vGuids.size(); index++) {
|
||||
v.addElement(vGuids.get(index).getName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vGuids.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getGuids(index).getName());
|
||||
v.addElement(getGuids(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Identification
|
||||
|
||||
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.module.Identifications.HiiPackages;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class HiiPackagesIdentification {
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private String name = null;
|
||||
|
||||
private String usage = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
private String help = null;
|
||||
|
||||
public HiiPackagesIdentification(String arg0, String arg1, String arg2, Vector<String> arg3, String arg4) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.usage = (arg1 == null ? "" : arg1);
|
||||
this.featureFlag = (arg2 == null ? "" : arg2);
|
||||
this.supArchList = arg3;
|
||||
this.help = (arg4 == null ? "" : arg4);
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(HiiPackagesIdentification pi) {
|
||||
if (this.name.equals(pi.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setHelp(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Vector
|
||||
|
||||
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.module.Identifications.HiiPackages;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class HiiPackagesVector {
|
||||
|
||||
private Vector<HiiPackagesIdentification> vHiiPackages = new Vector<HiiPackagesIdentification>();
|
||||
|
||||
public int findHiiPackages(HiiPackagesIdentification sfi) {
|
||||
for (int index = 0; index < vHiiPackages.size(); index++) {
|
||||
if (vHiiPackages.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findHiiPackages(String name) {
|
||||
for (int index = 0; index < vHiiPackages.size(); index++) {
|
||||
if (vHiiPackages.elementAt(index).getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public HiiPackagesIdentification getHiiPackages(int index) {
|
||||
if (index > -1) {
|
||||
return vHiiPackages.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addHiiPackages(HiiPackagesIdentification arg0) {
|
||||
vHiiPackages.addElement(arg0);
|
||||
}
|
||||
|
||||
public void setHiiPackages(HiiPackagesIdentification arg0, int arg1) {
|
||||
vHiiPackages.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeHiiPackages(HiiPackagesIdentification arg0) {
|
||||
int index = findHiiPackages(arg0);
|
||||
if (index > -1) {
|
||||
vHiiPackages.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeHiiPackages(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vHiiPackages.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<HiiPackagesIdentification> getvHiiPackages() {
|
||||
return vHiiPackages;
|
||||
}
|
||||
|
||||
public void setvHiiPackages(Vector<HiiPackagesIdentification> HiiPackages) {
|
||||
vHiiPackages = HiiPackages;
|
||||
}
|
||||
|
||||
public Vector<String> getHiiPackagesName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vHiiPackages.size(); index++) {
|
||||
v.addElement(vHiiPackages.get(index).getName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vHiiPackages.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getHiiPackages(index).getName());
|
||||
v.addElement(getHiiPackages(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Identification
|
||||
|
||||
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.module.Identifications.Hobs;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class HobsIdentification {
|
||||
|
||||
//
|
||||
// Define class members
|
||||
//
|
||||
private String name = null;
|
||||
|
||||
private String type = null;
|
||||
|
||||
private String usage = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
private String help = null;
|
||||
|
||||
public HobsIdentification(String arg0, String arg1, String arg2, String arg3, Vector<String> arg4, String arg5) {
|
||||
this.name = (arg0 == null ? "" : arg0);
|
||||
this.type = (arg1 == null ? "" : arg1);
|
||||
this.usage = (arg2 == null ? "" : arg2);
|
||||
this.featureFlag = (arg3 == null ? "" : arg3);
|
||||
this.supArchList = arg4;
|
||||
this.help = (arg5 == null ? "" : arg5);
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(HobsIdentification pi) {
|
||||
if (this.name.equals(pi.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setHelp(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Package Dependencies Vector
|
||||
|
||||
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.module.Identifications.Hobs;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
public class HobsVector {
|
||||
|
||||
private Vector<HobsIdentification> vHobs = new Vector<HobsIdentification>();
|
||||
|
||||
public int findHobs(HobsIdentification sfi) {
|
||||
for (int index = 0; index < vHobs.size(); index++) {
|
||||
if (vHobs.elementAt(index).equals(sfi)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int findHobs(String name) {
|
||||
for (int index = 0; index < vHobs.size(); index++) {
|
||||
if (vHobs.elementAt(index).getName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public HobsIdentification getHobs(int index) {
|
||||
if (index > -1) {
|
||||
return vHobs.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addHobs(HobsIdentification arg0) {
|
||||
vHobs.addElement(arg0);
|
||||
}
|
||||
|
||||
public void setHobs(HobsIdentification arg0, int arg1) {
|
||||
vHobs.setElementAt(arg0, arg1);
|
||||
}
|
||||
|
||||
public void removeHobs(HobsIdentification arg0) {
|
||||
int index = findHobs(arg0);
|
||||
if (index > -1) {
|
||||
vHobs.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeHobs(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vHobs.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<HobsIdentification> getvHobs() {
|
||||
return vHobs;
|
||||
}
|
||||
|
||||
public void setvHobs(Vector<HobsIdentification> Hobs) {
|
||||
vHobs = Hobs;
|
||||
}
|
||||
|
||||
public Vector<String> getHobsName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vHobs.size(); index++) {
|
||||
v.addElement(vHobs.get(index).getName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vHobs.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getHobs(index).getName());
|
||||
v.addElement(getHobs(index).getType());
|
||||
v.addElement(getHobs(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Library Class Identification
|
||||
|
||||
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.module.Identifications.LibraryClass;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
|
||||
public class LibraryClassIdentification {
|
||||
private String libraryClassName = null;
|
||||
|
||||
private String usage = null;
|
||||
|
||||
private String recommendedInstanceVersion = null;
|
||||
|
||||
private String recommendedInstanceGuid = null;
|
||||
|
||||
private Vector<String> supArchList = null;
|
||||
|
||||
private String featureFlag = null;
|
||||
|
||||
private Vector<String> supModuleList = null;
|
||||
|
||||
private String help = null;
|
||||
|
||||
private ModuleIdentification belongModule = null;
|
||||
|
||||
private PackageIdentification declaredBy = null;
|
||||
|
||||
public LibraryClassIdentification() {
|
||||
|
||||
}
|
||||
|
||||
public LibraryClassIdentification(String strName, String strUsage, String strRecommendedInstanceVersion,
|
||||
String strRecommendedInstanceGuid, Vector<String> vSupArchList,
|
||||
String strFeatureFlag, Vector<String> vSupModuleList, String strHelp) {
|
||||
this.libraryClassName = (strName == null ? "" : strName);
|
||||
this.usage = (strUsage == null ? "" : strUsage);
|
||||
this.recommendedInstanceVersion = (strRecommendedInstanceVersion == null ? "" : strRecommendedInstanceVersion);
|
||||
this.recommendedInstanceGuid = (strRecommendedInstanceGuid == null ? "" : strRecommendedInstanceGuid);
|
||||
this.supArchList = vSupArchList;
|
||||
this.featureFlag = (strFeatureFlag == null ? "" : strFeatureFlag);
|
||||
this.supModuleList = vSupModuleList;
|
||||
this.help = (strHelp == null ? "" : strHelp);
|
||||
}
|
||||
|
||||
public String getLibraryClassName() {
|
||||
return libraryClassName;
|
||||
}
|
||||
|
||||
public void setLibraryClassName(String libraryClassName) {
|
||||
this.libraryClassName = libraryClassName;
|
||||
}
|
||||
|
||||
public String getUsage() {
|
||||
return usage;
|
||||
}
|
||||
|
||||
public void setUsage(String usage) {
|
||||
this.usage = usage;
|
||||
}
|
||||
|
||||
public String getFeatureFlag() {
|
||||
return featureFlag;
|
||||
}
|
||||
|
||||
public void setFeatureFlag(String featureFlag) {
|
||||
this.featureFlag = featureFlag;
|
||||
}
|
||||
|
||||
public String getRecommendedInstanceGuid() {
|
||||
return recommendedInstanceGuid;
|
||||
}
|
||||
|
||||
public void setRecommendedInstanceGuid(String recommendedInstanceGuid) {
|
||||
this.recommendedInstanceGuid = recommendedInstanceGuid;
|
||||
}
|
||||
|
||||
public String getRecommendedInstanceVersion() {
|
||||
return recommendedInstanceVersion;
|
||||
}
|
||||
|
||||
public void setRecommendedInstanceVersion(String recommendedInstanceVersion) {
|
||||
this.recommendedInstanceVersion = recommendedInstanceVersion;
|
||||
}
|
||||
|
||||
public Vector<String> getSupArchList() {
|
||||
return supArchList;
|
||||
}
|
||||
|
||||
public void setSupArchList(Vector<String> supArchList) {
|
||||
this.supArchList = supArchList;
|
||||
}
|
||||
|
||||
public boolean equals(LibraryClassIdentification lib) {
|
||||
if (this.libraryClassName.equals(lib.libraryClassName) && this.usage.equals(lib.getUsage())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Vector<String> getSupModuleList() {
|
||||
return supModuleList;
|
||||
}
|
||||
|
||||
public void setSupModuleList(Vector<String> supModuleList) {
|
||||
this.supModuleList = supModuleList;
|
||||
}
|
||||
|
||||
public String getHelp() {
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setHelp(String help) {
|
||||
this.help = help;
|
||||
}
|
||||
|
||||
public ModuleIdentification getBelongModule() {
|
||||
return belongModule;
|
||||
}
|
||||
|
||||
public void setBelongModule(ModuleIdentification belongModule) {
|
||||
this.belongModule = belongModule;
|
||||
}
|
||||
|
||||
public PackageIdentification getDeclaredBy() {
|
||||
return declaredBy;
|
||||
}
|
||||
|
||||
public void setDeclaredBy(PackageIdentification declaredBy) {
|
||||
this.declaredBy = declaredBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/** @file
|
||||
|
||||
The file is used to define Library Class Vector
|
||||
|
||||
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.module.Identifications.LibraryClass;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
|
||||
public class LibraryClassVector {
|
||||
private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();
|
||||
|
||||
public int findLibraryClass(LibraryClassIdentification lib) {
|
||||
return findLibraryClass(lib.getLibraryClassName());
|
||||
}
|
||||
|
||||
public int findLibraryClass(String name) {
|
||||
for (int index = 0; index < vLibraryClass.size(); index++) {
|
||||
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public LibraryClassIdentification getLibraryClass(int index) {
|
||||
if (index > -1) {
|
||||
return vLibraryClass.elementAt(index);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addLibraryClass(LibraryClassIdentification lib) {
|
||||
if (findLibraryClass(lib) == -1) {
|
||||
vLibraryClass.addElement(lib);
|
||||
}
|
||||
}
|
||||
|
||||
public void setLibraryClass(LibraryClassIdentification lib, int index) {
|
||||
vLibraryClass.setElementAt(lib, index);
|
||||
}
|
||||
|
||||
public void removeLibraryClass(LibraryClassIdentification lib) {
|
||||
int index = findLibraryClass(lib);
|
||||
if (index > -1) {
|
||||
vLibraryClass.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeLibraryClass(int index) {
|
||||
if (index > -1 && index < this.size()) {
|
||||
vLibraryClass.removeElementAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
public Vector<LibraryClassIdentification> getVLibraryClass() {
|
||||
return vLibraryClass;
|
||||
}
|
||||
|
||||
public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
|
||||
vLibraryClass = libraryClass;
|
||||
}
|
||||
|
||||
public Vector<String> getLibraryClassName() {
|
||||
Vector<String> v = new Vector<String>();
|
||||
for (int index = 0; index < this.vLibraryClass.size(); index++) {
|
||||
v.addElement(vLibraryClass.get(index).getLibraryClassName());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vLibraryClass.size();
|
||||
}
|
||||
|
||||
public Vector<String> toStringVector(int index) {
|
||||
Vector<String> v = new Vector<String>();
|
||||
v.addElement(getLibraryClass(index).getLibraryClassName());
|
||||
v.addElement(getLibraryClass(index).getUsage());
|
||||
return v;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user