Index: ShowDevelInfoExtension.java
===================================================================
--- ShowDevelInfoExtension.java	(revision 38563)
+++ ShowDevelInfoExtension.java	(revision 38564)
@@ -1,50 +1,19 @@
 package org.gvsig.app.extension;
 
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTextPane;
-
-import org.gvsig.andami.iconthemes.IIconTheme;
-import org.gvsig.andami.iconthemes.IconThemeManager;
 import org.gvsig.andami.plugins.Extension;
-import org.gvsig.andami.ui.mdiManager.MDIManager.UIActionTool;
-import org.gvsig.andami.ui.mdiManager.MDIManagerFactory;
-import org.gvsig.app.ApplicationLocator;
+import org.gvsig.app.extension.develtools.ActionsInfoDevelTool;
+import org.gvsig.app.extension.develtools.IconThemeDevelTool;
+import org.gvsig.app.extension.develtools.MenusDevelTool;
+import org.gvsig.app.extension.develtools.PersistenceDevelTool;
 import org.gvsig.tools.ToolsLocator;
-import org.gvsig.tools.dataTypes.DataTypesManager;
-import org.gvsig.tools.dynobject.DynField;
-import org.gvsig.tools.dynobject.DynStruct;
-import org.gvsig.tools.persistence.PersistenceFactory;
 import org.gvsig.tools.persistence.PersistenceManager;
-import org.gvsig.tools.persistence.Persistent;
 import org.gvsig.tools.persistence.exception.PersistenceException;
-import org.gvsig.tools.swing.api.ToolsSwingLocator;
-import org.gvsig.tools.swing.api.windowmanager.WindowManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ShowDevelInfoExtension extends Extension {
 
-	private Logger logger = LoggerFactory
+	private static Logger logger = LoggerFactory
 			.getLogger(ShowDevelInfoExtension.class);
 
 	public void initialize() {
@@ -66,125 +35,20 @@
 	}
 
 	public void execute(String actionCommand) {
-		if ("ShowPersistenceFactories".equalsIgnoreCase(actionCommand)) {
-			showInfoPanel("Persistence factories", WindowManager.MODE.WINDOW,
-					this.getPersistenceFactories());
-		} else if ("ShowIconThemeInformation".equalsIgnoreCase(actionCommand)) {
-			showInfoPanel("Icon theme information", WindowManager.MODE.WINDOW,
-					this.getIconThemeInformation());
-		} else if ("ShowActionsInformation".equalsIgnoreCase(actionCommand)) {
-			showInfoPanel("Actions information", WindowManager.MODE.WINDOW,
-					this.getActionsInformation());
+		if ("tools-devel-show-persistencefactories".equalsIgnoreCase(actionCommand)) {
+			new PersistenceDevelTool().showPersistenceFactories();
+		} else if ("tools-devel-show-icontheme".equalsIgnoreCase(actionCommand)) {
+			new IconThemeDevelTool().showDefaultIconTheme();
+		} else if ("tools-devel-show-actions".equalsIgnoreCase(actionCommand)) {
+			new ActionsInfoDevelTool().showActions();
+		} else if ("tools-devel-show-menus".equalsIgnoreCase(actionCommand)) {
+			new MenusDevelTool().showAllMenus();
+		} else if ("tools-devel-show-menus-by-plugin".equalsIgnoreCase(actionCommand)) {
+			new MenusDevelTool().showAllMenusByPlugin();
 		}
-
 	}
 
-	private String getActionsInformation() {
-		StringBuffer buffer = new StringBuffer();
 
-		buffer.append("<html>\n");
-		buffer.append("<body>\n");
-		buffer.append("<h2>Actions information</h2>\n");
-		buffer.append("<br>\n");
-
-		buffer.append("<table border=\"0\">\n");
-		buffer.append("  <tr>\n");
-		buffer.append("    <td>Name</td>\n");
-		buffer.append("    <td>Extension</td>\n");
-		buffer.append("    <td>Position</td>\n");
-		buffer.append("    <td>Text</td>\n");
-		buffer.append("    <td>Command</td>\n");
-		buffer.append("    <td>Icon</td>\n");
-		buffer.append("    <td>Tip</td>\n");
-		buffer.append("    <td>Enabled text</td>\n");
-		buffer.append("  </tr>\n");
-		Iterator<UIActionTool> actions = MDIManagerFactory.createManager()
-				.getActionTools();
-		while (actions.hasNext()) {
-			UIActionTool action = actions.next();
-			buffer.append("  <tr>\n");
-			buffer.append("    <td>").append(action.getName())
-					.append("</td>\n");
-			buffer.append("    <td>").append(action.getExtensionName())
-					.append("</td>\n");
-			buffer.append("    <td>").append(action.getPosition())
-					.append("</td>\n");
-			buffer.append("    <td>").append(action.getText())
-					.append("</td>\n");
-			buffer.append("    <td>").append(action.getCommand())
-					.append("</td>\n");
-			buffer.append("    <td>").append(action.getIconName())
-					.append("</td>\n");
-			buffer.append("    <td>").append(action.getTooptip())
-					.append("</td>\n");
-			buffer.append("    <td>").append(action.getEnableText())
-					.append("</td>\n");
-			buffer.append("  </tr>\n");
-		}
-		buffer.append("</table>\n");
-		buffer.append("</body>\n");
-		buffer.append("</html>\n");
-
-		save2file("actionsinfo", buffer.toString());
-
-		return buffer.toString();
-	}
-
-	private String getIconThemeInformation() {
-		StringBuffer buffer = new StringBuffer();
-
-		IconThemeManager manager = IconThemeManager.getIconThemeManager();
-		IIconTheme theme = manager.getCurrent();
-
-		buffer.append("<html>\n");
-		buffer.append("<body>\n");
-		buffer.append("<h2>Icon theme information</h2>\n");
-		buffer.append("<br>\n");
-		buffer.append("Theme: ");
-		buffer.append(theme.getName());
-		buffer.append("<br>\n");
-		buffer.append("Description: ");
-		buffer.append(theme.getDescription());
-		buffer.append("<br>\n");
-		buffer.append("Version: ");
-		buffer.append(theme.getVersion());
-		buffer.append("<br>\n");
-
-		buffer.append("<table border=\"0\">\n");
-		buffer.append("  <tr>\n");
-		buffer.append("    <td>Name</td>\n");
-		buffer.append("    <td>Resource id</td>\n");
-		buffer.append("  </tr>\n");
-		Iterator<String> names = theme.iterator();
-		while (names.hasNext()) {
-			String name = names.next();
-			buffer.append("  <tr>\n");
-			buffer.append("    <td>").append(name).append("</td>\n");
-			buffer.append("    <td>").append(theme.getResourceID(name))
-					.append("</td>\n");
-			buffer.append("  </tr>\n");
-		}
-		buffer.append("</table>\n");
-		buffer.append("</body>\n");
-		buffer.append("</html>\n");
-
-		save2file("iconthemeinfo", buffer.toString());
-
-		return buffer.toString();
-	}
-
-	private void save2file(String name, String contents) {
-		File file;
-		try {
-			file = File.createTempFile("gvsig-" + name, ".html");
-			FileWriter fwriter = new FileWriter(file);
-			fwriter.append(contents);
-			fwriter.close();
-		} catch (IOException e) {
-			logger.warn("Can't save contents to temp file gvsig-" + name, e);
-		}
-	}
-
 	public boolean isEnabled() {
 		return true;
 	}
@@ -192,280 +56,4 @@
 	public boolean isVisible() {
 		return true;
 	}
-
-	private void showInfoPanel(String title, WindowManager.MODE mode,
-			String html) {
-		JPanel panel = new JInfoPanel(html);
-		WindowManager wm = ToolsSwingLocator.getWindowManager();
-		wm.showWindow(panel, title, mode);
-	}
-
-	private class JInfoPanel extends JPanel {
-		/**
-		 * 
-		 */
-		private static final long serialVersionUID = 7164653790859770568L;
-
-		private JButton accept = null;
-		private JButton copy = null;
-		private JTextPane text = null;
-
-		public JInfoPanel(final String html) {
-			this.setLayout(new BorderLayout());
-			this.setPreferredSize(new Dimension(500, 300));
-			this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
-
-			text = new JTextPane();
-			text.setContentType("text/html");
-			text.setEditable(false);
-			text.setText(html);
-			text.setCaretPosition(0);
-
-			JScrollPane scrollPane = new JScrollPane(text);
-			scrollPane.setPreferredSize(new Dimension(500, 220));
-
-			accept = new JButton("Accept");
-			accept.addActionListener(new ActionListener() {
-				public void actionPerformed(ActionEvent arg0) {
-					setVisible(false);
-				}
-			});
-			copy = new JButton("Copy to clipboard");
-			copy.addActionListener(new ActionListener() {
-				public void actionPerformed(ActionEvent arg0) {
-					ApplicationLocator.getManager().putInClipboard(
-							text.getText());
-				}
-			});
-
-			JPanel buttonsPanel = new JPanel();
-			buttonsPanel.setLayout(new BoxLayout(buttonsPanel,
-					BoxLayout.LINE_AXIS));
-			buttonsPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
-
-			buttonsPanel.add(Box.createHorizontalGlue());
-			buttonsPanel.add(copy);
-			buttonsPanel.add(accept);
-
-			this.add(scrollPane, BorderLayout.CENTER);
-			this.add(buttonsPanel, BorderLayout.SOUTH);
-			this.setVisible(true);
-		}
-	}
-
-	public class PersistenceInfo implements Comparable<PersistenceInfo> {
-		PersistenceFactory factory;
-		@SuppressWarnings("rawtypes")
-		Class theClass;
-		DynStruct definition;
-
-		PersistenceInfo(PersistenceFactory factory,
-				@SuppressWarnings("rawtypes") Class theClass,
-				DynStruct definition) {
-			this.factory = factory;
-			this.theClass = theClass;
-			this.definition = definition;
-		}
-
-		String getDefinitionName() {
-			if (definition == null) {
-				return "";
-			}
-			return definition.getFullName();
-		}
-
-		String getDefinitionDescription() {
-			if (definition == null) {
-				return "";
-			}
-			return definition.getDescription();
-		}
-
-		String getClassName() {
-			if (theClass == null) {
-				return "";
-			}
-			return theClass.getName();
-		}
-
-		String getFactoryName() {
-			if (factory == null) {
-				return "";
-			}
-			return factory.getClass().getName();
-		}
-
-		public int compareTo(PersistenceInfo other) {
-			int r = this.factory.getClass().getName()
-					.compareTo(other.factory.getClass().getName());
-			if (r == 0) {
-				return this.theClass.getName().compareTo(
-						other.theClass.getName());
-			}
-			return r;
-		}
-	}
-
-	@SuppressWarnings("rawtypes")
-	public class ClassComparator implements Comparator {
-
-		public int compare(Object o1, Object o2) {
-			if (o1 == null || o2 == null || ((Class) o1).getName() == null) {
-				logger.warn("Esto no deberia estar pasando.");
-				return 0; // FIXME
-			}
-			return ((Class) o1).getName().compareTo(((Class) o2).getName());
-		}
-
-	}
-
-	@SuppressWarnings({ "unchecked", "rawtypes" })
-	private String getPersistenceFactories() {
-		int warningsCounter = 0;
-		List<PersistenceInfo> classes = new ArrayList<PersistenceInfo>();
-		Set<Class> referencedClasses = new TreeSet<Class>(new ClassComparator());
-
-		PersistenceManager manager = ToolsLocator.getPersistenceManager();
-
-		List<PersistenceFactory> factories = manager.getFactories();
-		for (PersistenceFactory factory : factories) {
-			List<Class> theClasses = factory.getManagedClasses();
-			for (Class theClass : theClasses) {
-
-				DynStruct definition = manager.getDefinition(theClass);
-				List defs = factory.getDefinitions();
-				if (definition == null && defs != null && !defs.isEmpty()) {
-					for (int i = 0; i < defs.size(); i++) {
-						definition = (DynStruct) defs.get(i);
-						classes.add(new PersistenceInfo(factory, theClass,
-								definition));
-					}
-				} else {
-					classes.add(new PersistenceInfo(factory, theClass,
-							definition));
-				}
-			}
-		}
-		Collections.sort(classes);
-
-		StringBuffer buffer = new StringBuffer();
-		StringBuffer warnings = new StringBuffer();
-
-		buffer.append("<html>\n");
-		buffer.append("<body>\n");
-		buffer.append("<h2>Supported persistent classes</h2>\n");
-		buffer.append("<br>\n");
-
-		buffer.append("<ol>\n");
-		for (PersistenceInfo classInfo : classes) {
-			StringBuffer classBuffer = new StringBuffer();
-			boolean warning = false;
-			classBuffer.append("  <li>\n    ");
-			classBuffer.append("Class: <i>");
-			classBuffer.append(classInfo.getClassName());
-			classBuffer.append("</i><br>\n    Persistent: <i>");
-			if (Persistent.class.isAssignableFrom(classInfo.theClass)) {
-				classBuffer.append(" yes.");
-			} else {
-				classBuffer.append(" through a factory.");
-			}
-			classBuffer.append("<br>\n    Factory: <i>");
-			classBuffer.append(classInfo.getFactoryName()).append(
-					"</i><br>\n    Definition name: <i>");
-			classBuffer.append(classInfo.getDefinitionName()).append(
-					"</i><br>\n    Description: \n");
-			classBuffer.append(classInfo.getDefinitionDescription()).append(
-					"<br>\n    ");
-			DataTypesManager dataTypesManager = ToolsLocator
-					.getDataTypesManager();
-			DynStruct definition = classInfo.definition;
-			if (definition == null) {
-				classBuffer.append("Definition for ")
-						.append(classInfo.getClassName())
-						.append(" is null.<br>\n    ");
-				warningsCounter++;
-				warning = true;
-			} else {
-				DynField[] fields = definition.getDynFields();
-				for (int i = 0; i < fields.length; i++) {
-					DynField field = fields[i];
-					if (dataTypesManager.isContainer(field.getType())) {
-						if (field.getClassOfItems() == null) {
-							classBuffer
-									.append("Field <b>")
-									.append(field.getName())
-									.append("</b>, container,  can't has class for value of items.<br>\n    ");
-							warningsCounter++;
-							warning = true;
-						} else {
-							classBuffer.append("Field ")
-									.append(field.getName())
-									.append(", container of '")
-									.append(field.getClassOfItems().getName())
-									.append("'.<br>\n    ");
-							referencedClasses.add(field.getClassOfItems());
-						}
-					} else if (dataTypesManager.isObject(field.getType())) {
-						if (field.getClassOfValue() == null) {
-							classBuffer
-									.append("Field <b>")
-									.append(field.getName())
-									.append("</b> can't has class of value.<br>\n    ");
-							warningsCounter++;
-							warning = true;
-						} else {
-							classBuffer.append("Field ")
-									.append(field.getName()).append(" of '")
-									.append(field.getClassOfValue())
-									.append("'.<br>\n    ");
-							referencedClasses.add(field.getClassOfValue());
-						}
-					}
-				}
-			}
-			classBuffer.append("<br>\n  </li>\n");
-			buffer.append(classBuffer);
-			if (warning) {
-				warnings.append(classBuffer);
-			}
-		}
-		buffer.append("</ol>\n");
-		buffer.append("<br>\n");
-		buffer.append("<br>\n");
-
-		buffer.append("<h2>Persistent classes with problems</h2>\n");
-		buffer.append("<ol>\n");
-		buffer.append(warnings);
-		buffer.append("</ol>\n");
-		buffer.append("<br>\n<p>Total warnigs: ").append(warningsCounter)
-				.append("</p>");
-
-		buffer.append("<h2>Not persistents used classes</h2>\n");
-		buffer.append("<ol>\n");
-		for (Class theClass : referencedClasses) {
-			// if( manager.canPersist(theClass) ) {
-			// continue;
-			// }
-			if (Persistent.class.isAssignableFrom(theClass)) {
-				continue;
-			}
-			if (manager.getFactories().get(theClass) != null) {
-				continue;
-			}
-			buffer.append("  <li>\n");
-			buffer.append("    <i>").append(theClass.getName())
-					.append("</i><br>\n");
-			buffer.append("  </li>\n");
-			warningsCounter++;
-		}
-		buffer.append("</ol>\n");
-
-		buffer.append("</body>\n");
-		buffer.append("</html>\n");
-
-		save2file("persistenceinfo", buffer.toString());
-
-		return buffer.toString();
-	}
-
 }
