X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2FFrameworkWizardUI.java;h=ec826817da5bb652eec8e6cd76e1a5eecde8a2bc;hp=6041472c5fd77ce3d003239741e1b0801dd057af;hb=dbf5dd75da639461456ce96ea48c0f73a1d071cc;hpb=3c0192d429986cdd5701cdfb038fe703b04774a3 diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index 6041472c5f..ec826817da 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -17,7 +17,6 @@ package org.tianocore.frameworkwizard; import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.WindowEvent; @@ -44,22 +43,18 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import org.apache.xmlbeans.XmlException; -import org.tianocore.ModuleSurfaceAreaDocument; import org.tianocore.PackageSurfaceAreaDocument; -import org.tianocore.PlatformSurfaceAreaDocument; import org.tianocore.frameworkwizard.common.DataType; +import org.tianocore.frameworkwizard.common.GlobalData; import org.tianocore.frameworkwizard.common.IFileFilter; import org.tianocore.frameworkwizard.common.Log; -import org.tianocore.frameworkwizard.common.OpenFile; import org.tianocore.frameworkwizard.common.SaveFile; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Identifications.Identification; -import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleList; import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType; -import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageList; import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType; -import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformList; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; +//import org.tianocore.frameworkwizard.common.find.FindPPIsResult; import org.tianocore.frameworkwizard.common.ui.IDefaultMutableTreeNode; import org.tianocore.frameworkwizard.common.ui.IDesktopManager; import org.tianocore.frameworkwizard.common.ui.IFrame; @@ -71,7 +66,6 @@ import org.tianocore.frameworkwizard.far.updateui.UpdateStepOne; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import org.tianocore.frameworkwizard.module.ui.ModuleBootModes; import org.tianocore.frameworkwizard.module.ui.ModuleDataHubs; -import org.tianocore.frameworkwizard.module.ui.ModuleDefinitions; import org.tianocore.frameworkwizard.module.ui.ModuleEvents; import org.tianocore.frameworkwizard.module.ui.ModuleExterns; import org.tianocore.frameworkwizard.module.ui.ModuleGuids; @@ -105,34 +99,22 @@ import org.tianocore.frameworkwizard.platform.ui.FpdPlatformDefs; import org.tianocore.frameworkwizard.workspace.Workspace; import org.tianocore.frameworkwizard.workspace.WorkspaceTools; import org.tianocore.frameworkwizard.workspace.ui.SwitchWorkspace; +import org.tianocore.frameworkwizard.toolchain.Preferences; /** The class is used to show main GUI of FrameworkWizard It extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener and MenuListener **/ -public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSelectionListener, ComponentListener, - MenuListener { +public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSelectionListener, MenuListener { /// /// Define class Serial Version UID /// private static final long serialVersionUID = -7103240960573031772L; /// - /// Used to save information of all files + /// Used to record current operation target /// - private Vector vModuleList = new Vector(); - - private Vector vPackageList = new Vector(); - - private Vector vPlatformList = new Vector(); - - private OpeningModuleList openingModuleList = new OpeningModuleList(); - - private OpeningPackageList openingPackageList = new OpeningPackageList(); - - private OpeningPlatformList openingPlatformList = new OpeningPlatformList(); - private int currentOpeningModuleIndex = -1; private int currentOpeningPackageIndex = -1; @@ -235,8 +217,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private JMenuItem jMenuItemEditSelectAll = null; - private JMenuItem jMenuItemEditFind = null; - private JMenuItem jMenuItemEditFindNext = null; private JMenu jMenuView = null; @@ -259,11 +239,11 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private JMenuItem jMenuItemProjectChangeWorkspace = null; - private JMenu jMenuProjectBuildTargets = null; + private JMenuItem jMenuItemToolsBuildPreferences = null; - private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null; +// private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsDebug = null; - private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null; +// private JCheckBoxMenuItem jCheckBoxMenuItemProjectBuildTargetsRelease = null; private JMenuItem jMenuItemToolsToolChainConfiguration = null; @@ -299,6 +279,20 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private JMenuItem jMenuItemProjectCreateFar = null; + private JMenu jMenuEditFind = null; + + private JMenuItem jMenuItemEditFindPcd = null; + + private JMenuItem jMenuItemEditFindLibraryClass = null; + + private JMenuItem jMenuItemEditFindPpi = null; + + private JMenuItem jMenuItemEditFindProtocol = null; + + private JMenuItem jMenuItemEditFindGuid = null; + + private JMenuItem jMenuItemEditFindLibraryInstance = null; + /// /// A static definition for this class itself /// @@ -495,18 +489,18 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // jMenuEdit.add(getJMenuItemEditUndo()); jMenuEdit.add(getJMenuItemEditRedo()); - jMenuEdit.addSeparator(); + //jMenuEdit.addSeparator(); jMenuEdit.add(getJMenuItemEditCut()); jMenuEdit.add(getJMenuItemEditCopy()); jMenuEdit.add(getJMenuItemEditPaste()); jMenuEdit.add(getJMenuItemEditDelete()); - jMenuEdit.addSeparator(); + //jMenuEdit.addSeparator(); jMenuEdit.add(getJMenuItemEditSelectAll()); - jMenuEdit.add(getJMenuItemEditFind()); + jMenuEdit.add(getJMenuEditFind()); jMenuEdit.add(getJMenuItemEditFindNext()); - jMenuEdit.addSeparator(); + //jMenuEdit.addSeparator(); } return jMenuEdit; } @@ -672,6 +666,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditDelete = new JMenuItem(); jMenuItemEditDelete.setText("Delete"); jMenuItemEditDelete.setMnemonic('D'); + jMenuItemEditDelete.setVisible(false); + jMenuItemEditDelete.setEnabled(false); jMenuItemEditDelete.addActionListener(this); // //Disabled first when no module is open @@ -751,11 +747,13 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Add sub menu items // - jMenuTools.add(getJMenuItemToolsToolChainConfiguration()); - jMenuTools.addSeparator(); jMenuTools.add(getJMenuItemToolsClone()); jMenuTools.add(getJMenuItemToolsCodeScan()); + jMenuTools.addSeparator(); + + jMenuTools.add(getJMenuItemToolsToolChainConfiguration()); + jMenuTools.add(getJMenuItemToolsBuildPreferences()); } return jMenuTools; } @@ -1003,6 +1001,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditUndo.setText("Undo"); jMenuItemEditUndo.setMnemonic('U'); jMenuItemEditUndo.setEnabled(false); + jMenuItemEditUndo.setVisible(false); jMenuItemEditUndo.addActionListener(this); } return jMenuItemEditUndo; @@ -1020,6 +1019,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditRedo.setText("Redo"); jMenuItemEditRedo.setMnemonic('R'); jMenuItemEditRedo.setEnabled(false); + jMenuItemEditRedo.setVisible(false); jMenuItemEditRedo.addActionListener(this); } return jMenuItemEditRedo; @@ -1037,6 +1037,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditCut.setText("Cut"); jMenuItemEditCut.setMnemonic('t'); jMenuItemEditCut.setEnabled(false); + jMenuItemEditCut.setVisible(false); jMenuItemEditCut.addActionListener(this); } return jMenuItemEditCut; @@ -1054,6 +1055,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditCopy.setText("Copy"); jMenuItemEditCopy.setMnemonic('C'); jMenuItemEditCopy.setEnabled(false); + jMenuItemEditCopy.setVisible(false); jMenuItemEditCopy.addActionListener(this); } return jMenuItemEditCopy; @@ -1071,6 +1073,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditPaste.setText("Paste"); jMenuItemEditPaste.setMnemonic('P'); jMenuItemEditPaste.setEnabled(false); + jMenuItemEditPaste.setVisible(false); jMenuItemEditPaste.addActionListener(this); } return jMenuItemEditPaste; @@ -1088,28 +1091,12 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditSelectAll.setText("Select All"); jMenuItemEditSelectAll.setMnemonic('A'); jMenuItemEditSelectAll.setEnabled(false); + jMenuItemEditSelectAll.setVisible(false); jMenuItemEditSelectAll.addActionListener(this); } return jMenuItemEditSelectAll; } - /** - This method initializes jMenuItemEditFind - - @return javax.swing.JMenuItem - - **/ - private JMenuItem getJMenuItemEditFind() { - if (jMenuItemEditFind == null) { - jMenuItemEditFind = new JMenuItem(); - jMenuItemEditFind.setText("Find"); - jMenuItemEditFind.setMnemonic('F'); - jMenuItemEditFind.setEnabled(false); - jMenuItemEditFind.addActionListener(this); - } - return jMenuItemEditFind; - } - /** This method initializes jMenuItemEditFindNext @@ -1122,6 +1109,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuItemEditFindNext.setText("Find Next"); jMenuItemEditFindNext.setMnemonic('n'); jMenuItemEditFindNext.setEnabled(false); + jMenuItemEditFindNext.setVisible(false); jMenuItemEditFindNext.addActionListener(this); } return jMenuItemEditFindNext; @@ -1283,7 +1271,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele jMenuProject.add(getJMenuItemProjectUpdateFar()); jMenuProject.add(getJMenuItemProjectRemoveFar()); - jMenuProject.add(getJMenuProjectBuildTargets()); } return jMenuProject; } @@ -1324,52 +1311,20 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } /** - This method initializes jMenuProjectBuildTargets + This method initializes jMenuProjectBuildPreferences @return javax.swing.JMenu **/ - private JMenu getJMenuProjectBuildTargets() { - if (jMenuProjectBuildTargets == null) { - jMenuProjectBuildTargets = new JMenu(); - jMenuProjectBuildTargets.setText("Build Targets"); - jMenuProjectBuildTargets.setMnemonic('T'); - jMenuProjectBuildTargets.setVisible(false); - - jMenuProjectBuildTargets.add(getJCheckBoxMenuItemProjectBuildTargetsDebug()); - jMenuProjectBuildTargets.add(getJCheckBoxMenuItemProjectBuildTargetsRelease()); + private JMenuItem getJMenuItemToolsBuildPreferences() { + if (jMenuItemToolsBuildPreferences == null) { + jMenuItemToolsBuildPreferences = new JMenuItem(); + jMenuItemToolsBuildPreferences.setText("Build Preferences"); + jMenuItemToolsBuildPreferences.setMnemonic('P'); + jMenuItemToolsBuildPreferences.setEnabled(true); + jMenuItemToolsBuildPreferences.addActionListener(this); } - return jMenuProjectBuildTargets; - } - - /** - This method initializes jCheckBoxMenuItemProjectBuildTargetsDebug - - @return javax.swing.JCheckBoxMenuItem - - **/ - private JCheckBoxMenuItem getJCheckBoxMenuItemProjectBuildTargetsDebug() { - if (jCheckBoxMenuItemProjectBuildTargetsDebug == null) { - jCheckBoxMenuItemProjectBuildTargetsDebug = new JCheckBoxMenuItem(); - jCheckBoxMenuItemProjectBuildTargetsDebug.setText("Debug"); - jCheckBoxMenuItemProjectBuildTargetsDebug.setEnabled(false); - } - return jCheckBoxMenuItemProjectBuildTargetsDebug; - } - - /** - This method initializes jCheckBoxMenuItemProjectBuildTargetsRelease - - @return javax.swing.JCheckBoxMenuItem - - **/ - private JCheckBoxMenuItem getJCheckBoxMenuItemProjectBuildTargetsRelease() { - if (jCheckBoxMenuItemProjectBuildTargetsRelease == null) { - jCheckBoxMenuItemProjectBuildTargetsRelease = new JCheckBoxMenuItem(); - jCheckBoxMenuItemProjectBuildTargetsRelease.setText("Release"); - jCheckBoxMenuItemProjectBuildTargetsRelease.setEnabled(false); - } - return jCheckBoxMenuItemProjectBuildTargetsRelease; + return jMenuItemToolsBuildPreferences; } /** @@ -1660,6 +1615,119 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele return jMenuItemProjectCreateFar; } + /** + * This method initializes jMenuEditFind + * + * @return javax.swing.JMenu + */ + private JMenu getJMenuEditFind() { + if (jMenuEditFind == null) { + jMenuEditFind = new JMenu(); + jMenuEditFind.setText("Find"); + jMenuEditFind.setMnemonic('F'); + + jMenuEditFind.add(getJMenuItemEditFindPpi()); + jMenuEditFind.add(getJMenuItemEditFindProtocol()); + jMenuEditFind.add(getJMenuItemEditFindGuid()); + jMenuEditFind.add(getJMenuItemEditFindPcd()); + jMenuEditFind.addSeparator(); + + jMenuEditFind.add(getJMenuItemEditFindLibraryClass()); + jMenuEditFind.add(getJMenuItemEditFindLibraryInstance()); + } + return jMenuEditFind; + } + + /** + * This method initializes jMenuItemEditFindPcd + * + * @return javax.swing.JMenuItem + */ + private JMenuItem getJMenuItemEditFindPcd() { + if (jMenuItemEditFindPcd == null) { + jMenuItemEditFindPcd = new JMenuItem(); + jMenuItemEditFindPcd.setText("All PCD entries"); + jMenuItemEditFindPcd.setMnemonic('P'); + jMenuItemEditFindPcd.addActionListener(this); + } + return jMenuItemEditFindPcd; + } + + /** + * This method initializes jMenuItemEditFindLibraryClass + * + * @return javax.swing.JMenuItem + */ + private JMenuItem getJMenuItemEditFindLibraryClass() { + if (jMenuItemEditFindLibraryClass == null) { + jMenuItemEditFindLibraryClass = new JMenuItem(); + jMenuItemEditFindLibraryClass.setText("All Library Classes"); + jMenuItemEditFindLibraryClass.setMnemonic('C'); + jMenuItemEditFindLibraryClass.addActionListener(this); + } + return jMenuItemEditFindLibraryClass; + } + + /** + * This method initializes jMenuItemEditFindPpi + * + * @return javax.swing.JMenuItem + */ + private JMenuItem getJMenuItemEditFindPpi() { + if (jMenuItemEditFindPpi == null) { + jMenuItemEditFindPpi = new JMenuItem(); + jMenuItemEditFindPpi.setText("All PPIs"); + jMenuItemEditFindPpi.setMnemonic('I'); + jMenuItemEditFindPpi.addActionListener(this); + } + return jMenuItemEditFindPpi; + } + + /** + * This method initializes jMenuItemEditFindProtocol + * + * @return javax.swing.JMenuItem + */ + private JMenuItem getJMenuItemEditFindProtocol() { + if (jMenuItemEditFindProtocol == null) { + jMenuItemEditFindProtocol = new JMenuItem(); + jMenuItemEditFindProtocol.setText("All Protocols"); + jMenuItemEditFindProtocol.setMnemonic('r'); + jMenuItemEditFindProtocol.addActionListener(this); + } + return jMenuItemEditFindProtocol; + } + + /** + * This method initializes jMenuItemEditFindGuid + * + * @return javax.swing.JMenuItem + */ + private JMenuItem getJMenuItemEditFindGuid() { + if (jMenuItemEditFindGuid == null) { + jMenuItemEditFindGuid = new JMenuItem(); + jMenuItemEditFindGuid.setText("All GUIDs"); + jMenuItemEditFindGuid.setMnemonic('G'); + jMenuItemEditFindGuid.addActionListener(this); + } + return jMenuItemEditFindGuid; + } + + /** + * This method initializes jMenuItemEditFindLibraryInstance + * + * @return javax.swing.JMenuItem + */ + private JMenuItem getJMenuItemEditFindLibraryInstance() { + if (jMenuItemEditFindLibraryInstance == null) { + jMenuItemEditFindLibraryInstance = new JMenuItem(); + jMenuItemEditFindLibraryInstance.setText("All Library Instances"); + jMenuItemEditFindLibraryInstance.setMnemonic('n'); + jMenuItemEditFindLibraryInstance.addActionListener(this); + } + return jMenuItemEditFindLibraryInstance; + } + /* (non-Javadoc) * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[]) * @@ -1699,11 +1767,17 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele System.exit(0); } + // + // Init Global Data + // + GlobalData.init(); + + // + // Init the frame + // this.setSize(DataType.MAIN_FRAME_PREFERRED_SIZE_WIDTH, DataType.MAIN_FRAME_PREFERRED_SIZE_HEIGHT); this.setResizable(true); this.setJMenuBar(getjJMenuBar()); - this.addComponentListener(this); - this.getCompontentsFromFrameworkDatabase(); this.setContentPane(getJContentPane()); this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]"); @@ -1741,67 +1815,75 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Operations of Menu // - if (arg0.getSource() == jMenuItemFileNew) { + if (arg0.getSource() == this.jMenuItemFileNew) { this.fileNew(); } - if (arg0.getSource() == jMenuItemFileOpen) { + if (arg0.getSource() == this.jMenuItemFileOpen) { this.open(); } - if (arg0.getSource() == jMenuItemFileClose) { + if (arg0.getSource() == this.jMenuItemFileClose) { this.close(); } - if (arg0.getSource() == jMenuItemFileCloseAll) { + if (arg0.getSource() == this.jMenuItemFileCloseAll) { this.closeAll(); } - if (arg0.getSource() == jMenuItemFileSave) { + if (arg0.getSource() == this.jMenuItemFileSave) { this.save(); } - if (arg0.getSource() == jMenuItemFileSaveAs) { + if (arg0.getSource() == this.jMenuItemFileSaveAs) { this.saveAs(); } - if (arg0.getSource() == jMenuItemFileSaveAll) { + if (arg0.getSource() == this.jMenuItemFileSaveAll) { this.saveAll(); } - if (arg0.getSource() == jMenuItemFileExit) { + if (arg0.getSource() == this.jMenuItemFileExit) { this.exit(); } - if (arg0.getSource() == jMenuItemProjectChangeWorkspace) { - changeWorkspace(); + if (arg0.getSource() == this.jMenuItemEditFindPpi) { +// this.findPpi(); + } + + if (arg0.getSource() == jMenuItemToolsBuildPreferences) { + configBuildPreferences(); + } + + if (arg0.getSource() == this.jMenuItemProjectChangeWorkspace) { + this.changeWorkspace(); } - if (arg0.getSource() == jMenuItemProjectCreateFar) { - createFar(); + if (arg0.getSource() == this.jMenuItemProjectCreateFar) { + this.createFar(); } - if (arg0.getSource() == jMenuItemProjectInstallFar) { - installFar(); + if (arg0.getSource() == this.jMenuItemProjectInstallFar) { + this.installFar(); } - if (arg0.getSource() == jMenuItemProjectRemoveFar) { - removeFar(); + if (arg0.getSource() == this.jMenuItemProjectRemoveFar) { + this.removeFar(); } - if (arg0.getSource() == jMenuItemProjectUpdateFar) { - updateFar(); + if (arg0.getSource() == this.jMenuItemProjectUpdateFar) { + this.updateFar(); } - if (arg0.getSource() == jMenuItemToolsClone) { - cloneItem(); + if (arg0.getSource() == this.jMenuItemToolsClone) { + this.cloneItem(); } - if (arg0.getSource() == jMenuItemToolsToolChainConfiguration) { - setupToolChainConfiguration(); + if (arg0.getSource() == this.jMenuItemToolsToolChainConfiguration) { + this.setupToolChainConfiguration(); } - if (arg0.getSource() == jMenuItemHelpAbout) { + if (arg0.getSource() == this.jMenuItemHelpAbout) { About a = new About(this, true); int result = a.showDialog(); if (result == DataType.RETURN_TYPE_OK) { @@ -1828,34 +1910,34 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // First add package // - if (this.vPackageList.size() > 0) { - for (int index = 0; index < this.vPackageList.size(); index++) { + if (GlobalData.vPackageList.size() > 0) { + for (int index = 0; index < GlobalData.vPackageList.size(); index++) { IDefaultMutableTreeNode dmtnModulePackage = null; IDefaultMutableTreeNode dmtnModulePackageLibrary = null; IDefaultMutableTreeNode dmtnModulePackageModule = null; - dmtnModulePackage = new IDefaultMutableTreeNode(this.vPackageList.elementAt(index).getName(), + dmtnModulePackage = new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index).getName(), IDefaultMutableTreeNode.MODULE_PACKAGE, false, - this.vPackageList.elementAt(index)); + GlobalData.vPackageList.elementAt(index)); dmtnModulePackageLibrary = new IDefaultMutableTreeNode("Library", IDefaultMutableTreeNode.MODULE_PACKAGE_LIBRARY, - false, this.vPackageList.elementAt(index)); + false, GlobalData.vPackageList.elementAt(index)); dmtnModulePackageModule = new IDefaultMutableTreeNode("Module", IDefaultMutableTreeNode.MODULE_PACKAGE_MODULE, - false, this.vPackageList.elementAt(index)); + false, GlobalData.vPackageList.elementAt(index)); // // And then add each module in its package // - Vector vModule = wt.getAllModules(this.vPackageList.elementAt(index)); + Vector vModule = wt.getAllModules(GlobalData.vPackageList.elementAt(index)); for (int indexJ = 0; indexJ < vModule.size(); indexJ++) { if (vModule.get(indexJ).isLibrary()) { dmtnModulePackageLibrary.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(), - IDefaultMutableTreeNode.MODULE, - false, vModule.get(indexJ))); + IDefaultMutableTreeNode.MODULE, false, + vModule.get(indexJ))); } else { dmtnModulePackageModule.add(new IDefaultMutableTreeNode(vModule.get(indexJ).getName(), - IDefaultMutableTreeNode.MODULE, - false, vModule.get(indexJ))); + IDefaultMutableTreeNode.MODULE, false, + vModule.get(indexJ))); } } if (dmtnModulePackageModule.getChildCount() > 0) { @@ -1873,11 +1955,12 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // Make Package Description // dmtnPackageDescription = new IDefaultMutableTreeNode("PackageDescription", IDefaultMutableTreeNode.PACKAGE, -1); - if (this.vPackageList.size() > 0) { - for (int index = 0; index < this.vPackageList.size(); index++) { - dmtnPackageDescription.add(new IDefaultMutableTreeNode(this.vPackageList.elementAt(index).getName(), + if (GlobalData.vPackageList.size() > 0) { + for (int index = 0; index < GlobalData.vPackageList.size(); index++) { + dmtnPackageDescription.add(new IDefaultMutableTreeNode(GlobalData.vPackageList.elementAt(index) + .getName(), IDefaultMutableTreeNode.PACKAGE, false, - this.vPackageList.elementAt(index))); + GlobalData.vPackageList.elementAt(index))); } } @@ -1886,11 +1969,12 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // dmtnPlatformDescription = new IDefaultMutableTreeNode("PlatformDescription", IDefaultMutableTreeNode.PLATFORM, -1); - if (this.vPlatformList.size() > 0) { - for (int index = 0; index < this.vPlatformList.size(); index++) { - dmtnPlatformDescription.add(new IDefaultMutableTreeNode(this.vPlatformList.elementAt(index).getName(), - IDefaultMutableTreeNode.PLATFORM, - false, this.vPlatformList.elementAt(index))); + if (GlobalData.vPlatformList.size() > 0) { + for (int index = 0; index < GlobalData.vPlatformList.size(); index++) { + dmtnPlatformDescription.add(new IDefaultMutableTreeNode(GlobalData.vPlatformList.elementAt(index) + .getName(), + IDefaultMutableTreeNode.PLATFORM, false, + GlobalData.vPlatformList.elementAt(index))); } } @@ -2023,8 +2107,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Add new MsaHeader node to the tree // - IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MSA_HEADER, - true, mid); + IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(mid.getName(), IDefaultMutableTreeNode.MODULE, true, + mid); // // First find the module belongs to which package // @@ -2083,90 +2167,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } } - /** - Open Module - - @param path input file path - - **/ - private void openModule(String path, ModuleIdentification moduleId) { - ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; - try { - msa = OpenFile.openMsaFile(path); - } catch (IOException e) { - Log.wrn("Open Module Surface Area " + path, e.getMessage()); - Log.err("Open Module Surface Area " + path, e.getMessage()); - return; - } catch (XmlException e) { - Log.wrn("Open Module Surface Area " + path, e.getMessage()); - Log.err("Open Module Surface Area " + path, e.getMessage()); - return; - } catch (Exception e) { - Log.wrn("Open Module Surface Area " + path, "Invalid file type"); - Log.err("Open Module Surface Area " + path, "Invalid file type"); - return; - } - Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(), - msa.getMsaHeader().getVersion(), path); - // - // Generate module id - // - PackageIdentification pid = wt.getPackageIdByModuleId(id); - if (pid != null) { - // - // To judge if the module existed in vModuleList - // If not, add it to vModuleList - // - boolean isFind = false; - for (int index = 0; index < vModuleList.size(); index++) { - if (vModuleList.elementAt(index).equals(id)) { - isFind = true; - break; - } - } - if (!isFind) { - ModuleIdentification mid = new ModuleIdentification(id, pid, moduleId.isLibrary()); - vModuleList.addElement(mid); - addModuleToTree(mid); - } - } else { - // - // The module is not in existing packages - // - Log.err("The module hasn't been added to any package of current workspace!"); - return; - } - - // - // Make the node selected - // - iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id, - IDefaultMutableTreeNode.MODULE))); - // - // Update opening Module list information - // - if (!openingModuleList.existsModule(id)) { - // - // Insert sub node of module - // - insertModuleTreeNode(id); - iTree.getSelectNode().setOpening(true); - - // - // Update opening module list - // - openingModuleList.insertToOpeningModuleList(id, msa); - openingModuleList.setTreePathById(id, iTree.getSelectionPath()); - } - // - // Select msa header node and show it in editor panel - // - iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id, - IDefaultMutableTreeNode.MSA_HEADER))); - showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id)); - this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id); - } - /** Open Module @@ -2174,46 +2174,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void openModule(String path) { - ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null; - try { - msa = OpenFile.openMsaFile(path); - } catch (IOException e) { - Log.wrn("Open Module Surface Area " + path, e.getMessage()); - Log.err("Open Module Surface Area " + path, e.getMessage()); - return; - } catch (XmlException e) { - Log.wrn("Open Module Surface Area " + path, e.getMessage()); - Log.err("Open Module Surface Area " + path, e.getMessage()); - return; - } catch (Exception e) { - Log.wrn("Open Module Surface Area " + path, "Invalid file type"); - Log.err("Open Module Surface Area " + path, "Invalid file type"); - return; - } - Identification id = new Identification(msa.getMsaHeader().getModuleName(), msa.getMsaHeader().getGuidValue(), - msa.getMsaHeader().getVersion(), path); - // - // Generate module id - // - PackageIdentification pid = wt.getPackageIdByModuleId(id); - if (pid != null) { - // - // To judge if the module existed in vModuleList - // If not, add it to vModuleList - // - boolean isFind = false; - for (int index = 0; index < vModuleList.size(); index++) { - if (vModuleList.elementAt(index).equals(id)) { - isFind = true; - break; - } - } - if (!isFind) { - ModuleIdentification mid = new ModuleIdentification(id, pid); - vModuleList.addElement(mid); - addModuleToTree(mid); - } - } else { + ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(path); + if (id == null) { // // The module is not in existing packages // @@ -2229,7 +2191,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Update opening Module list information // - if (!openingModuleList.existsModule(id)) { + if (!GlobalData.openingModuleList.getModuleOpen(id)) { // // Insert sub node of module // @@ -2239,16 +2201,16 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Update opening module list // - openingModuleList.insertToOpeningModuleList(id, msa); - openingModuleList.setTreePathById(id, iTree.getSelectionPath()); + GlobalData.openingModuleList.setModuleOpen(id, true); + GlobalData.openingModuleList.setTreePathById(id, iTree.getSelectionPath()); } // // Select msa header node and show it in editor panel // iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnModuleDescription, id, IDefaultMutableTreeNode.MSA_HEADER))); - showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, openingModuleList.getOpeningModuleById(id)); - this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id); + showModuleElement(IDefaultMutableTreeNode.MSA_HEADER, GlobalData.openingModuleList.getOpeningModuleById(id)); + this.currentOpeningModuleIndex = GlobalData.openingModuleList.findIndexOfListById(id); } /** @@ -2258,38 +2220,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void openPackage(String path) { - PackageSurfaceAreaDocument.PackageSurfaceArea spd = null; - try { - spd = OpenFile.openSpdFile(path); - } catch (IOException e) { - Log.wrn("Open Package Surface Area " + path, e.getMessage()); - Log.err("Open Package Surface Area " + path, e.getMessage()); - return; - } catch (XmlException e) { - Log.wrn("Open Package Surface Area " + path, e.getMessage()); - Log.err("Open Package Surface Area " + path, e.getMessage()); - return; - } catch (Exception e) { - Log.wrn("Open Package Surface Area " + path, "Invalid file type"); - Log.err("Open Package Surface Area " + path, "Invalid file type"); - return; - } - Identification id = new Identification(spd.getSpdHeader().getPackageName(), spd.getSpdHeader().getGuidValue(), - spd.getSpdHeader().getVersion(), path); - // - // To judge if the package existed in vPackageList - // If not, add it to vPackageList - // - boolean isFind = false; - for (int index = 0; index < vPackageList.size(); index++) { - if (vPackageList.elementAt(index).equals(id)) { - isFind = true; - break; - } - } - if (!isFind) { + PackageIdentification id = GlobalData.openingPackageList.getIdByPath(path); + if (id == null) { // - // The module is not in existing packages + // The package is not in current workspace // Log.wrn("Open Package", "The package hasn't been added to current workspace!"); return; @@ -2303,7 +2237,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Update opening package list information // - if (!openingPackageList.existsPackage(id)) { + if (!GlobalData.openingPackageList.getPackageOpen(id)) { // // Insert sub node of module // @@ -2313,16 +2247,16 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Update opening module list // - openingPackageList.insertToOpeningPackageList(id, spd); - openingPackageList.setTreePathById(id, iTree.getSelectionPath()); + GlobalData.openingPackageList.setPackageOpen(id, true); + GlobalData.openingPackageList.setTreePathById(id, iTree.getSelectionPath()); } // // Show spd header in editor panel // iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPackageDescription, id, IDefaultMutableTreeNode.SPD_HEADER))); - showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, openingPackageList.getOpeningPackageById(id)); - this.currentOpeningPackageIndex = openingPackageList.findIndexOfListById(id); + showPackageElement(IDefaultMutableTreeNode.SPD_HEADER, GlobalData.openingPackageList.getOpeningPackageById(id)); + this.currentOpeningPackageIndex = GlobalData.openingPackageList.findIndexOfListById(id); } /** @@ -2332,39 +2266,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void openPlatform(String path) { - PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd = null; - try { - fpd = OpenFile.openFpdFile(path); - } catch (IOException e) { - Log.wrn("Open Platform Surface Area " + path, e.getMessage()); - Log.err("Open Platform Surface Area " + path, e.getMessage()); - return; - } catch (XmlException e) { - Log.wrn("Open Platform Surface Area " + path, e.getMessage()); - Log.err("Open Platform Surface Area " + path, e.getMessage()); - return; - } catch (Exception e) { - Log.wrn("Open Platform Surface Area " + path, "Invalid file type"); - Log.err("Open Platform Surface Area " + path, "Invalid file type"); - return; - } - Identification id = new Identification(fpd.getPlatformHeader().getPlatformName(), fpd.getPlatformHeader() - .getGuidValue(), - fpd.getPlatformHeader().getVersion(), path); - // - // To judge if the platform existed in vPlatformList - // If not, add it to vPlatformList - // - boolean isFind = false; - for (int index = 0; index < vPlatformList.size(); index++) { - if (vPlatformList.elementAt(index).equals(id)) { - isFind = true; - break; - } - } - if (!isFind) { + PlatformIdentification id = GlobalData.openingPlatformList.getIdByPath(path); + if (id == null) { // - // The module is not in existing packages + // The platform is not in current workspace // Log.wrn("Open Platform", "The platform hasn't been added to current workspace!"); return; @@ -2378,7 +2283,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Update opening package list information // - if (!openingPlatformList.existsPlatform(id)) { + if (!GlobalData.openingPlatformList.getPlatformOpen(id)) { // // Insert sub node of module // @@ -2388,16 +2293,17 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Update opening module list // - openingPlatformList.insertToOpeningPlatformList(id, fpd); - openingPlatformList.setTreePathById(id, iTree.getSelectionPath()); + GlobalData.openingPlatformList.setPlatformOpen(id, true); + GlobalData.openingPlatformList.setTreePathById(id, iTree.getSelectionPath()); } // // Show fpd header in editor panel // iTree.setSelectionPath(iTree.getPathOfNode(iTree.getNodeById(this.dmtnPlatformDescription, id, IDefaultMutableTreeNode.FPD_PLATFORMHEADER))); - showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER, openingPlatformList.getOpeningPlatformById(id)); - this.currentOpeningPlatformIndex = openingPlatformList.findIndexOfListById(id); + showPlatformElement(IDefaultMutableTreeNode.FPD_PLATFORMHEADER, + GlobalData.openingPlatformList.getOpeningPlatformById(id)); + this.currentOpeningPlatformIndex = GlobalData.openingPlatformList.findIndexOfListById(id); } /** @@ -2405,7 +2311,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void saveModule(int index) { - OpeningModuleType omt = openingModuleList.getOpeningModuleByIndex(index); + OpeningModuleType omt = GlobalData.openingModuleList.getOpeningModuleByIndex(index); if (omt.isNew()) { if (getNewFilePath(DataType.MODULE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) { return; @@ -2413,8 +2319,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } try { SaveFile.saveMsaFile(omt.getId().getPath(), omt.getXmlMsa()); - openingModuleList.setNew(omt.getId(), false); - openingModuleList.setModuleSaved(omt.getId(), true); + GlobalData.openingModuleList.setNew(omt.getId(), false); + GlobalData.openingModuleList.setModuleSaved(omt.getId(), true); } catch (Exception e) { Log.wrn("Save Module", e.getMessage()); Log.err("Save Module", e.getMessage()); @@ -2426,7 +2332,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void savePackage(int index) { - OpeningPackageType opt = openingPackageList.getOpeningPackageByIndex(index); + OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index); if (opt.isNew()) { if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) { return; @@ -2434,8 +2340,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } try { SaveFile.saveSpdFile(opt.getId().getPath(), opt.getXmlSpd()); - openingPackageList.setNew(opt.getId(), false); - openingPackageList.setPackageSaved(opt.getId(), true); + GlobalData.openingPackageList.setNew(opt.getId(), false); + GlobalData.openingPackageList.setPackageSaved(opt.getId(), true); } catch (Exception e) { Log.wrn("Save Package", e.getMessage()); Log.err("Save Package", e.getMessage()); @@ -2447,7 +2353,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void savePlatform(int index) { - OpeningPlatformType opt = openingPlatformList.getOpeningPlatformByIndex(index); + OpeningPlatformType opt = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index); if (opt.isNew()) { if (getNewFilePath(DataType.PACKAGE_SURFACE_AREA_EXT) != JFileChooser.APPROVE_OPTION) { return; @@ -2455,34 +2361,21 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } try { SaveFile.saveFpdFile(opt.getId().getPath(), opt.getXmlFpd()); - openingPlatformList.setNew(opt.getId(), false); - openingPlatformList.setPlatformSaved(opt.getId(), true); + GlobalData.openingPlatformList.setNew(opt.getId(), false); + GlobalData.openingPlatformList.setPlatformSaved(opt.getId(), true); } catch (Exception e) { Log.wrn("Save Package", e.getMessage()); Log.err("Save Package", e.getMessage()); } } - 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) { - this.jSplitPane.setSize(this.getWidth() - DataType.MAIN_FRAME_WIDTH_SPACING, - this.getHeight() - DataType.MAIN_FRAME_HEIGHT_SPACING); - this.jSplitPane.validate(); - resizeDesktopPanel(); - } - - public void componentShown(ComponentEvent arg0) { - // TODO Auto-generated method stub - + if (this.jSplitPane != null) { + this.jSplitPane.setSize(this.getWidth() - DataType.MAIN_FRAME_WIDTH_SPACING, + this.getHeight() - DataType.MAIN_FRAME_HEIGHT_SPACING); + this.jSplitPane.validate(); + resizeDesktopPanel(); + } } /** @@ -2506,19 +2399,11 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } } - private void getCompontentsFromFrameworkDatabase() { - this.vModuleList = wt.getAllModules(); - this.vPackageList = wt.getAllPackages(); - this.vPlatformList = wt.getAllPlatforms(); - } - private void insertModuleTreeNode(Identification id) { iTree.addNode(new IDefaultMutableTreeNode("Module Header", IDefaultMutableTreeNode.MSA_HEADER, true, id)); - iTree.addNode(new IDefaultMutableTreeNode("Module Definitions", IDefaultMutableTreeNode.MSA_MODULEDEFINITIONS, - true, id)); + iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id)); iTree.addNode(new IDefaultMutableTreeNode("Library Class Definitions", IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS, true, id)); - iTree.addNode(new IDefaultMutableTreeNode("Source Files", IDefaultMutableTreeNode.MSA_SOURCEFILES, true, id)); iTree.addNode(new IDefaultMutableTreeNode("Package Dependencies", IDefaultMutableTreeNode.MSA_PACKAGEDEPENDENCIES, true, id)); iTree.addNode(new IDefaultMutableTreeNode("Protocols", IDefaultMutableTreeNode.MSA_PROTOCOLS, true, id)); @@ -2537,8 +2422,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private void insertPackageTreeNode(Identification id) { iTree.addNode(new IDefaultMutableTreeNode("Package Header", IDefaultMutableTreeNode.SPD_HEADER, true, id)); - iTree.addNode(new IDefaultMutableTreeNode("Package Definitions", - IDefaultMutableTreeNode.SPD_PACKAGEDEFINITIONS, true, id)); iTree.addNode(new IDefaultMutableTreeNode("Library Class Declarations", IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS, true, id)); iTree.addNode(new IDefaultMutableTreeNode("Msa Files", IDefaultMutableTreeNode.SPD_MSAFILES, false, id)); @@ -2580,7 +2463,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele id = iTree.getSelectNode().getId(); intCategory = iTree.getSelectCategory(); isOpen = iTree.getSelectNode().isOpening(); - + if (!isOpen) { // // If the node is not opened yet @@ -2608,27 +2491,38 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele return; } } - + // // Show editor panel // if (intCategory >= IDefaultMutableTreeNode.MSA_HEADER && intCategory < IDefaultMutableTreeNode.SPD_HEADER) { - showModuleElement(intCategory, openingModuleList.getOpeningModuleById(id)); - this.currentOpeningModuleIndex = openingModuleList.findIndexOfListById(id); + showModuleElement(intCategory, + GlobalData.openingModuleList.getOpeningModuleById(new ModuleIdentification(id))); + this.currentOpeningModuleIndex = GlobalData.openingModuleList + .findIndexOfListById(new ModuleIdentification( + id)); } if (intCategory >= IDefaultMutableTreeNode.SPD_HEADER && intCategory < IDefaultMutableTreeNode.FPD_PLATFORMHEADER) { - showPackageElement(intCategory, openingPackageList.getOpeningPackageById(id)); - this.currentOpeningPackageIndex = openingPackageList.findIndexOfListById(id); + showPackageElement(intCategory, + GlobalData.openingPackageList.getOpeningPackageById(new PackageIdentification(id))); + this.currentOpeningPackageIndex = GlobalData.openingPackageList + .findIndexOfListById(new PackageIdentification( + id)); } if (intCategory >= IDefaultMutableTreeNode.FPD_PLATFORMHEADER) { - showPlatformElement(intCategory, openingPlatformList.getOpeningPlatformById(id)); - this.currentOpeningPlatformIndex = openingPlatformList.findIndexOfListById(id); + showPlatformElement( + intCategory, + GlobalData.openingPlatformList + .getOpeningPlatformById(new PlatformIdentification(id))); + this.currentOpeningPlatformIndex = GlobalData.openingPlatformList + .findIndexOfListById(new PlatformIdentification( + id)); } } catch (RuntimeException e) { - Log.log("double click category: " + intCategory); - Log.log("double click id path: " + id); - Log.log("double click exception: " + e.getMessage()); + Log.err("double click category: " + intCategory); + Log.err("double click id path: " + id); + Log.err("double click exception: " + e.getMessage()); } } @@ -2734,10 +2628,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele MsaHeader frmMsaHeader = new MsaHeader(msa); getJDesktopPaneModule().add(frmMsaHeader, 1); break; - case IDefaultMutableTreeNode.MSA_MODULEDEFINITIONS: - ModuleDefinitions frmMd = new ModuleDefinitions(msa); - getJDesktopPaneModule().add(frmMd, 1); - break; case IDefaultMutableTreeNode.MSA_LIBRARYCLASSDEFINITIONS: ModuleLibraryClassDefinitions frmMlcd = new ModuleLibraryClassDefinitions(msa); getJDesktopPaneModule().add(frmMlcd, 1); @@ -2833,26 +2723,47 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele smb.dispose(); return; } else if (result == DataType.RETURN_TYPE_OK) { - PackageSurfaceAreaDocument.PackageSurfaceArea psa = null; - if (this.openingPackageList.existsPackage(smb.getMid().getPackageId())) { - psa = openingPackageList.getPackageSurfaceAreaFromId(smb.getMid().getPackageId()); - } - try { - wt.addModuleToPackage(smb.getMid(), psa); - } catch (IOException e) { - Log.wrn("Upddate MsaFiles of Package", e.getMessage()); - Log.err("Upddate MsaFiles of Package", e.getMessage()); - return; - } catch (XmlException e) { - Log.wrn("Upddate MsaFiles of Package", e.getMessage()); - Log.err("Upddate MsaFiles of Package", e.getMessage()); - return; - } catch (Exception e) { - Log.wrn("Upddate MsaFiles of Package", e.getMessage()); - Log.err("Upddate MsaFiles of Package", e.getMessage()); - return; + ModuleIdentification mid = smb.getMid(); + if (mid != null) { + // + // Update package of workspace first + // + PackageSurfaceAreaDocument.PackageSurfaceArea psa = null; + if (GlobalData.openingPackageList.existsPackage(mid.getPackageId())) { + psa = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()); + } + try { + wt.addModuleToPackage(mid, psa); + } catch (IOException e) { + Log.wrn("Upddate MsaFiles of Package", e.getMessage()); + Log.err("Upddate MsaFiles of Package", e.getMessage()); + return; + } catch (XmlException e) { + Log.wrn("Upddate MsaFiles of Package", e.getMessage()); + Log.err("Upddate MsaFiles of Package", e.getMessage()); + return; + } catch (Exception e) { + Log.wrn("Upddate MsaFiles of Package", e.getMessage()); + Log.err("Upddate MsaFiles of Package", e.getMessage()); + return; + } + + // + // Update Global Data + // + GlobalData.openingModuleList.insertToOpeningModuleList(mid, smb.getMsa()); + GlobalData.vModuleList.addElement(mid); + + // + // Create new node on the tree + // + addModuleToTree(mid); + + // + // Open the node + // + this.openModule(mid.getPath()); } - this.openModule(smb.getMid().getPath(), smb.getMid()); } } else if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) { // @@ -2866,30 +2777,37 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele smb.dispose(); return; } else if (result == DataType.RETURN_TYPE_OK) { - try { - wt.addPackageToDatabase(smb.getPid()); - } catch (Exception e) { - Log.err("addPackageToDatabase", e.getMessage()); - } - vPackageList.addElement(smb.getPid()); + PackageIdentification pid = smb.getPid(); + if (pid != null) { + try { + wt.addPackageToDatabase(smb.getPid()); + } catch (Exception e) { + Log.err("addPackageToDatabase", e.getMessage()); + } - // - // Add to Module Description node - // - IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPackageList.lastElement().getName(), - IDefaultMutableTreeNode.MODULE_PACKAGE, - false, vPackageList.lastElement()); + // + // Update Global Data + // + GlobalData.openingPackageList.insertToOpeningPackageList(pid, smb.getSpd()); + GlobalData.vPackageList.addElement(pid); - iTree.addNode(dmtnModuleDescription, node); + // + // Add to Module Description node + // + IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(pid.getName(), + IDefaultMutableTreeNode.MODULE_PACKAGE, + false, pid); - // - // Add new SpdHeader node to the tree - // - node = new IDefaultMutableTreeNode(vPackageList.lastElement().getName(), - IDefaultMutableTreeNode.SPD_HEADER, true, vPackageList.lastElement()); - iTree.addNode(dmtnPackageDescription, node); + iTree.addNode(dmtnModuleDescription, node); + + // + // Add new SpdHeader node to the tree + // + node = new IDefaultMutableTreeNode(pid.getName(), IDefaultMutableTreeNode.PACKAGE, true, pid); + iTree.addNode(dmtnPackageDescription, node); - this.openPackage(smb.getPid().getPath()); + this.openPackage(pid.getPath()); + } } } else if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) { // @@ -2903,20 +2821,28 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele smb.dispose(); return; } else if (result == DataType.RETURN_TYPE_OK) { - try { - wt.addPlatformToDatabase(smb.getFid()); - } catch (Exception e) { - Log.err("addPlatformToDatabase", e.getMessage()); + PlatformIdentification fid = smb.getFid(); + if (fid != null) { + try { + wt.addPlatformToDatabase(fid); + } catch (Exception e) { + Log.err("addPlatformToDatabase", e.getMessage()); + } + + // + // Update global data + // + GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, smb.getFpd()); + GlobalData.vPlatformList.addElement(fid); + // + // Add new SpdHeader node to the tree + // + IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(fid.getName(), + IDefaultMutableTreeNode.PLATFORM, true, + fid); + iTree.addNode(dmtnPlatformDescription, node); + this.openPlatform(fid.getPath()); } - vPlatformList.addElement(smb.getFid()); - // - // Add new SpdHeader node to the tree - // - IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPlatformList.lastElement().getName(), - IDefaultMutableTreeNode.FPD_PLATFORMHEADER, - true, vPlatformList.lastElement()); - iTree.addNode(dmtnPlatformDescription, node); - this.openPlatform(smb.getFid().getPath()); } } } @@ -2962,7 +2888,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // case 0: if (this.currentOpeningModuleIndex > -1) { - if (!openingModuleList.getModuleSaved(currentOpeningModuleIndex)) { + if (!GlobalData.openingModuleList.getModuleSaved(currentOpeningModuleIndex)) { int result = showSaveDialog(); if (result == JOptionPane.YES_OPTION) { this.saveAll(); @@ -2974,18 +2900,20 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele return; } } - iTree.removeNodeChildrenByPath(openingModuleList.getTreePathByIndex(currentOpeningModuleIndex)); - this.openingModuleList.removeFromOpeningModuleListByIndex(this.currentOpeningModuleIndex); + iTree + .removeNodeChildrenByPath(GlobalData.openingModuleList + .getTreePathByIndex(currentOpeningModuleIndex)); + GlobalData.openingModuleList.setModuleOpen(this.currentOpeningModuleIndex, false); this.cleanDesktopPaneModule(); this.currentOpeningModuleIndex = -1; } break; // // Current is package - // + // case 1: if (this.currentOpeningPackageIndex > -1) { - if (!openingPackageList.getPackageSaved(currentOpeningPackageIndex)) { + if (!GlobalData.openingPackageList.getPackageSaved(currentOpeningPackageIndex)) { int result = showSaveDialog(); if (result == JOptionPane.YES_OPTION) { this.saveAll(); @@ -2997,8 +2925,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele return; } } - iTree.removeNodeChildrenByPath(openingPackageList.getTreePathByIndex(currentOpeningPackageIndex)); - this.openingPackageList.removeFromOpeningPackageListByIndex(this.currentOpeningPackageIndex); + iTree + .removeNodeChildrenByPath(GlobalData.openingPackageList + .getTreePathByIndex(currentOpeningPackageIndex)); + GlobalData.openingPackageList.setPackageOpen(this.currentOpeningPackageIndex, false); this.cleanDesktopPanePackage(); this.currentOpeningPackageIndex = -1; } @@ -3008,7 +2938,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // case 2: if (this.currentOpeningPlatformIndex > -1) { - if (!openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) { + if (!GlobalData.openingPlatformList.getPlatformSaved(currentOpeningPlatformIndex)) { int result = showSaveDialog(); if (result == JOptionPane.YES_OPTION) { this.saveAll(); @@ -3020,8 +2950,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele return; } } - iTree.removeNodeChildrenByPath(openingPlatformList.getTreePathByIndex(currentOpeningPlatformIndex)); - this.openingPlatformList.removeFromOpeningPlatformListByIndex(this.currentOpeningPlatformIndex); + iTree + .removeNodeChildrenByPath(GlobalData.openingPlatformList + .getTreePathByIndex(currentOpeningPlatformIndex)); + GlobalData.openingPlatformList.setPlatformOpen(this.currentOpeningPlatformIndex, false); this.cleanDesktopPanePlatform(); this.currentOpeningPlatformIndex = -1; } @@ -3035,7 +2967,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void closeAll() { int result = -1; - if (!openingModuleList.isSaved() || !openingPackageList.isSaved() || !openingPlatformList.isSaved()) { + if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved() + || !GlobalData.openingPlatformList.isSaved()) { result = showSaveDialog(); } if (result == JOptionPane.YES_OPTION) { @@ -3050,10 +2983,9 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele return; } this.cleanDesktopPane(); - this.getCompontentsFromFrameworkDatabase(); - openingModuleList.removeAllFromOpeningModuleList(); - openingPackageList.removeAllFromOpeningPackageList(); - openingPlatformList.removeAllFromOpeningPlatformList(); + GlobalData.openingModuleList.closeAll(); + GlobalData.openingPackageList.closeAll(); + GlobalData.openingPlatformList.closeAll(); this.makeEmptyTree(); } @@ -3089,8 +3021,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Save all modules // - for (int index = 0; index < openingModuleList.size(); index++) { - if (!openingModuleList.getModuleSaved(index)) { + for (int index = 0; index < GlobalData.openingModuleList.size(); index++) { + if (!GlobalData.openingModuleList.getModuleSaved(index)) { saveModule(index); } } @@ -3098,8 +3030,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Save all packages // - for (int index = 0; index < openingPackageList.size(); index++) { - if (!openingPackageList.getPackageSaved(index)) { + for (int index = 0; index < GlobalData.openingPackageList.size(); index++) { + if (!GlobalData.openingPackageList.getPackageSaved(index)) { savePackage(index); } } @@ -3107,8 +3039,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Save all platforms // - for (int index = 0; index < openingPlatformList.size(); index++) { - if (!openingPlatformList.getPlatformSaved(index)) { + for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) { + if (!GlobalData.openingPlatformList.getPlatformSaved(index)) { savePlatform(index); } } @@ -3120,7 +3052,8 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele **/ private void exit() { int result = -1; - if (!openingModuleList.isSaved() || !openingPackageList.isSaved() || !openingPlatformList.isSaved()) { + if (!GlobalData.openingModuleList.isSaved() || !GlobalData.openingPackageList.isSaved() + || !GlobalData.openingPlatformList.isSaved()) { result = showSaveDialog(); } if (result == JOptionPane.YES_OPTION) { @@ -3136,6 +3069,15 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele System.exit(0); } + /** + To find all defined PPIs in workspace + + **/ +// private void findPpi() { +// FindPPIsResult fpr = FindPPIsResult.getInstance(); +// fpr.setVisible(true); +// } + /** Switch current workspace to others @@ -3152,6 +3094,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele closeAll(); this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]"); + // + // Reinit Global Data + // + GlobalData.init(); } sw.dispose(); } @@ -3228,6 +3174,10 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele tcc.showDialog(); } + private void configBuildPreferences() { + Preferences bt = Preferences.getInstance(); + bt.showDialog(); + } /** Clone selected item @@ -3275,29 +3225,30 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele } if (result == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) { Tools.showInformationMessage("Module Surface Area Clone Finished"); - vModuleList.addElement(c.getMid()); + GlobalData.vModuleList.addElement(c.getMid()); addModuleToTree(c.getMid()); } if (result == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) { Tools.showInformationMessage("Package Surface Area Clone Finished"); - vPackageList.addElement(c.getPid()); + GlobalData.vPackageList.addElement(c.getPid()); // // Add new SpdHeader node to the tree // - IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPackageList.lastElement().getName(), + IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(GlobalData.vPackageList.lastElement().getName(), IDefaultMutableTreeNode.SPD_HEADER, true, - vPackageList.lastElement()); + GlobalData.vPackageList.lastElement()); iTree.addNode(dmtnPackageDescription, node); } if (result == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) { Tools.showInformationMessage("Platform Surface Area Clone Finished"); - vPlatformList.addElement(c.getFid()); + GlobalData.vPlatformList.addElement(c.getFid()); // // Add new SpdHeader node to the tree // - IDefaultMutableTreeNode node = new IDefaultMutableTreeNode(vPlatformList.lastElement().getName(), + IDefaultMutableTreeNode node = new IDefaultMutableTreeNode( + GlobalData.vPlatformList.lastElement().getName(), IDefaultMutableTreeNode.FPD_PLATFORMHEADER, - true, vPlatformList.lastElement()); + true, GlobalData.vPlatformList.lastElement()); iTree.addNode(dmtnPlatformDescription, node); //this.openPlatform(c.getFid().getPath()); } @@ -3326,18 +3277,22 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // // Enable close/close all if some files are opened // - jMenuItemFileClose.setEnabled(openingModuleList.isOpend() || openingPackageList.isOpend() - || openingPlatformList.isOpend()); - jMenuItemFileCloseAll.setEnabled(openingModuleList.isOpend() || openingPackageList.isOpend() - || openingPlatformList.isOpend()); + jMenuItemFileClose.setEnabled(GlobalData.openingModuleList.isOpen() + || GlobalData.openingPackageList.isOpen() + || GlobalData.openingPlatformList.isOpen()); + jMenuItemFileCloseAll.setEnabled(GlobalData.openingModuleList.isOpen() + || GlobalData.openingPackageList.isOpen() + || GlobalData.openingPlatformList.isOpen()); // // Enable save/save all if some files are changed // - jMenuItemFileSave.setEnabled(!openingModuleList.isSaved() || !openingPackageList.isSaved() - || !openingPlatformList.isSaved()); - jMenuItemFileSaveAll.setEnabled(!openingModuleList.isSaved() || !openingPackageList.isSaved() - || !openingPlatformList.isSaved()); + jMenuItemFileSave.setEnabled(!GlobalData.openingModuleList.isSaved() + || !GlobalData.openingPackageList.isSaved() + || !GlobalData.openingPlatformList.isSaved()); + jMenuItemFileSaveAll.setEnabled(!GlobalData.openingModuleList.isSaved() + || !GlobalData.openingPackageList.isSaved() + || !GlobalData.openingPlatformList.isSaved()); } if (arg0.getSource() == jMenuTools) {