diff options
Diffstat (limited to 'Tools/Java/Source/FrameworkWizard')
10 files changed, 856 insertions, 91 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java index e83a95bbad..b9462351b9 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java @@ -199,4 +199,25 @@ public class GlobalData { }
return modulePath;
}
+
+ /**
+ Get a module id
+
+ @param moduleGuid
+ @param moduleVersion
+ @param packageGuid
+ @param packageVersion
+ @return
+
+ **/
+ public static ModuleIdentification findIdByGuidVersion(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {
+ ModuleIdentification mid = null;
+ for (int index = 0; index < vModuleList.size(); index++) {
+ if (vModuleList.elementAt(index).equals(moduleGuid, moduleVersion, packageGuid, packageVersion)) {
+ mid = vModuleList.elementAt(index);
+ break;
+ }
+ }
+ return mid;
+ }
}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java index 90c38fd8fe..fe6496199d 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java @@ -231,10 +231,12 @@ public class Tools { //
// remove file separator of rear
//
- if (path.length() > 0 && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {
+ if (path.length() > 0
+ && 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.length() > 0 && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
+ if (path.length() > 0
+ && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {
path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());
}
//
@@ -262,6 +264,35 @@ public class Tools { }
/**
+ Convert a Vector to a String, separator with ", "
+
+ @param v
+ @return
+
+ **/
+ public static String convertVectorToString(Vector<String> v) {
+ String s = "";
+ for (int index = 0; index < v.size(); index++) {
+ s = s + v.elementAt(index).toString() + ", ";
+ }
+ if (s.length() > 0) {
+ s = s.substring(0, s.length() - ", ".length());
+ }
+ return s;
+ }
+
+ /**
+ Convert a List to a String
+
+ @param list
+ @return
+
+ **/
+ public static String convertListToString(List list) {
+ return Tools.convertVectorToString(Tools.convertListToVector(list));
+ }
+
+ /**
If the input path missing ext, append the ext to the path
@param path
@@ -339,7 +370,7 @@ public class Tools { if (arg0.length() <= 0) {
return "";
}
-
+
//
// Convert string to array by " "
//
@@ -553,14 +584,14 @@ public class Tools { resizeComponentWidth(c, containerWidth, preferredWidth);
resizeComponentHeight(c, containerHeight, preferredHeight);
}
-
+
/**
To adjust each column's width to meet the table's size
@param t the table need to be adjusted
@param width the new width of the table
-
- **/
+
+ **/
public static void resizeTableColumn(JTable t, int width) {
if (t != null) {
int columnCount = t.getColumnCount();
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java index 08bae58d2b..c0019c8049 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java @@ -16,6 +16,7 @@ package org.tianocore.frameworkwizard.common.find; import java.util.Vector;
+import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;
import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
@@ -781,8 +782,11 @@ public class Find { .getLibraryClassDeclarations()
.getLibraryClassList()
.size(); indexOfLibraryClass++) {
- if (spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass)
- .getName().equals(name)) {
+ LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);
+ if (lc.getName().equals(name)) {
+ lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));
+ lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));
+ lcid.setHelp(lc.getHelpText());
lcid.setDeclaredBy(packageId);
break;
}
@@ -809,9 +813,72 @@ public class Find { @return
**/
- public static Vector<LibraryClassId> getAllLibraryClassForFind() {
- Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();
- LibraryClassVector lcv = Find.getAllLibraryClassVector();
+ // public static Vector<LibraryClassId> getAllLibraryClassForFind(LibraryClassVector lcv) {
+ // Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();
+ // 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 string "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;
+ // }
+ public static Vector<FindResultId> getAllLibraryClassForFind(LibraryClassVector lcv) {
+ Vector<FindResultId> libraryClass = new Vector<FindResultId>();
boolean isAdded = false;
boolean isProduced = false;
@@ -834,24 +901,18 @@ public class Find { }
//
- // Get the string "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);
+ FindResultId frId = libraryClass.get(indexOfGuid);
- if (lcvId.getLibraryClassName().equals(lcId.getName())) {
+ if (lcvId.getLibraryClassName().equals(frId.getName())) {
if (isProduced) {
- libraryClass.get(indexOfGuid).setProducedModules(lcId.getProducedModules() + "<br>" + tmp);
+ libraryClass.get(indexOfGuid).addProducedModules(lcvId.getBelongModule());
} else if (!isProduced) {
- libraryClass.get(indexOfGuid).setConsumedModules(lcId.getConsumedModules() + "<br>" + tmp);
+ libraryClass.get(indexOfGuid).addConsumedModules(lcvId.getBelongModule());
}
isAdded = true;
continue;
@@ -862,13 +923,9 @@ public class Find { // 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()));
- }
+ libraryClass.addElement(new FindResultId(lcvId.getLibraryClassName(), "Library Class",
+ lcvId.getSupArchList(), lcvId.getHelp(),
+ lcvId.getSupModuleList(), lcvId.getDeclaredBy()));
}
}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java index 5dcc7aa944..da9a7de546 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java @@ -17,7 +17,8 @@ package org.tianocore.frameworkwizard.common.find; import java.awt.Dimension;
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;
import java.util.Vector;
@@ -28,6 +29,8 @@ import javax.swing.JScrollPane; import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
@@ -37,8 +40,10 @@ 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;
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
+import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
-public class FindResult extends IFrame implements TableModelListener, ComponentListener {
+public class FindResult extends IFrame implements TableModelListener, ListSelectionListener, MouseListener {
///
/// Define class Serial Version UID
@@ -75,6 +80,12 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL private static FindResult findLibraryClassResult = null;
+ private int selectedRow = -1;
+
+ private LibraryClassVector lcv = null;
+
+ private Vector<FindResultId> vLibraryClassFindResult = null;
+
/**
* This is the default constructor
*/
@@ -160,7 +171,9 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ jTable.getSelectionModel().addListSelectionListener(this);
jTable.getModel().addTableModelListener(this);
+ jTable.addMouseListener(this);
model.addColumn("Name");
model.addColumn("Type");
@@ -173,12 +186,7 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL jTable.getColumn("Produced by").setCellRenderer(new MyTableCellRenderer());
jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());
jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());
-
-// jTable.getColumn("Name").setPreferredWidth((this.getSize().width - 30) / 5);
-// jTable.getColumn("Type").setPreferredWidth((this.getSize().width - 30) / 5);
-// jTable.getColumn("Produced by").setPreferredWidth((this.getSize().width - 30) / 5);
-// jTable.getColumn("Consumed by").setPreferredWidth((this.getSize().width - 30) / 5);
-// jTable.getColumn("Declared by").setPreferredWidth((this.getSize().width - 30) / 5);
+
int columnWidth = (this.getSize().width - 28) / 5;
jTable.getColumn("Name").setPreferredWidth(columnWidth);
jTable.getColumn("Type").setPreferredWidth(columnWidth);
@@ -402,29 +410,49 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL }
if (this.method.equals("LIBRARY_CLASS")) {
- Vector<LibraryClassId> vLibraryClass = Find.getAllLibraryClassForFind();
-
- if (vLibraryClass.size() > 0) {
+ lcv = Find.getAllLibraryClassVector();
+ vLibraryClassFindResult = Find.getAllLibraryClassForFind(lcv);
- for (int index = 0; index < vLibraryClass.size(); index++) {
+ if (vLibraryClassFindResult.size() > 0) {
+ for (int index = 0; index < vLibraryClassFindResult.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();
+ v.addElement(vLibraryClassFindResult.elementAt(index).getName());
+ v.addElement(vLibraryClassFindResult.elementAt(index).getType());
+
+ //
+ // Generate Produced Modules List
+ //
+ String strProducedModules = "";
+ Vector<ModuleIdentification> vModule = vLibraryClassFindResult.elementAt(index)
+ .getProducedModules();
+ for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {
+ strProducedModules = strProducedModules + "<br>"
+ + vModule.get(indexOfPM).getPackageId().getName() + "."
+ + vModule.get(indexOfPM).getName();
+ }
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();
+ //
+ // Generate Consumed Modules List
+ //
+ String strConsumedModules = "";
+ vModule = vLibraryClassFindResult.elementAt(index).getConsumedModules();
+ for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {
+ strConsumedModules = strConsumedModules + "<br>"
+ + vModule.get(indexOfCM).getPackageId().getName() + "."
+ + vModule.get(indexOfCM).getName();
+ }
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());
+ v.addElement(vLibraryClassFindResult.elementAt(index).getDeclaredBy().getName());
model.addRow(v);
jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);
@@ -443,9 +471,12 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL }
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ *
+ */
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == this.jButtonClose) {
-
this.dispose();
}
}
@@ -469,6 +500,39 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL }
/* (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();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
+ *
+ */
+ public void mouseClicked(MouseEvent arg0) {
+ if (arg0.getClickCount() == 2) {
+ if (this.selectedRow < 0) {
+ return;
+ } else {
+ if (this.method.equals("LIBRARY_CLASS")) {
+ FindResultDetailInfo frdi = new FindResultDetailInfo(vLibraryClassFindResult.elementAt(selectedRow));
+ frdi.setVisible(true);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
* @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)
*
* Override windowClosing to popup warning message to confirm quit
@@ -480,7 +544,7 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL class MyTableCellRenderer extends DefaultTableCellRenderer {
///
- ///
+ /// Define Class Serial Version UID
///
private static final long serialVersionUID = -2082787479305255946L;
@@ -490,4 +554,23 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL }
}
+ 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
+
+ }
}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java new file mode 100644 index 0000000000..0788d6703e --- /dev/null +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java @@ -0,0 +1,408 @@ +/** @file
+
+ The file is used to show detailed information of one of find results
+
+ 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.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.JTextArea;
+
+import org.tianocore.FrameworkModulesDocument.FrameworkModules;
+import org.tianocore.LibrariesDocument.Libraries;
+import org.tianocore.LibrariesDocument.Libraries.Instance;
+import org.tianocore.LibraryClassDocument.LibraryClass;
+import org.tianocore.ModuleSADocument.ModuleSA;
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
+import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
+import org.tianocore.frameworkwizard.common.DataType;
+import org.tianocore.frameworkwizard.common.GlobalData;
+import org.tianocore.frameworkwizard.common.Tools;
+import org.tianocore.frameworkwizard.common.ui.IFrame;
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;
+import org.tianocore.frameworkwizard.workspace.Workspace;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
+
+public class FindResultDetailInfo extends IFrame {
+
+ ///
+ /// Define class Serial Version UID
+ ///
+ private static final long serialVersionUID = -4888295869041881282L;
+
+ private JPanel jContentPane = null;
+
+ private JScrollPane jScrollPane = null;
+
+ private JTextArea jTextArea = null;
+
+ private JButton jButtonClose = null;
+
+ //
+ // Not for UI
+ //
+ private static String TAB = " ";
+
+ private String reportContent = "";
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
+ /**
+ * This method initializes jScrollPane
+ *
+ * @return javax.swing.JScrollPane
+ */
+ private JScrollPane getJScrollPane() {
+ if (jScrollPane == null) {
+ jScrollPane = new JScrollPane();
+ jScrollPane.setBounds(new java.awt.Rectangle(5, 5, 535, 280));
+ jScrollPane.setPreferredSize(new java.awt.Dimension(535, 280));
+ jScrollPane.setViewportView(getJTextArea());
+ }
+ return jScrollPane;
+ }
+
+ /**
+ * This method initializes jTextArea
+ *
+ * @return javax.swing.JTextArea
+ */
+ private JTextArea getJTextArea() {
+ if (jTextArea == null) {
+ jTextArea = new JTextArea();
+ jTextArea.setEditable(false);
+ }
+ return jTextArea;
+ }
+
+ /**
+ * This method initializes jButtonClose
+ *
+ * @return javax.swing.JButton
+ */
+ private JButton getJButtonClose() {
+ if (jButtonClose == null) {
+ jButtonClose = new JButton();
+ jButtonClose.setBounds(new java.awt.Rectangle(240, 290, 80, 20));
+ jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));
+ jButtonClose.addActionListener(this);
+ jButtonClose.setText("Close");
+ }
+ return jButtonClose;
+ }
+
+ /**
+
+ @param lci
+
+ **/
+ public FindResultDetailInfo(FindResultId frid) {
+ super();
+ init();
+ this.setTitle(frid.getName());
+ this.jTextArea.setText(createReport(frid));
+ this.jTextArea.setSelectionStart(0);
+ this.jTextArea.setSelectionEnd(0);
+ }
+
+ private String createReport(FindResultId frid) {
+ String tmp = "";
+ String name = frid.getName();
+
+ //
+ // Write Class Name
+ //
+ writeReportLn(name);
+
+ //
+ // Write Provided Package
+ //
+ writeReportLn(TAB + "Provided by: " + frid.getDeclaredBy().getName() + " ("
+ + Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");
+
+ //
+ // Write Header File
+ //
+ PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(frid.getDeclaredBy());
+ tmp = Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace());
+ writeReportLn(TAB + "Header File: " + Tools.getFilePathOnly(tmp)
+ + wt.getHeaderFileFromPackageByLibraryClassName(spd, name));
+
+ //
+ // Write Supported Module Types
+ //
+ writeReportLn(TAB + "Supported Module Types: " + Tools.convertVectorToString(frid.getModuleType()));
+
+ //
+ // Write Supported Arch
+ //
+ writeReportLn(TAB + "Supported Architectures: " + Tools.convertVectorToString(frid.getArch()));
+
+ //
+ // Write Help Text
+ //
+ writeReportLn(TAB + "Help Text: ");
+ writeReportLn(TAB + TAB + frid.getHelp());
+
+ //
+ // Write an empty line
+ //
+ writeReportLn("");
+
+ //
+ // Write Instances
+ //
+ writeReportLn("Library Instances:");
+
+ //
+ // Write Instances One by One
+ //
+ for (int index = 0; index < frid.getProducedModules().size(); index++) {
+ ModuleIdentification mid = frid.getProducedModules().get(index);
+ ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);
+ if (msa != null) {
+ //
+ // Write Instance Name
+ //
+ if (msa.getMsaHeader() != null) {
+ writeReportLn(TAB + msa.getMsaHeader().getModuleName());
+ }
+
+ //
+ // Write Msa File Name
+ //
+ writeReportLn(TAB + TAB + "Provided by: "
+ + Tools.getRelativePath(mid.getPath(), Workspace.getCurrentWorkspace()));
+
+ //
+ // Find the produced library class
+ //
+ if (msa.getLibraryClassDefinitions() != null) {
+ for (int indexL = 0; indexL < msa.getLibraryClassDefinitions().getLibraryClassList().size(); indexL++) {
+ LibraryClass lc = msa.getLibraryClassDefinitions().getLibraryClassList().get(indexL);
+ if (lc.getKeyword().equals(name)) {
+ //
+ // Write Supported Module Types
+ //
+ writeReportLn(TAB + TAB + "Supported Module Types: "
+ + Tools.convertListToString(lc.getSupModuleList()));
+
+ //
+ // Write Supported Arch
+ //
+ writeReportLn(TAB + TAB + "Supported Architectures: "
+ + Tools.convertListToString(lc.getSupArchList()));
+
+ //
+ // Write Help Text
+ //
+ writeReportLn(TAB + TAB + "Help Text: ");
+ writeReportLn(TAB + TAB + (lc.getHelpText() == null ? "" : lc.getHelpText()));
+ }
+ }
+ }
+
+ }
+ }
+
+ //
+ // Write an empty line
+ //
+ writeReportLn("");
+
+ //
+ // Write all modules which consumed this library
+ //
+ writeReportLn("Modules Requiring " + name + ":");
+ for (int index = 0; index < frid.getConsumedModules().size(); index++) {
+ //
+ // Write
+ //
+ writeReportLn(TAB
+ + frid.getConsumedModules().get(index).getName()
+ + " ("
+ + Tools.getRelativePath(frid.getConsumedModules().get(index).getPath(),
+ Workspace.getCurrentWorkspace()) + ")");
+ }
+
+ //
+ // Write an empty line
+ //
+ writeReportLn("");
+
+ //
+ // Write platforms using the library class instances
+ //
+ writeReportLn("Platforms Using " + name + ":");
+
+ //
+ // Write Instances One by One as Using Platforms
+ //
+ for (int index = 0; index < frid.getProducedModules().size(); index++) {
+ ModuleIdentification mid = frid.getProducedModules().get(index);
+
+ //
+ // Write Instance Name
+ //
+ writeReportLn(TAB + mid.getName());
+
+ //
+ // Go through each platform one by one
+ //
+ for (int indexOfPlatform = 0; indexOfPlatform < GlobalData.openingPlatformList.size(); indexOfPlatform++) {
+ PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
+ .getXmlFpd();
+ PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)
+ .getId();
+ Vector<ModuleIdentification> vModuleSa = new Vector<ModuleIdentification>();
+ if (fpd != null) {
+ FrameworkModules fm = fpd.getFrameworkModules();
+ if (fm != null) {
+ for (int indexOfModule = 0; indexOfModule < fm.getModuleSAList().size(); indexOfModule++) {
+ ModuleSA msa = fm.getModuleSAList().get(indexOfModule);
+ if (msa != null) {
+ Libraries l = msa.getLibraries();
+ if (l != null) {
+ if (l.getInstanceList() != null) {
+ for (int indexOfInstance = 0; indexOfInstance < l.getInstanceList().size(); indexOfInstance++) {
+ Instance i = l.getInstanceList().get(indexOfInstance);
+ if (mid.equals(i.getModuleGuid(), i.getModuleVersion(), i.getPackageGuid(),
+ i.getPackageVersion())) {
+ ModuleIdentification moduleSaId = GlobalData
+ .findIdByGuidVersion(
+ msa
+ .getModuleGuid(),
+ msa
+ .getModuleVersion(),
+ msa
+ .getPackageGuid(),
+ msa
+ .getPackageVersion());
+ if (moduleSaId != null) {
+ vModuleSa.addElement(moduleSaId);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //
+ // Get finded moduleSa in this spd
+ //
+ if (vModuleSa.size() > 0) {
+ writeReportLn(TAB + TAB + pid.getName() + " ("
+ + Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")");
+ for (int indexOfModuleSa = 0; indexOfModuleSa < vModuleSa.size(); indexOfModuleSa++) {
+ writeReportLn(TAB
+ + TAB
+ + TAB
+ + vModuleSa.elementAt(indexOfModuleSa).getName()
+ + " ("
+ + Tools.getRelativePath(vModuleSa.elementAt(indexOfModuleSa).getPath(),
+ Workspace.getCurrentWorkspace()) + ")");
+ }
+ }
+ }
+ }
+ }
+ writeReportLn("");
+ }
+
+ return this.reportContent;
+ }
+
+ /**
+ * This method initializes this
+ *
+ * @return void
+ */
+ private void init() {
+ this.setSize(550, 380);
+ this.setContentPane(getJContentPane());
+ this.setTitle("JFrame");
+ this.setResizable(true);
+ this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
+ this.centerWindow();
+
+ }
+
+ /**
+ * This method initializes jContentPane
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jContentPane = new JPanel();
+ jContentPane.setLayout(null);
+ jContentPane.setSize(new java.awt.Dimension(550, 350));
+ jContentPane.add(getJScrollPane(), null);
+ jContentPane.add(getJButtonClose(), null);
+
+ jContentPane.setPreferredSize(new java.awt.Dimension(550, 340));
+ }
+ return jContentPane;
+ }
+
+ /* (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();
+ }
+
+ /* (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.jScrollPane, intCurrentWidth, intCurrentHeight, intPreferredWidth,
+ intPreferredHeight);
+ Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,
+ DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ *
+ */
+ public void actionPerformed(ActionEvent arg0) {
+ if (arg0.getSource() == this.jButtonClose) {
+ this.dispose();
+ }
+ }
+
+ private void writeReportLn(String line) {
+ this.reportContent = this.reportContent + line + DataType.LINE_SEPARATOR;
+ }
+}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java new file mode 100644 index 0000000000..3784fb3839 --- /dev/null +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java @@ -0,0 +1,124 @@ +/** @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;
+
+import java.util.Vector;
+
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;
+
+public class FindResultId {
+
+ private String name = "";
+
+ private String type = "";
+
+ private Vector<String> arch = new Vector<String>();
+
+ private Vector<String> moduleType = new Vector<String>();
+
+ private String help = "";
+
+ private Vector<ModuleIdentification> producedModules = new Vector<ModuleIdentification>();
+
+ private Vector<ModuleIdentification> consumedModules = new Vector<ModuleIdentification>();
+
+ private PackageIdentification declaredBy = null;
+
+ public FindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {
+ this.name = (strName == null ? "" : strName);
+ this.type = (strType == null ? "" : strType);
+ this.arch = (vArch == null ? this.arch : vArch);
+ this.help = (strHelp == null ? "" : strHelp);
+ this.moduleType = (vModuleType == null ? this.moduleType : vModuleType);
+ this.declaredBy = pDeclaredBy;
+ }
+
+ public Vector<String> getArch() {
+ return arch;
+ }
+
+ public void setArch(Vector<String> arch) {
+ this.arch = arch;
+ }
+
+ public Vector<ModuleIdentification> getConsumedModules() {
+ return consumedModules;
+ }
+
+ public void setConsumedModules(Vector<ModuleIdentification> consumedModules) {
+ this.consumedModules = consumedModules;
+ }
+
+ public void addConsumedModules(ModuleIdentification consumedModule) {
+ if (consumedModule != null) {
+ this.consumedModules.addElement(consumedModule);
+ }
+ }
+
+ public PackageIdentification getDeclaredBy() {
+ return declaredBy;
+ }
+
+ public void setDeclaredBy(PackageIdentification declaredBy) {
+ this.declaredBy = declaredBy;
+ }
+
+ public String getHelp() {
+ return help;
+ }
+
+ public void setHelp(String help) {
+ this.help = help;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Vector<ModuleIdentification> getProducedModules() {
+ return producedModules;
+ }
+
+ public void setProducedModules(Vector<ModuleIdentification> producedModules) {
+ this.producedModules = producedModules;
+ }
+
+ public void addProducedModules(ModuleIdentification producedModule) {
+ if (producedModule != null) {
+ this.producedModules.addElement(producedModule);
+ }
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Vector<String> getModuleType() {
+ return moduleType;
+ }
+
+ public void setModuleType(Vector<String> moduleType) {
+ this.moduleType = moduleType;
+ }
+}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java index fa03258bdc..3155cf6329 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java @@ -23,7 +23,14 @@ public class LibraryClassVector { for (int index = 0; index < vLibraryClass.size(); index++) {
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())
&& vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {
- return index;
+ if (vLibraryClass.elementAt(index).getBelongModule() != null && lib.getBelongModule() != null) {
+ if (vLibraryClass.elementAt(index).getBelongModule().equals(lib.getBelongModule())) {
+ return index;
+ }
+ }
+ if (vLibraryClass.elementAt(index).getBelongModule() == null && lib.getBelongModule() == null) {
+ return index;
+ }
}
}
return -1;
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java index d7a9c48fe4..3135eef0f4 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java @@ -24,6 +24,7 @@ import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.OpenFile;
+import org.tianocore.frameworkwizard.common.Tools;
import org.tianocore.frameworkwizard.common.Identifications.Identification;
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
@@ -133,6 +134,31 @@ public class ModuleIdentification extends Identification { }
}
}
+
+ public boolean equals(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {
+ boolean b = false;
+ if (this.getGuid().equals(moduleGuid) && this.getPackageId().getGuid().equals(packageGuid)) {
+ b = true;
+ //
+ // Check Version
+ //
+ if (moduleVersion != null) {
+ if (!Tools.isEmpty(moduleVersion)) {
+ if (!moduleVersion.equals(this.getVersion())) {
+ b = false;
+ }
+ }
+ }
+ if (packageVersion != null) {
+ if (!Tools.isEmpty(packageVersion)) {
+ if (!packageVersion.equals(this.getPackageId().getVersion())) {
+ b = false;
+ }
+ }
+ }
+ }
+ return b;
+ }
public boolean isLibrary() {
return isLibrary;
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java index 0c8d663434..854c6514d5 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java @@ -505,32 +505,6 @@ public class LibraryClassDefsDlg extends IDialog { Log.wrn("Update Library Class Definitions", "Incorrect data type for Library Class");
return false;
}
-
- //
- // Check if the library is produced
- //
- String strUsage = this.jComboBoxUsage.getSelectedItem().toString();
- //
- // Check only when the library class is consumed
- //
- if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
- LibraryClassVector v = Find.getAllLibraryClassVector();
- boolean isFind = false;
- for (int index = 0; index < v.size(); index++) {
- LibraryClassIdentification lid = v.getLibraryClass(index);
- if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {
- if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
- || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
- isFind = true;
- break;
- }
- }
- }
- if (!isFind) {
- Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet.");
- return false;
- }
- }
//
// Check RecommendedInstanceVersion
@@ -561,6 +535,32 @@ public class LibraryClassDefsDlg extends IDialog { return false;
}
}
+
+ //
+ // Check if the library is produced
+ //
+ String strUsage = this.jComboBoxUsage.getSelectedItem().toString();
+ //
+ // Check only when the library class is consumed
+ //
+ if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
+ LibraryClassVector v = Find.getAllLibraryClassVector();
+ boolean isFind = false;
+ for (int index = 0; index < v.size(); index++) {
+ LibraryClassIdentification lid = v.getLibraryClass(index);
+ if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {
+ if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
+ || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
+ isFind = true;
+ break;
+ }
+ }
+ }
+ if (!isFind) {
+ Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet. It may have some errors in build time.");
+ //return false;
+ }
+ }
return true;
}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java index c27b81eea0..1969d07503 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java @@ -471,7 +471,7 @@ public class WorkspaceTools { if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {
hasDYNAMIC = true;
}
- if(type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {
+ if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {
hasFEATURE_FLAG = true;
}
}
@@ -666,10 +666,11 @@ public class WorkspaceTools { //
// Check id
//
- if (mid.equals(id)) {
- return GlobalData.vPackageList.elementAt(indexI);
+ if (mid != null) {
+ if (mid.equals(id)) {
+ return GlobalData.vPackageList.elementAt(indexI);
+ }
}
-
}
}
@@ -809,19 +810,10 @@ public class WorkspaceTools { //
PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();
PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);
- if (spd != null) {
- if (spd.getLibraryClassDeclarations() != null) {
- LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();
- for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {
- if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {
- v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())
- + DataType.FILE_SEPARATOR
- + lcdl.getLibraryClassList()
- .get(indexOfLibOfSpd)
- .getIncludeHeader()));
- }
- }
- }
+ String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name);
+ if (!Tools.isEmpty(headerFile)) {
+ v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())
+ + DataType.FILE_SEPARATOR + headerFile));
}
}
}
@@ -920,4 +912,20 @@ public class WorkspaceTools { }
return v;
}
+
+ public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) {
+ String headerFile = "";
+ if (spd != null) {
+ if (spd.getLibraryClassDeclarations() != null) {
+ LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();
+ for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {
+ if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {
+ return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader();
+ }
+ }
+ }
+ }
+
+ return headerFile;
+ }
}
|