Revision 2112 trunk/frameworks/_fwAndami/src/com/iver/andami/Launcher.java
Launcher.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.andami; |
42 | 42 |
|
43 |
import com.iver.andami.config.generate.Andami; |
|
44 |
import com.iver.andami.config.generate.AndamiConfig; |
|
45 |
import com.iver.andami.config.generate.Plugin; |
|
46 |
import com.iver.andami.messages.Messages; |
|
47 |
import com.iver.andami.messages.NotificationManager; |
|
48 |
import com.iver.andami.plugins.PluginClassLoader; |
|
49 |
import com.iver.andami.plugins.config.generate.ActionTool; |
|
50 |
import com.iver.andami.plugins.config.generate.Depends; |
|
51 |
import com.iver.andami.plugins.config.generate.Extension; |
|
52 |
import com.iver.andami.plugins.config.generate.Extensions; |
|
53 |
import com.iver.andami.plugins.config.generate.LabelSet; |
|
54 |
import com.iver.andami.plugins.config.generate.Menu; |
|
55 |
import com.iver.andami.plugins.config.generate.PluginConfig; |
|
56 |
import com.iver.andami.plugins.config.generate.PopupMenu; |
|
57 |
import com.iver.andami.plugins.config.generate.PopupMenus; |
|
58 |
import com.iver.andami.plugins.config.generate.SelectableTool; |
|
59 |
import com.iver.andami.plugins.config.generate.SkinExtension; |
|
60 |
import com.iver.andami.plugins.config.generate.SkinExtensionType; |
|
61 |
import com.iver.andami.plugins.config.generate.ToolBar; |
|
62 |
import com.iver.andami.ui.AndamiEventQueue; |
|
63 |
import com.iver.andami.ui.MDIManagerLoadException; |
|
64 |
import com.iver.andami.ui.SplashWindow; |
|
65 |
import com.iver.andami.ui.mdiFrame.MDIFrame; |
|
66 |
import com.iver.andami.ui.mdiManager.MDIManagerFactory; |
|
67 |
|
|
68 |
import com.iver.utiles.XMLEntity; |
|
69 |
import com.iver.utiles.xmlEntity.generate.XmlTag; |
|
70 |
|
|
71 |
import org.apache.log4j.Logger; |
|
72 |
import org.apache.log4j.PatternLayout; |
|
73 |
import org.apache.log4j.PropertyConfigurator; |
|
74 |
import org.apache.log4j.RollingFileAppender; |
|
75 |
|
|
76 |
import org.exolab.castor.xml.MarshalException; |
|
77 |
import org.exolab.castor.xml.ValidationException; |
|
78 |
|
|
79 | 43 |
import java.awt.EventQueue; |
80 | 44 |
import java.awt.Toolkit; |
81 |
|
|
82 | 45 |
import java.io.BufferedInputStream; |
83 | 46 |
import java.io.BufferedOutputStream; |
84 | 47 |
import java.io.File; |
... | ... | |
91 | 54 |
import java.io.FilenameFilter; |
92 | 55 |
import java.io.IOException; |
93 | 56 |
import java.io.InputStream; |
94 |
|
|
95 | 57 |
import java.lang.reflect.InvocationTargetException; |
96 |
|
|
97 | 58 |
import java.net.MalformedURLException; |
98 | 59 |
import java.net.URL; |
99 | 60 |
import java.net.URLConnection; |
100 |
|
|
101 | 61 |
import java.util.ArrayList; |
102 | 62 |
import java.util.Comparator; |
103 | 63 |
import java.util.Date; |
... | ... | |
106 | 66 |
import java.util.Iterator; |
107 | 67 |
import java.util.Locale; |
108 | 68 |
import java.util.Properties; |
109 |
import java.util.PropertyResourceBundle; |
|
110 |
import java.util.ResourceBundle; |
|
111 | 69 |
import java.util.TreeMap; |
112 | 70 |
|
113 | 71 |
import javax.jnlp.BasicService; |
114 | 72 |
import javax.jnlp.ServiceManager; |
115 | 73 |
import javax.jnlp.UnavailableServiceException; |
116 |
|
|
117 | 74 |
import javax.swing.ImageIcon; |
118 | 75 |
import javax.swing.JComponent; |
119 | 76 |
import javax.swing.SwingUtilities; |
120 | 77 |
import javax.swing.UIManager; |
121 | 78 |
|
79 |
import org.apache.log4j.Logger; |
|
80 |
import org.apache.log4j.PatternLayout; |
|
81 |
import org.apache.log4j.PropertyConfigurator; |
|
82 |
import org.apache.log4j.RollingFileAppender; |
|
83 |
import org.exolab.castor.xml.MarshalException; |
|
84 |
import org.exolab.castor.xml.ValidationException; |
|
122 | 85 |
|
86 |
import com.iver.andami.config.generate.Andami; |
|
87 |
import com.iver.andami.config.generate.AndamiConfig; |
|
88 |
import com.iver.andami.config.generate.Plugin; |
|
89 |
import com.iver.andami.messages.Messages; |
|
90 |
import com.iver.andami.messages.NotificationManager; |
|
91 |
import com.iver.andami.plugins.PluginClassLoader; |
|
92 |
import com.iver.andami.plugins.config.generate.ActionTool; |
|
93 |
import com.iver.andami.plugins.config.generate.Depends; |
|
94 |
import com.iver.andami.plugins.config.generate.Extension; |
|
95 |
import com.iver.andami.plugins.config.generate.Extensions; |
|
96 |
import com.iver.andami.plugins.config.generate.LabelSet; |
|
97 |
import com.iver.andami.plugins.config.generate.Menu; |
|
98 |
import com.iver.andami.plugins.config.generate.PluginConfig; |
|
99 |
import com.iver.andami.plugins.config.generate.PopupMenu; |
|
100 |
import com.iver.andami.plugins.config.generate.PopupMenus; |
|
101 |
import com.iver.andami.plugins.config.generate.SelectableTool; |
|
102 |
import com.iver.andami.plugins.config.generate.SkinExtension; |
|
103 |
import com.iver.andami.plugins.config.generate.SkinExtensionType; |
|
104 |
import com.iver.andami.plugins.config.generate.ToolBar; |
|
105 |
import com.iver.andami.ui.AndamiEventQueue; |
|
106 |
import com.iver.andami.ui.MDIManagerLoadException; |
|
107 |
import com.iver.andami.ui.SplashWindow; |
|
108 |
import com.iver.andami.ui.mdiFrame.MDIFrame; |
|
109 |
import com.iver.andami.ui.mdiManager.MDIManagerFactory; |
|
110 |
import com.iver.utiles.XMLEntity; |
|
111 |
import com.iver.utiles.xmlEntity.generate.XmlTag; |
|
112 |
|
|
113 |
|
|
123 | 114 |
/** |
124 | 115 |
* DOCUMENT ME! |
125 | 116 |
* |
... | ... | |
541 | 532 |
private static void installPluginsControls() { |
542 | 533 |
Iterator i = pluginsConfig.keySet().iterator(); |
543 | 534 |
|
535 |
HashMap extensionPluginServices = new HashMap(); |
|
536 |
HashMap extensionPluginConfig = new HashMap(); |
|
537 |
TreeMap orderedExtensions = new TreeMap(new ExtensionComparator()); |
|
544 | 538 |
while (i.hasNext()) { |
545 |
try { |
|
546 | 539 |
String pName = (String) i.next(); |
547 | 540 |
PluginConfig pc = (PluginConfig) pluginsConfig.get(pName); |
548 | 541 |
PluginServices ps = (PluginServices) pluginsServices.get(pName); |
549 | 542 |
|
550 | 543 |
Extension[] exts = pc.getExtensions().getExtension(); |
551 | 544 |
|
552 |
TreeMap orderedExtensions = new TreeMap(new ExtensionComparator()); |
|
553 |
|
|
554 | 545 |
for (int j = 0; j < exts.length; j++) { |
555 | 546 |
if (exts[j].getActive()) { |
556 | 547 |
if (orderedExtensions.containsKey(exts[j])) { |
... | ... | |
560 | 551 |
} |
561 | 552 |
|
562 | 553 |
orderedExtensions.put(exts[j], null); |
554 |
extensionPluginServices.put(exts[j], ps); |
|
555 |
extensionPluginConfig.put(exts[j], pc); |
|
563 | 556 |
} |
564 | 557 |
} |
558 |
} |
|
565 | 559 |
|
566 |
Iterator e = orderedExtensions.keySet().iterator(); |
|
560 |
try { |
|
561 |
Iterator e = orderedExtensions.keySet().iterator(); |
|
567 | 562 |
|
568 |
// Se instalan las extensiones
|
|
569 |
while (e.hasNext()) {
|
|
570 |
Extension ext = (Extension) e.next();
|
|
563 |
// Se instalan las extensiones |
|
564 |
while (e.hasNext()) { |
|
565 |
Extension ext = (Extension) e.next(); |
|
571 | 566 |
|
572 |
ToolBar[] toolbars = ext.getToolBar();
|
|
567 |
ToolBar[] toolbars = ext.getToolBar(); |
|
573 | 568 |
|
574 |
for (int k = 0; k < toolbars.length; k++) {
|
|
575 |
ActionTool[] tools = toolbars[k].getActionTool();
|
|
569 |
for (int k = 0; k < toolbars.length; k++) { |
|
570 |
ActionTool[] tools = toolbars[k].getActionTool(); |
|
576 | 571 |
|
577 |
for (int t = 0; t < tools.length; t++) {
|
|
578 |
frame.addTool(ps.getClassLoader(), ext,
|
|
579 |
toolbars[k], tools[t]);
|
|
580 |
}
|
|
572 |
for (int t = 0; t < tools.length; t++) { |
|
573 |
frame.addTool(((PluginServices)extensionPluginServices.get(ext)).getClassLoader(), ext,
|
|
574 |
toolbars[k], tools[t]); |
|
575 |
} |
|
581 | 576 |
|
582 |
SelectableTool[] sTools = toolbars[k].getSelectableTool();
|
|
577 |
SelectableTool[] sTools = toolbars[k].getSelectableTool(); |
|
583 | 578 |
|
584 |
for (int t = 0; t < sTools.length; t++) { |
|
585 |
frame.addTool(ps.getClassLoader(), ext, |
|
586 |
toolbars[k], sTools[t]); |
|
587 |
} |
|
579 |
for (int t = 0; t < sTools.length; t++) { |
|
580 |
frame.addTool(((PluginServices)extensionPluginServices.get(ext)).getClassLoader(), ext, |
|
581 |
toolbars[k], sTools[t]); |
|
588 | 582 |
} |
589 |
|
|
590 |
/* |
|
591 |
Menu[] menu = ext.getMenu(); |
|
592 |
for (int k = 0; k < menu.length; k++) { |
|
593 |
frame.addMenu(ps.getClassLoader(), ext, menu[k]); |
|
594 |
} |
|
595 |
*/ |
|
596 | 583 |
} |
584 |
} |
|
597 | 585 |
|
586 |
i = pluginsConfig.keySet().iterator(); |
|
587 |
while (i.hasNext()) { |
|
588 |
String pName = (String) i.next(); |
|
589 |
PluginConfig pc = (PluginConfig) pluginsConfig.get(pName); |
|
590 |
PluginServices ps = (PluginServices) pluginsServices.get(pName); |
|
598 | 591 |
// Se instalan las extensiones de MDI |
599 | 592 |
SkinExtension skinExt = pc.getExtensions().getSkinExtension(); |
600 |
|
|
593 |
|
|
601 | 594 |
if (skinExt != null) { |
602 | 595 |
ToolBar[] toolbars = skinExt.getToolBar(); |
603 |
|
|
596 |
|
|
604 | 597 |
for (int k = 0; k < toolbars.length; k++) { |
605 | 598 |
ActionTool[] tools = toolbars[k].getActionTool(); |
606 |
|
|
599 |
|
|
607 | 600 |
for (int t = 0; t < tools.length; t++) { |
608 | 601 |
frame.addTool(ps.getClassLoader(), skinExt, |
609 | 602 |
toolbars[k], tools[t]); |
610 | 603 |
} |
611 |
|
|
604 |
|
|
612 | 605 |
SelectableTool[] sTools = toolbars[k].getSelectableTool(); |
613 |
|
|
606 |
|
|
614 | 607 |
for (int t = 0; t < sTools.length; t++) { |
615 | 608 |
frame.addTool(ps.getClassLoader(), skinExt, |
616 | 609 |
toolbars[k], sTools[t]); |
617 | 610 |
} |
618 | 611 |
} |
619 |
|
|
612 |
|
|
620 | 613 |
/* |
621 | 614 |
Menu[] menu = skinExt.getMenu(); |
622 | 615 |
for (int k = 0; k < menu.length; k++) { |
... | ... | |
624 | 617 |
} |
625 | 618 |
*/ |
626 | 619 |
} |
627 |
|
|
628 | 620 |
//Se instalan los popup menus |
629 | 621 |
PopupMenus pus = pc.getPopupMenus(); |
630 | 622 |
|
... | ... | |
635 | 627 |
frame.addPopupMenu(ps.getClassLoader(), menus[j]); |
636 | 628 |
} |
637 | 629 |
} |
638 |
} catch (ClassNotFoundException e) { |
|
639 |
logger.error(Messages.getString( |
|
640 |
"Launcher.No_se_encontro_la_clase_de_la_extension"), e); |
|
641 | 630 |
} |
631 |
} catch (ClassNotFoundException e) { |
|
632 |
logger.error(Messages.getString( |
|
633 |
"Launcher.No_se_encontro_la_clase_de_la_extension"), e); |
|
642 | 634 |
} |
643 | 635 |
} |
644 | 636 |
|
... | ... | |
1378 | 1370 |
return Integer.MAX_VALUE; |
1379 | 1371 |
} |
1380 | 1372 |
|
1381 |
return e1.getPriority() - e2.getPriority(); |
|
1373 |
if (e1.getPriority() != e2.getPriority()){ |
|
1374 |
return e2.getPriority() - e1.getPriority(); |
|
1375 |
}else{ |
|
1376 |
return (e2.toString().compareTo(e1.toString())); |
|
1377 |
} |
|
1382 | 1378 |
} |
1383 | 1379 |
} |
1384 | 1380 |
|
Also available in: Unified diff