Revision 38564 branches/v2_0_0_prep/frameworks/_fwAndami/src/org/gvsig/andami/ui/mdiFrame/MDIFrame.java
MDIFrame.java | ||
---|---|---|
45 | 45 |
import java.awt.Dimension; |
46 | 46 |
import java.awt.FlowLayout; |
47 | 47 |
import java.awt.Insets; |
48 |
import java.awt.Toolkit; |
|
49 | 48 |
import java.awt.event.ActionEvent; |
50 | 49 |
import java.awt.event.ActionListener; |
51 | 50 |
import java.awt.event.ComponentEvent; |
... | ... | |
73 | 72 |
import javax.swing.JFrame; |
74 | 73 |
import javax.swing.JMenu; |
75 | 74 |
import javax.swing.JMenuBar; |
75 |
import javax.swing.JOptionPane; |
|
76 | 76 |
import javax.swing.JPanel; |
77 | 77 |
import javax.swing.JPopupMenu; |
78 | 78 |
import javax.swing.JSeparator; |
79 |
import javax.swing.KeyStroke; |
|
80 | 79 |
import javax.swing.MenuElement; |
81 | 80 |
import javax.swing.SwingUtilities; |
82 | 81 |
import javax.swing.Timer; |
83 | 82 |
import javax.swing.WindowConstants; |
84 | 83 |
|
84 |
import org.gvsig.andami.IconThemeHelper; |
|
85 | 85 |
import org.gvsig.andami.Launcher; |
86 | 86 |
import org.gvsig.andami.LibraryExtension; |
87 | 87 |
import org.gvsig.andami.PluginServices; |
88 |
import org.gvsig.andami.PluginsLocator; |
|
89 |
import org.gvsig.andami.actioninfo.ActionInfo; |
|
90 |
import org.gvsig.andami.actioninfo.ActionInfoManager; |
|
91 |
import org.gvsig.andami.actioninfo.ActionInfoStatusCache; |
|
88 | 92 |
import org.gvsig.andami.messages.Messages; |
89 |
import org.gvsig.andami.messages.NotificationManager; |
|
90 | 93 |
import org.gvsig.andami.plugins.ExtensionDecorator; |
91 | 94 |
import org.gvsig.andami.plugins.IExtension; |
92 | 95 |
import org.gvsig.andami.plugins.PluginClassLoader; |
... | ... | |
100 | 103 |
import org.gvsig.andami.ui.mdiManager.MDIManager; |
101 | 104 |
import org.gvsig.andami.ui.mdiManager.MDIManagerFactory; |
102 | 105 |
import org.gvsig.gui.beans.controls.IControl; |
106 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
107 |
import org.gvsig.tools.swing.icontheme.IconTheme; |
|
103 | 108 |
import org.slf4j.Logger; |
104 | 109 |
import org.slf4j.LoggerFactory; |
105 | 110 |
|
... | ... | |
269 | 274 |
if (!SwingUtilities.isEventDispatchThread()) { |
270 | 275 |
throw new RuntimeException("No Event Dispatch Thread"); |
271 | 276 |
} |
272 |
|
|
277 |
|
|
278 |
Class<? extends IExtension> classExtension = (Class<? extends IExtension>) loader.loadClass(ext.getClassName()); |
|
279 |
|
|
273 | 280 |
// Para traducir |
274 | 281 |
PluginServices ps = |
275 | 282 |
PluginServices.getPluginServices(loader.getPluginName()); |
... | ... | |
301 | 308 |
btn.setVisible(false); |
302 | 309 |
String name = toolBar.getName(); |
303 | 310 |
|
304 |
MDIManagerFactory.createManager().registerAction(ext.getClassName(), selectableTool); |
|
305 |
|
|
306 | 311 |
SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name); |
307 | 312 |
|
308 | 313 |
if (jtb == null) { |
... | ... | |
330 | 335 |
btn.getActionCommand()); |
331 | 336 |
} |
332 | 337 |
|
333 |
controlClass.put(btn, loader.loadClass(ext.getClassName()));
|
|
338 |
controlClass.put(btn, classExtension);
|
|
334 | 339 |
|
335 | 340 |
if (selectableTool.getName() != null) { |
336 | 341 |
btn.setName(selectableTool.getName()); |
... | ... | |
370 | 375 |
if (!SwingUtilities.isEventDispatchThread()) { |
371 | 376 |
throw new RuntimeException("No Event Dispatch Thread"); |
372 | 377 |
} |
373 |
|
|
378 |
Class<? extends IExtension> classExtension = (Class<? extends IExtension>) loader.loadClass(ext.getClassName()); |
|
379 |
|
|
374 | 380 |
// Para traducir los textos que vengan |
375 | 381 |
PluginServices ps = |
376 | 382 |
PluginServices.getPluginServices(loader.getPluginName()); |
377 | 383 |
|
378 | 384 |
JToolBarButton btn; |
379 |
ImageIcon image = |
|
380 |
PluginServices.getIconTheme().get(actionTool.getIcon(), |
|
381 |
ps.getClassLoader()); |
|
385 |
ImageIcon image = IconThemeHelper.getImageIcon(actionTool.getIcon()); |
|
382 | 386 |
|
383 | 387 |
if (image != null) { |
384 | 388 |
btn = new JToolBarButton(actionTool.getText(), image); |
... | ... | |
398 | 402 |
btn.setEnabled(false); |
399 | 403 |
btn.setVisible(false); |
400 | 404 |
|
401 |
MDIManagerFactory.createManager().registerAction(ext.getClassName(), actionTool); |
|
402 |
|
|
403 | 405 |
String name = toolBar.getName(); |
404 | 406 |
|
405 | 407 |
SelectableToolBar jtb = (SelectableToolBar) toolBarMap.get(name); |
... | ... | |
414 | 416 |
|
415 | 417 |
jtb.add(btn); |
416 | 418 |
|
417 |
controlClass.put(btn, loader.loadClass(ext.getClassName()));
|
|
419 |
controlClass.put(btn, classExtension);
|
|
418 | 420 |
|
419 | 421 |
if (actionTool.getName() != null) { |
420 | 422 |
btn.setName(actionTool.getName()); |
... | ... | |
511 | 513 |
if (!SwingUtilities.isEventDispatchThread()) { |
512 | 514 |
throw new RuntimeException("No Event Dispatch Thread"); |
513 | 515 |
} |
516 |
JMenu menuPadre = createMenuAncestors(menu, loader); |
|
514 | 517 |
|
515 |
JMenu menuPadre = createMenuAncestors(menu, loader); |
|
516 |
|
|
517 |
// Se registra y a�ade el menu |
|
518 |
/* |
|
519 |
* String[] aux = menu.getText().split("/"); |
|
520 |
* |
|
521 |
* if (aux.length == 2) |
|
522 |
* if (aux[1].equals("----")) |
|
523 |
* { |
|
524 |
* menuPadre.addSeparator(); |
|
525 |
* return; |
|
526 |
* } |
|
527 |
*/ |
|
528 | 518 |
if (menu.getIs_separator()) { |
529 | 519 |
menuPadre.addSeparator(); |
530 | 520 |
return; |
... | ... | |
532 | 522 |
|
533 | 523 |
JMenuItem nuevoMenu = createJMenuItem(loader, menu); |
534 | 524 |
nuevoMenu.addMouseListener(tooltipListener); |
535 |
nuevoMenu.addActionListener(this); |
|
525 |
//nuevoMenu.addActionListener(this);
|
|
536 | 526 |
menuPadre.add(nuevoMenu); |
537 |
controlClass.put(nuevoMenu, loader.loadClass(ext.getClassName())); |
|
538 |
|
|
539 |
MDIManagerFactory.createManager().registerAction(ext.getClassName(), menu); |
|
540 |
|
|
541 |
|
|
527 |
Class<? extends IExtension> classExtension = (Class<? extends IExtension>) loader.loadClass(ext.getClassName()); |
|
528 |
controlClass.put(nuevoMenu, classExtension); |
|
542 | 529 |
} |
543 | 530 |
|
544 | 531 |
/** |
... | ... | |
743 | 730 |
* Evento producido |
744 | 731 |
*/ |
745 | 732 |
public void actionPerformed(ActionEvent e) { |
746 |
Object control = e.getSource(); |
|
747 |
org.gvsig.andami.plugins.IExtension ext = |
|
748 |
(org.gvsig.andami.plugins.IExtension) classesExtensions |
|
749 |
.get(controlClass.get(control)); |
|
750 |
String actionCommand = e.getActionCommand();
|
|
733 |
|
|
734 |
// org.gvsig.andami.plugins.IExtension ext =
|
|
735 |
// (org.gvsig.andami.plugins.IExtension) classesExtensions
|
|
736 |
// .get(controlClass.get(control));
|
|
737 |
String actionName = "(unknow)";
|
|
751 | 738 |
try { |
752 |
logger.info("{}.execute('{}')", ext.getClass().getSimpleName(), actionCommand); |
|
753 |
ext.execute(actionCommand); |
|
739 |
JComponent control = (JComponent) e.getSource(); |
|
740 |
actionName = control.getName(); |
|
741 |
|
|
742 |
ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
743 |
ActionInfo action = actionManager.getAction(control.getName()); |
|
744 |
Object args = null; |
|
745 |
if( control instanceof IControl ) { |
|
746 |
args = ((IControl) control).getValue(); |
|
747 |
} |
|
748 |
if( args == null ) { |
|
749 |
action.execute(); |
|
750 |
} else { |
|
751 |
action.execute(args); |
|
752 |
} |
|
753 |
|
|
754 |
// logger.info("{}.execute('{}')", ext.getClass().getSimpleName(), actionCommand); |
|
755 |
// ext.execute(actionCommand); |
|
754 | 756 |
|
757 |
String actionCommand = e.getActionCommand(); |
|
755 | 758 |
try { |
756 | 759 |
JToolBarToggleButton toggle = (JToolBarToggleButton) control; |
757 | 760 |
ToggleButtonModel model = (ToggleButtonModel) toggle.getModel(); |
... | ... | |
760 | 763 |
} catch (NullPointerException ex) { |
761 | 764 |
} |
762 | 765 |
|
763 |
} catch (RuntimeException t) { |
|
764 |
if (ext == null) { |
|
765 |
logger.error(Messages |
|
766 |
.getString("No_extension_associated_with_this_event_") |
|
767 |
+ e.getActionCommand()); |
|
768 |
} |
|
769 |
NotificationManager.addError(Messages |
|
770 |
.getString("MDIFrame.Error_no_capturado_por_el_usuario"), t); |
|
766 |
} catch (Throwable ex) { |
|
767 |
logger.error("Can't perform action '"+actionName+"'.",ex); |
|
768 |
// if (ext == null) { |
|
769 |
// logger.error(Messages |
|
770 |
// .getString("No_extension_associated_with_this_event_") |
|
771 |
// + e.getActionCommand()); |
|
772 |
// } |
|
773 |
// NotificationManager.addError(Messages |
|
774 |
// .getString("MDIFrame.Error_no_capturado_por_el_usuario"), t); |
|
771 | 775 |
} |
772 | 776 |
|
773 | 777 |
enableControls(); |
... | ... | |
818 | 822 |
popupMap.put(name, popupMenu); |
819 | 823 |
} |
820 | 824 |
|
821 |
// Se a�aden las entradas |
|
822 | 825 |
Menu[] menues = menu.getMenu(); |
823 |
|
|
824 | 826 |
for (int i = 0; i < menues.length; i++) { |
825 |
// Se registra y a�ade el menu |
|
826 | 827 |
JMenuItem nuevoMenu = createJMenuItem(loader, menues[i]); |
827 |
|
|
828 | 828 |
popupMenu.add(nuevoMenu); |
829 | 829 |
} |
830 | 830 |
} |
... | ... | |
845 | 845 |
|
846 | 846 |
PluginServices ps = |
847 | 847 |
PluginServices.getPluginServices(loader.getPluginName()); |
848 |
|
|
848 | 849 |
String text = menu.getText(); |
849 |
text = text.substring(text.lastIndexOf('/') + 1); |
|
850 |
int n = text.lastIndexOf('/'); |
|
851 |
if( n>=0 ) { |
|
852 |
text = text.substring(n + 1); |
|
853 |
} |
|
850 | 854 |
String translatedText = ps.getText(text); |
851 | 855 |
|
856 |
IconTheme iconTheme = ToolsSwingLocator.getIconThemeManager().getCurrent(); |
|
852 | 857 |
if (menu.getIcon() != null) { |
853 |
ImageIcon image = |
|
854 |
PluginServices.getIconTheme().get(menu.getIcon(), |
|
855 |
ps.getClassLoader()); |
|
856 |
if (image != null) { |
|
858 |
if( iconTheme.exists(menu.getIcon()) ) { |
|
859 |
ImageIcon image = iconTheme.get(menu.getIcon()); |
|
857 | 860 |
nuevoMenu = new JMenuItem(translatedText, image); |
858 | 861 |
} else { |
859 |
nuevoMenu = |
|
860 |
new JMenuItem(translatedText, PluginServices.getIconTheme() |
|
861 |
.get(noIcon)); |
|
862 |
logger.error(PluginServices |
|
863 |
.getText(this, "Unable_to_find_icon") |
|
864 |
+ ": " |
|
865 |
+ menu.getIcon()); |
|
862 |
nuevoMenu = new JMenuItem(translatedText); |
|
863 |
logger.info("menu icon '"+ menu.getIcon()+ "' not exists."); |
|
866 | 864 |
} |
867 | 865 |
} else { |
868 | 866 |
nuevoMenu = new JMenuItem(translatedText); |
869 | 867 |
} |
870 |
nuevoMenu.setName(text); |
|
871 |
if (menu.getMnemonic() != null) { |
|
872 |
if (menu.getMnemonic().length() != 1) { |
|
873 |
throw new RuntimeException( |
|
874 |
"Mnemonic must be 1 character length"); |
|
875 |
} |
|
868 |
nuevoMenu.setName(menu.getName()); |
|
869 |
// if (menu.getMnemonic() != null) { |
|
870 |
// if (menu.getMnemonic().length() != 1) { |
|
871 |
// throw new RuntimeException( |
|
872 |
// "Mnemonic must be 1 character length"); |
|
873 |
// } |
|
874 |
// nuevoMenu.setMnemonic(KeyMapping.getKey(menu.getMnemonic() |
|
875 |
// .charAt(0))); |
|
876 |
// } |
|
876 | 877 |
|
877 |
nuevoMenu.setMnemonic(KeyMapping.getKey(menu.getMnemonic() |
|
878 |
.charAt(0))); |
|
879 |
} |
|
880 |
|
|
881 | 878 |
if (menu.getKey() != null) { |
882 |
String osName = System.getProperty("os.name"); |
|
883 |
boolean MAC_OS_X = osName.toLowerCase().startsWith("mac os x"); |
|
884 |
if (MAC_OS_X) { |
|
885 |
// en OS X, en vez de hardwiring la ShortcutKey, usamos el |
|
886 |
// default sugerido por el OS |
|
887 |
nuevoMenu.setAccelerator(KeyStroke.getKeyStroke(KeyMapping |
|
888 |
.getKey(menu.getKey().charAt(0)), Toolkit |
|
889 |
.getDefaultToolkit().getMenuShortcutKeyMask())); |
|
890 |
} else { |
|
891 |
nuevoMenu.setAccelerator(KeyStroke.getKeyStroke( |
|
892 |
KeyMapping.getKey(menu.getKey().charAt(0)), |
|
893 |
ActionEvent.ALT_MASK)); |
|
894 |
} |
|
879 |
nuevoMenu.setAccelerator(KeyMapping.getKeyStroke(menu.getKey())); |
|
895 | 880 |
} |
896 | 881 |
|
897 | 882 |
nuevoMenu.setActionCommand(menu.getActionCommand()); |
... | ... | |
907 | 892 |
nuevoMenu.setEnabled(true); |
908 | 893 |
nuevoMenu.setVisible(true); |
909 | 894 |
|
895 |
if( menu.getName() != null ) { |
|
896 |
ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
897 |
final ActionInfo actionInfo = actionManager.getAction(menu.getName()); |
|
898 |
if( actionInfo != null ) { |
|
899 |
nuevoMenu.addActionListener(actionInfo); |
|
900 |
} |
|
901 |
} |
|
910 | 902 |
return nuevoMenu; |
911 | 903 |
} |
912 | 904 |
|
... | ... | |
1004 | 996 |
*/ |
1005 | 997 |
public void enableControls() { |
1006 | 998 |
if (!SwingUtilities.isEventDispatchThread()) { |
1007 |
throw new RuntimeException("No Event Dispatch Thread"); |
|
999 |
SwingUtilities.invokeLater(new Runnable() { |
|
1000 |
public void run() { |
|
1001 |
enableControls(); |
|
1002 |
} |
|
1003 |
}); |
|
1004 |
return; |
|
1008 | 1005 |
} |
1009 | 1006 |
|
1007 |
ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
1008 |
ActionInfoStatusCache cache = actionManager.createActionStatusCache(); |
|
1009 |
|
|
1010 | 1010 |
Iterator e = classesExtensions.values().iterator(); |
1011 |
HashMap estadoExtensiones = new HashMap(); |
|
1012 |
HashMap visibilidadExtensiones = new HashMap(); |
|
1013 | 1011 |
|
1014 |
while (e.hasNext()) { |
|
1015 |
ExtensionDecorator ext = (ExtensionDecorator) e.next(); |
|
1012 |
// HashMap estadoExtensiones = new HashMap(); |
|
1013 |
// HashMap visibilidadExtensiones = new HashMap(); |
|
1014 |
// |
|
1015 |
// while (e.hasNext()) { |
|
1016 |
// ExtensionDecorator ext = (ExtensionDecorator) e.next(); |
|
1017 |
// |
|
1018 |
// try { |
|
1019 |
// if (estadoExtensiones.get(ext) == null) { |
|
1020 |
// boolean b; |
|
1021 |
// if (ext.getVisibility() == ExtensionDecorator.ALWAYS_VISIBLE) { |
|
1022 |
// b = true; |
|
1023 |
// } else |
|
1024 |
// if (ext.getVisibility() == ExtensionDecorator.ALWAYS_INVISIBLE) { |
|
1025 |
// b = false; |
|
1026 |
// } else { |
|
1027 |
// if (PluginServices.getExclusiveUIExtension() == null) { |
|
1028 |
// b = ext.isVisible(); |
|
1029 |
// } else { |
|
1030 |
// b = |
|
1031 |
// PluginServices.getExclusiveUIExtension() |
|
1032 |
// .isVisible(ext.getExtension()); |
|
1033 |
// } |
|
1034 |
// } |
|
1035 |
// Boolean visible = new Boolean(b); |
|
1036 |
// Boolean enabled = new Boolean(false); |
|
1037 |
// |
|
1038 |
// if (visible.booleanValue()) { |
|
1039 |
// if (PluginServices.getExclusiveUIExtension() == null) { |
|
1040 |
// enabled = new Boolean(ext.isEnabled()); |
|
1041 |
// } else { |
|
1042 |
// enabled = |
|
1043 |
// new Boolean(PluginServices |
|
1044 |
// .getExclusiveUIExtension().isEnabled( |
|
1045 |
// ext.getExtension())); |
|
1046 |
// } |
|
1047 |
// |
|
1048 |
// } |
|
1049 |
// |
|
1050 |
// estadoExtensiones.put(ext, enabled); |
|
1051 |
// visibilidadExtensiones.put(ext, visible); |
|
1052 |
// } |
|
1053 |
// } catch (Throwable e1) { |
|
1054 |
// NotificationManager.addError(Messages |
|
1055 |
// .getString("MDIFrame.Error_no_capturado_por_el_usuario"), |
|
1056 |
// e1); |
|
1057 |
// estadoExtensiones.put(ext, Boolean.FALSE); |
|
1058 |
// } |
|
1059 |
// } |
|
1016 | 1060 |
|
1017 |
try { |
|
1018 |
if (estadoExtensiones.get(ext) == null) { |
|
1019 |
boolean b; |
|
1020 |
if (ext.getVisibility() == ExtensionDecorator.ALWAYS_VISIBLE) { |
|
1021 |
b = true; |
|
1022 |
} else |
|
1023 |
if (ext.getVisibility() == ExtensionDecorator.ALWAYS_INVISIBLE) { |
|
1024 |
b = false; |
|
1025 |
} else { |
|
1026 |
if (PluginServices.getExclusiveUIExtension() == null) { |
|
1027 |
b = ext.isVisible(); |
|
1028 |
} else { |
|
1029 |
b = |
|
1030 |
PluginServices.getExclusiveUIExtension() |
|
1031 |
.isVisible(ext.getExtension()); |
|
1032 |
} |
|
1033 |
} |
|
1034 |
Boolean visible = new Boolean(b); |
|
1035 |
Boolean enabled = new Boolean(false); |
|
1036 |
|
|
1037 |
if (visible.booleanValue()) { |
|
1038 |
if (PluginServices.getExclusiveUIExtension() == null) { |
|
1039 |
enabled = new Boolean(ext.isEnabled()); |
|
1040 |
} else { |
|
1041 |
enabled = |
|
1042 |
new Boolean(PluginServices |
|
1043 |
.getExclusiveUIExtension().isEnabled( |
|
1044 |
ext.getExtension())); |
|
1045 |
} |
|
1046 |
|
|
1047 |
} |
|
1048 |
|
|
1049 |
estadoExtensiones.put(ext, enabled); |
|
1050 |
visibilidadExtensiones.put(ext, visible); |
|
1051 |
} |
|
1052 |
} catch (Throwable e1) { |
|
1053 |
NotificationManager.addError(Messages |
|
1054 |
.getString("MDIFrame.Error_no_capturado_por_el_usuario"), |
|
1055 |
e1); |
|
1056 |
estadoExtensiones.put(ext, Boolean.FALSE); |
|
1057 |
} |
|
1058 |
} |
|
1059 |
|
|
1060 | 1061 |
// Enable or disable controls, according to its associated extensions |
1061 | 1062 |
e = controlClass.keySet().iterator(); |
1062 | 1063 |
|
1063 | 1064 |
while (e.hasNext()) { |
1064 | 1065 |
JComponent control = (JComponent) e.next(); |
1066 |
String actionlName = control.getName(); |
|
1067 |
ActionInfo action = actionManager.getAction(actionlName); |
|
1068 |
try { |
|
1069 |
// |
|
1070 |
// org.gvsig.andami.plugins.IExtension ext = |
|
1071 |
// (org.gvsig.andami.plugins.IExtension) classesExtensions |
|
1072 |
// .get(controlClass.get(control)); |
|
1073 |
// boolean enabled = |
|
1074 |
// ((Boolean) estadoExtensiones.get(ext)).booleanValue(); |
|
1075 |
// boolean visible = |
|
1076 |
// ((Boolean) visibilidadExtensiones.get(ext)).booleanValue(); |
|
1065 | 1077 |
|
1066 |
try { |
|
1067 |
org.gvsig.andami.plugins.IExtension ext = |
|
1068 |
(org.gvsig.andami.plugins.IExtension) classesExtensions |
|
1069 |
.get(controlClass.get(control)); |
|
1070 |
boolean enabled = |
|
1071 |
((Boolean) estadoExtensiones.get(ext)).booleanValue(); |
|
1072 |
boolean visible = |
|
1073 |
((Boolean) visibilidadExtensiones.get(ext)).booleanValue(); |
|
1078 |
boolean enabled = false; |
|
1079 |
boolean visible = cache.isVisible(action); |
|
1080 |
if( visible ) { |
|
1081 |
enabled = cache.isEnabled(action); |
|
1082 |
} |
|
1083 |
|
|
1074 | 1084 |
control.setEnabled(enabled); |
1075 | 1085 |
control.setVisible(visible); |
1076 | 1086 |
} catch (Exception ex) { |
1087 |
logger.info("Can't enable/show control '"+actionlName +"'.",ex); |
|
1088 |
this.message("Can't enable/show control '"+actionlName +"'.", JOptionPane.ERROR_MESSAGE); |
|
1077 | 1089 |
control.setEnabled(false); |
1078 | 1090 |
control.setVisible(false); |
1079 | 1091 |
} |
... | ... | |
1146 | 1158 |
|
1147 | 1159 |
showMemory(); |
1148 | 1160 |
} |
1161 |
|
|
1162 |
public void refreshControls() { |
|
1163 |
if (!SwingUtilities.isEventDispatchThread()) { |
|
1164 |
SwingUtilities.invokeLater(new Runnable() { |
|
1165 |
public void run() { |
|
1166 |
enableControls(); |
|
1167 |
} |
|
1168 |
}); |
|
1169 |
return; |
|
1170 |
} |
|
1149 | 1171 |
|
1150 |
/** |
|
1172 |
ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
1173 |
ActionInfoStatusCache cache = actionManager.createActionStatusCache(); |
|
1174 |
|
|
1175 |
Iterator e = controlClass.keySet().iterator(); |
|
1176 |
|
|
1177 |
while (e.hasNext()) { |
|
1178 |
JComponent control = (JComponent) e.next(); |
|
1179 |
String actionlName = control.getName(); |
|
1180 |
ActionInfo action = actionManager.getAction(actionlName); |
|
1181 |
if( action!=null ) { |
|
1182 |
if( control instanceof AbstractButton ) { |
|
1183 |
AbstractButton button = (AbstractButton) control; |
|
1184 |
button.setIcon(action.getIcon()); |
|
1185 |
} |
|
1186 |
} |
|
1187 |
} |
|
1188 |
enableControls(); |
|
1189 |
} |
|
1190 |
|
|
1191 |
public void message(String msg, int messageTyoe) { |
|
1192 |
this.getStatusBar().message(msg, messageTyoe); |
|
1193 |
} |
|
1194 |
|
|
1195 |
/** |
|
1151 | 1196 |
* Establece la visibilidad de un menu y todos sus descendientes en la |
1152 | 1197 |
* jerarquia teniendo en cuenta la visibilidad de todos los submenus. |
1153 | 1198 |
* |
... | ... | |
1479 | 1524 |
// Se registra y a�ade el menu |
1480 | 1525 |
JMenuItem nuevoMenu = createJMenuItem(loader, menu); |
1481 | 1526 |
nuevoMenu.addMouseListener(tooltipListener); |
1482 |
nuevoMenu.addActionListener(listener); |
|
1527 |
if( listener != null ) { |
|
1528 |
ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
1529 |
final ActionInfo actionInfo = actionManager.getAction(menu.getName()); |
|
1530 |
if( actionInfo != null ) { |
|
1531 |
nuevoMenu.removeActionListener(actionInfo); |
|
1532 |
} |
|
1533 |
nuevoMenu.addActionListener(listener); |
|
1534 |
} |
|
1483 | 1535 |
menuPadre.add(nuevoMenu); |
1484 | 1536 |
|
1485 | 1537 |
infoCodedMenus.put(menu, nuevoMenu); |
Also available in: Unified diff