package org.tianocore.frameworkwizard.platform.ui;\r
\r
import java.awt.BorderLayout;\r
+import java.awt.Dimension;\r
+import java.awt.FontMetrics;\r
\r
import javax.swing.JFrame;\r
import javax.swing.JOptionPane;\r
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
\r
import java.awt.FlowLayout;\r
+import java.awt.event.ActionEvent;\r
import java.awt.event.KeyEvent;\r
import java.awt.event.MouseEvent;\r
import java.util.ArrayList;\r
private final int typeMinWidth = 100;\r
\r
private final int typeMaxWidth = 155;\r
+\r
+ private JButton jButtonApriori = null;\r
\r
/**\r
* This method initializes jSplitPane\r
String path = modelAllModules.getValueAt(selectedRow, pathColForAllModTable) + "";\r
ModuleIdentification mi = miList.get(selectedRow);\r
Vector<String> vArchs = null;\r
- try {\r
- vArchs = WorkspaceProfile.getModuleSupArchs(mi);\r
- }\r
- catch (Exception exp) {\r
- JOptionPane.showMessageDialog(frame, exp.getMessage());\r
- }\r
+\r
+ vArchs = WorkspaceProfile.getModuleSupArchs(mi);\r
\r
if (vArchs == null) {\r
JOptionPane.showMessageDialog(frame, "No Supported Architectures specified in MSA file.");\r
return;\r
}\r
\r
+ Vector<Object> platformSupArch = new Vector<Object>();\r
+ ffc.getPlatformDefsSupportedArchs(platformSupArch);\r
+ platformSupArch.retainAll(vArchs);\r
+ if (platformSupArch.size() == 0) {\r
+ JOptionPane.showMessageDialog(frame, "This Module does not support this platform architectures.");\r
+ return;\r
+ }\r
+ \r
String archsAdded = "";\r
String mg = mi.getGuid();\r
String mv = mi.getVersion();\r
//\r
// check whether archs conform to SupArch of platform.\r
//\r
- Vector<Object> platformSupArch = new Vector<Object>();\r
+ platformSupArch.removeAllElements();\r
ffc.getPlatformDefsSupportedArchs(platformSupArch);\r
vArchs.retainAll(platformSupArch);\r
//\r
jPanelBottomSouth.setLayout(flowLayout1);\r
jPanelBottomSouth.add(getJButtonSettings(), null);\r
jPanelBottomSouth.add(getJButtonRemoveModule(), null);\r
+ jPanelBottomSouth.add(getJButtonApriori(), null);\r
}\r
return jPanelBottomSouth;\r
}\r
private void showSettingsDlg (int row) {\r
try {\r
if (ffc.adjustPcd(row)) {\r
+ JOptionPane.showMessageDialog(frame, "Pcd entries sync. with those in MSA files.");\r
docConsole.setSaved(false);\r
}\r
}\r
catch (Exception exp) {\r
JOptionPane.showMessageDialog(frame, exp.getMessage());\r
- return;\r
+// return;\r
}\r
\r
if (settingDlg == null) {\r
private JButton getJButtonRemoveModule() {\r
if (jButtonRemoveModule == null) {\r
jButtonRemoveModule = new JButton();\r
- jButtonRemoveModule.setPreferredSize(new java.awt.Dimension(130, 20));\r
jButtonRemoveModule.setText("Remove Module");\r
+ FontMetrics fm = jButtonRemoveModule.getFontMetrics(jButtonRemoveModule.getFont());\r
+ jButtonRemoveModule.setPreferredSize(new Dimension (fm.stringWidth(jButtonRemoveModule.getText()) + 40, 20));\r
jButtonRemoveModule.addActionListener(new java.awt.event.ActionListener() {\r
public void actionPerformed(java.awt.event.ActionEvent e) {\r
int selectedRow = jTableFpdModules.getSelectedRow();\r
if (fvBindings != null) {\r
String[] fvArray = fvBindings.split(" ");\r
for (int i = 0; i < fvArray.length; ++i) {\r
- ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), mg, mv, pg, pv, arch);\r
+ ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", 1, mg, mv, pg, pv, arch);\r
}\r
}\r
\r
return jButtonRemoveModule;\r
}\r
\r
+ /**\r
+ * This method initializes jButtonApriori \r
+ * \r
+ * @return javax.swing.JButton \r
+ */\r
+ private JButton getJButtonApriori() {\r
+ if (jButtonApriori == null) {\r
+ jButtonApriori = new JButton();\r
+ jButtonApriori.setText("Apriori Files");\r
+ FontMetrics fm = jButtonApriori.getFontMetrics(jButtonApriori.getFont());\r
+ int buttonWidth = fm.stringWidth(jButtonApriori.getText()) + 40;\r
+ if (jButtonRemoveModule.getWidth() > buttonWidth) {\r
+ buttonWidth = jButtonRemoveModule.getWidth();\r
+ }\r
+ jButtonApriori.setPreferredSize(new Dimension (buttonWidth, 20));\r
+ jButtonApriori.addActionListener(new java.awt.event.ActionListener() {\r
+ public void actionPerformed(ActionEvent arg0) {\r
+ new GenAprioriFileDialog(ffc, docConsole).setVisible(true);\r
+ }});\r
+ }\r
+ return jButtonApriori;\r
+ }\r
+\r
/**\r
* \r
* @param args\r