\r
private static final int timeToWait = 2000;\r
\r
+ private static final int pcdSyncThreadNumber = 10;\r
+ \r
private long savedMs = 0;\r
\r
String searchField = "";\r
if (fvBindings != null) {\r
String[] fvArray = fvBindings.split(" ");\r
for (int i = 0; i < fvArray.length; ++i) {\r
- ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", 1, mg, mv, pg, pv, arch);\r
+ ffc.removeModuleInBuildOptionsUserExtensions(fvArray[i].trim(), "IMAGES", "1", mg, mv, pg, pv, arch);\r
}\r
}\r
\r
new FpdFrameworkModules().setVisible(true);\r
}\r
\r
+ private class PcdSyncTask extends Thread {\r
+ \r
+ boolean pcdSynced = false;\r
+ public void run () {\r
+ Vector<String> vExceptions = new Vector<String>();\r
+ pcdSync(vExceptions);\r
+ if (pcdSynced) {\r
+ JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files."); \r
+ docConsole.setSaved(false);\r
+ }\r
+ if (vExceptions.size() > 0) {\r
+ String errorMsg = "";\r
+ for (int i = 0; i < vExceptions.size(); ++i) {\r
+ errorMsg += " " + vExceptions.get(i) + "\n";\r
+ }\r
+ JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg);\r
+ }\r
+ }\r
+ \r
+ private void pcdSync(Vector<String> v) {\r
+ \r
+ Vector<PcdSyncSubTask> vThreads = new Vector<PcdSyncSubTask> ();\r
+ int moduleCount = jTableFpdModules.getRowCount();\r
+ int start = 0;\r
+ for (int i = 0; i < FpdFrameworkModules.pcdSyncThreadNumber; ++i) {\r
+ int end = start + moduleCount/FpdFrameworkModules.pcdSyncThreadNumber + 1;\r
+ if (end > moduleCount) {\r
+ end = moduleCount;\r
+ }\r
+ vThreads.add(new PcdSyncSubTask (start, end, v));\r
+ start = end;\r
+ }\r
+ \r
+ for (int i = 0; i < vThreads.size(); ++i) {\r
+ vThreads.get(i).start();\r
+ }\r
+ \r
+ try {\r
+ for (int i = 0; i < vThreads.size(); ++i) {\r
+ vThreads.get(i).join();\r
+ }\r
+ }\r
+ catch (InterruptedException e) {\r
+ \r
+ }\r
+ \r
+ }\r
+ \r
+ private class PcdSyncSubTask extends Thread {\r
+ \r
+ private int startModule = 0;\r
+ private int endModulePlusOne = 1;\r
+ private Vector<String> v = null;\r
+\r
+ PcdSyncSubTask (int start, int endPlusOne, Vector<String> vErr) {\r
+ startModule = start;\r
+ endModulePlusOne = endPlusOne;\r
+ v = vErr;\r
+ }\r
+ \r
+ public void run () {\r
+ String[] sa = new String[5];\r
+ for (int i = startModule; i < endModulePlusOne; ++i) {\r
+ try {\r
+ ffc.getFrameworkModuleInfo(i, sa);\r
+ String mg = sa[ffcModGuid];\r
+ String mv = sa[ffcModVer];\r
+ String pg = sa[ffcPkgGuid];\r
+ String pv = sa[ffcPkgVer];\r
+ String arch = sa[ffcModArch];\r
+ String key = mg + " " + mv + " " + pg + " " + pv + " " + arch;\r
+ if (ffc.adjustPcd(key, v)) {\r
+ pcdSynced = true;\r
+ }\r
+ }\r
+ catch (Exception exp) {\r
+// JOptionPane.showMessageDialog(frame, exp.getMessage());\r
+ continue;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
/**\r
* This is the default constructor\r
*/\r
\r
}\r
\r
+ private PcdSyncTask pst = null;\r
public FpdFrameworkModules(OpeningPlatformType opt) {\r
this(opt.getXmlFpd());\r
docConsole = opt;\r
- Vector<String> vExceptions = new Vector<String>();\r
- if (pcdSync(vExceptions)) {\r
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files."); \r
- docConsole.setSaved(false);\r
- }\r
- if (vExceptions.size() > 0) {\r
- String errorMsg = "";\r
- for (int i = 0; i < vExceptions.size(); ++i) {\r
- errorMsg += " " + vExceptions.get(i) + "\n";\r
- }\r
- JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg);\r
+ if (pst == null) {\r
+ pst = new PcdSyncTask();\r
}\r
+ pst.start();\r
}\r
\r
private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
\r
}\r
\r
- private boolean pcdSync(Vector<String> v) {\r
- boolean synced = false;\r
- for (int i = 0; i < jTableFpdModules.getRowCount(); ++i) {\r
- try {\r
- if (ffc.adjustPcd(i, v)) {\r
- synced = true;\r
- }\r
- }\r
- catch (Exception exp) {\r
-// JOptionPane.showMessageDialog(frame, exp.getMessage());\r
- continue;\r
- }\r
- }\r
- return synced;\r
- \r
- }\r
- \r
private void showAllModules() {\r
\r
if (miList == null) {\r