Index: MDIFrame.java
===================================================================
--- MDIFrame.java	(revision 38610)
+++ MDIFrame.java	(revision 38611)
@@ -76,6 +76,7 @@
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
 import javax.swing.JSeparator;
+import javax.swing.JToolBar;
 import javax.swing.MenuElement;
 import javax.swing.SwingUtilities;
 import javax.swing.Timer;
@@ -113,6 +114,7 @@
  * 
  * @version $Revision$
  */
+@SuppressWarnings("unchecked")
 public class MDIFrame extends JFrame implements ComponentListener,
     ContainerListener, ActionListener, MainFrame {
 
@@ -167,7 +169,7 @@
     private ArrayList progressListeners = new ArrayList();
 
     /** Timer para invocar los enventos de la interfaz anterior */
-    private Timer progressTimer = null;
+	private Timer progressTimer = null;
 
     /** Tabla hash que asocia las clases con las extensiones */
     private Map classesExtensions = new HashMap<Class<? extends IExtension>, ExtensionDecorator>();
@@ -177,7 +179,8 @@
 
     /** Instancia que pone los tooltip en la barra de estado */
     private TooltipListener tooltipListener = new TooltipListener();
-    private HashMap infoCodedMenus = new HashMap();
+    
+	private HashMap infoCodedMenus = new HashMap();
 
     private String titlePrefix;
 
@@ -190,7 +193,7 @@
      *             DOCUMENT ME!
      */
     public void init() {
-        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
+    	JPopupMenu.setDefaultLightWeightPopupEnabled(false);
         if (!SwingUtilities.isEventDispatchThread()) {
             throw new RuntimeException("Not Event Dispatch Thread");
         }
@@ -1066,21 +1069,21 @@
             String actionlName = control.getName();
             ActionInfo action = actionManager.getAction(actionlName);
             try {
-//            	
-//                org.gvsig.andami.plugins.IExtension ext =
-//                    (org.gvsig.andami.plugins.IExtension) classesExtensions
-//                        .get(controlClass.get(control));
-//                boolean enabled =
-//                    ((Boolean) estadoExtensiones.get(ext)).booleanValue();
-//                boolean visible =
-//                    ((Boolean) visibilidadExtensiones.get(ext)).booleanValue();
-
                 boolean enabled = false;
-                boolean visible = cache.isVisible(action);
-                if( visible ) {
-                	enabled = cache.isEnabled(action);
-                }
-                    
+                boolean visible = false;
+                
+            	if(action == null) {
+                  IExtension ext =
+                	  (IExtension) classesExtensions.get(controlClass.get(control));
+                  enabled = ext.isEnabled();
+                  visible = ext.isVisible(); 
+            	} else {
+            		enabled = false;
+                    visible = cache.isVisible(action);
+                    if( visible ) {
+                    	enabled = cache.isEnabled(action);
+                    }
+            	}
                 control.setEnabled(enabled);
                 control.setVisible(visible);
             } catch (Exception ex) {
@@ -1120,7 +1123,7 @@
         Iterator it = toolBarMap.values().iterator();
 
         while (it.hasNext()) {
-            SelectableToolBar t = (SelectableToolBar) it.next();
+        	JComponent t = (JComponent) it.next();
             boolean todosOcultos = true;
 
             for (int i = 0; i < t.getComponentCount(); i++) {
@@ -1134,7 +1137,10 @@
             if (todosOcultos) {
                 t.setVisible(false);
             } else {
-                t.setVisible(t.getAndamiVisibility());
+            	if(t instanceof SelectableToolBar) {
+            		t.setVisible(((SelectableToolBar)t).getAndamiVisibility());
+            	} else
+            		t.setVisible(true);
             }
         }
 
@@ -1491,6 +1497,12 @@
         bEstado.addControl(control.getName(), (Component) control);
         controlClass.put(control, extensionClass);
     }
+    
+    public void addToolBarControl(Class extensionClass, JToolBar control, String name) {
+        //toolBarMap.put(name, control); 
+        toolBars.add(control);
+        controlClass.put(control, extensionClass);
+    }
 
     public void removeStatusBarControl(String name) {
         Component c = bEstado.removeControl(name);
@@ -1675,7 +1687,7 @@
         }
         Iterator it = toolBarMap.values().iterator();
         while (it.hasNext()) {
-            SelectableToolBar t = (SelectableToolBar) it.next();
+        	JComponent t = (JComponent) it.next();
             String nameCtrl = t.getName();
             if (nameCtrl != null) {
                 if (nameCtrl.compareTo(name) == 0) {
