Index: trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java
===================================================================
--- trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java	(revision 44230)
+++ trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ProjectExtension.java	(revision 44231)
@@ -85,7 +85,6 @@
 import org.gvsig.utils.save.SaveEvent;
 import org.gvsig.utils.swing.threads.IMonitorableTask;
 
-
 /**
  * Extension que proporciona controles para crear proyectos nuevos, abrirlos y
  * guardarlos. Además los tipos de tabla que soporta el proyecto son añadidos en
@@ -93,246 +92,250 @@
  *
  */
 public class ProjectExtension extends Extension implements IExtensionStatus {
-	private static final Logger LOG = LoggerFactory
-			.getLogger(ProjectExtension.class);
 
-	private static String projectPath = null;
-	private ProjectWindow projectFrame;
-	private Project p;
-	private String lastSavePath;
-	private WindowInfo seedProjectWindow;
-	public static final String PROJECT_FILE_CHOOSER_ID = "PROJECT_FILECHOOSER_ID";
-	/**
-	 * Use UTF-8 for encoding, as it can represent characters from any language.
-	 *
-	 * Another sensible option would be encoding =
-	 * System.getProperty("file.encoding"); but this would need some extra
-	 * testing.
-	 *
-	 * @deprecated see PersistentManager
-	 */
-	public static String PROJECTENCODING = "UTF-8";
+    private static final Logger LOG = LoggerFactory
+            .getLogger(ProjectExtension.class);
 
-	private List<BeforeSavingListener> beforeSavingListeners = new ArrayList<BeforeSavingListener>();
+    private static String projectPath = null;
+    private ProjectWindow projectFrame;
+    private Project p;
+    private String lastSavePath;
+    private WindowInfo seedProjectWindow;
+    public static final String PROJECT_FILE_CHOOSER_ID = "PROJECT_FILECHOOSER_ID";
+    /**
+     * Use UTF-8 for encoding, as it can represent characters from any language.
+     *
+     * Another sensible option would be encoding =
+     * System.getProperty("file.encoding"); but this would need some extra
+     * testing.
+     *
+     * @deprecated see PersistentManager
+     */
+    public static String PROJECTENCODING = "UTF-8";
 
-	private List<AfterSavingListener> afterSavingListeners = new ArrayList<AfterSavingListener>();
+    private List<BeforeSavingListener> beforeSavingListeners = new ArrayList<BeforeSavingListener>();
 
-        @Override
-        public void initialize() {
-            initializeDocumentActionsExtensionPoint();
-            registerDocuments();
-            registerIcons();
+    private List<AfterSavingListener> afterSavingListeners = new ArrayList<AfterSavingListener>();
 
-            PropertiesPageManager propertiesManager = ToolsUtilLocator.getPropertiesPageManager();
-            propertiesManager.registerFactory(new ProjectDocumentsPanelPageFactory());
+    @Override
+    public void initialize() {
+        initializeDocumentActionsExtensionPoint();
+        registerDocuments();
+        registerIcons();
 
-            File projectFile = getProjectFileFromArguments();
-            if( projectFile!=null ) {
-                // Posponemos la apertura del proyecto ya que en este momento
-                // puede que no este inicializado algun plugin que precise el
-                // proyecto para poderse cargar.
-                PluginsLocator.getManager().addStartupTask(
+        PropertiesPageManager propertiesManager = ToolsUtilLocator.getPropertiesPageManager();
+        propertiesManager.registerFactory(new ProjectDocumentsPanelPageFactory());
+
+        File projectFile = getProjectFileFromArguments();
+        if (projectFile != null) {
+            // Posponemos la apertura del proyecto ya que en este momento
+            // puede que no este inicializado algun plugin que precise el
+            // proyecto para poderse cargar.
+            PluginsLocator.getManager().addStartupTask(
                     "Open project",
                     new OpenInitialProjectTask(projectFile), true, 1000);
-            }
         }
+    }
 
-	private void registerIcons() {
-		IconThemeHelper.registerIcon("action", "application-project-new", this);
-		IconThemeHelper
-				.registerIcon("action", "application-project-open", this);
-		IconThemeHelper
-				.registerIcon("action", "application-project-save", this);
-		IconThemeHelper.registerIcon("action", "application-project-save-as",
-				this);
+    private void registerIcons() {
+        IconThemeHelper.registerIcon("action", "application-project-new", this);
+        IconThemeHelper
+                .registerIcon("action", "application-project-open", this);
+        IconThemeHelper
+                .registerIcon("action", "application-project-save", this);
+        IconThemeHelper.registerIcon("action", "application-project-save-as",
+                this);
 
-		IconThemeHelper.registerIcon("project", "project-icon", this);
-	}
+        IconThemeHelper.registerIcon("project", "project-icon", this);
+    }
 
-        /**
-         * Returns the file to be opened or null if no parameter
-         * or file does not exist
-         *
-         * @return
-         */
-        private File getProjectFileFromArguments() {
-            String[] theArgs = PluginServices.getArguments();
-            if( theArgs.length< 3 ) {
-                // application-name and extensions-folder are fixed arguments
-                return null;
-            }
-            String lastArg = theArgs[theArgs.length - 1];
-            if ( StringUtils.isEmpty(lastArg) ) {
-                return null;
-            }
-            if( lastArg.startsWith("-") ) {
-                // Args starts with "-" are flags
-                return null;
-            }
-            if (!lastArg.toLowerCase().endsWith(Project.FILE_EXTENSION.toLowerCase())) {
-                LOG.info("Do not open project file, does not have the expected extension '" +
-                        Project.FILE_EXTENSION +"' ("+lastArg+").");
-                return null;
-            }
-            File projectFile = new File(lastArg);
-            if ( !projectFile.exists()) {
-                LOG.info("Do not open project file, '" +projectFile.getAbsolutePath() + "' do not exist.");
-                return null;
-            }
-            return projectFile;
+    /**
+     * Returns the file to be opened or null if no parameter or file does not
+     * exist
+     *
+     * @return
+     */
+    private File getProjectFileFromArguments() {
+        String[] theArgs = PluginServices.getArguments();
+        if (theArgs.length < 3) {
+            // application-name and extensions-folder are fixed arguments
+            return null;
         }
+        String lastArg = theArgs[theArgs.length - 1];
+        if (StringUtils.isEmpty(lastArg)) {
+            return null;
+        }
+        if (lastArg.startsWith("-")) {
+            // Args starts with "-" are flags
+            return null;
+        }
+        if (!lastArg.toLowerCase().endsWith(Project.FILE_EXTENSION.toLowerCase())) {
+            LOG.info("Do not open project file, does not have the expected extension '"
+                    + Project.FILE_EXTENSION + "' (" + lastArg + ").");
+            return null;
+        }
+        File projectFile = new File(lastArg);
+        if (!projectFile.exists()) {
+            LOG.info("Do not open project file, '" + projectFile.getAbsolutePath() + "' do not exist.");
+            return null;
+        }
+        return projectFile;
+    }
 
-        private class OpenInitialProjectTask implements Runnable {
-            private File projectFile;
-            public OpenInitialProjectTask(File projectFile) {
-                this.projectFile = projectFile;
+    private class OpenInitialProjectTask implements Runnable {
+
+        private File projectFile;
+
+        public OpenInitialProjectTask(File projectFile) {
+            this.projectFile = projectFile;
+        }
+
+        @Override
+        public void run() {
+            if (this.projectFile == null) {
+                return;
             }
-            @Override
-            public void run() {
-                if (this.projectFile == null) {
-                    return;
-                }
-                ActionInfoManager actionManager = PluginsLocator.getActionInfoManager();
-                ActionInfo action = actionManager.getAction("application-project-open");
-                action.execute(this.projectFile);
-            }
+            ActionInfoManager actionManager = PluginsLocator.getActionInfoManager();
+            ActionInfo action = actionManager.getAction("application-project-open");
+            action.execute(this.projectFile);
         }
+    }
 
-	public ProjectWindow getProjectFrame() {
-		if (projectFrame == null) {
-			projectFrame = new ProjectWindow();
-		}
-		return projectFrame;
-	}
+    public ProjectWindow getProjectFrame() {
+        if (projectFrame == null) {
+            projectFrame = new ProjectWindow();
+        }
+        return projectFrame;
+    }
 
-	/**
-	 * Muestra la ventana con el gestor de proyectos.
-	 */
-	public void showProjectWindow() {
-		if (seedProjectWindow != null) {
-			if (seedProjectWindow.isClosed()) {
-				// if it was closed, we just don't open the window now
-				seedProjectWindow.setClosed(false);
-				return;
-			}
-			WindowInfo winProps = seedProjectWindow;
-			seedProjectWindow = null;
-			PluginServices.getMDIManager().addWindow(getProjectFrame());
-			PluginServices.getMDIManager().changeWindowInfo(getProjectFrame(),
-					winProps);
-		} else {
-			PluginServices.getMDIManager().addWindow(getProjectFrame());
-		}
-	}
+    /**
+     * Muestra la ventana con el gestor de proyectos.
+     */
+    public void showProjectWindow() {
+        if (seedProjectWindow != null) {
+            if (seedProjectWindow.isClosed()) {
+                // if it was closed, we just don't open the window now
+                seedProjectWindow.setClosed(false);
+                return;
+            }
+            WindowInfo winProps = seedProjectWindow;
+            seedProjectWindow = null;
+            PluginServices.getMDIManager().addWindow(getProjectFrame());
+            PluginServices.getMDIManager().changeWindowInfo(getProjectFrame(),
+                    winProps);
+        } else {
+            PluginServices.getMDIManager().addWindow(getProjectFrame());
+        }
+    }
 
-	/**
-	 * Muestra la ventana con el gestor de proyectos, con las propiedades de
-	 * ventana especificadas.
-	 */
-	public void showProjectWindow(WindowInfo wi) {
-		seedProjectWindow = wi;
-		showProjectWindow();
-	}
+    /**
+     * Muestra la ventana con el gestor de proyectos, con las propiedades de
+     * ventana especificadas.
+     */
+    public void showProjectWindow(WindowInfo wi) {
+        seedProjectWindow = wi;
+        showProjectWindow();
+    }
 
-	/**
-	 * Guarda el proyecto actual en disco.
-	 */
-	private boolean saveProject() {
-		boolean saved = false;
-		// if (p.getPath() == null) {
-		if (projectPath == null) {
-			saved = saveAsProject(null);
-		} else {
-			long t1, t2;
-			t1 = System.currentTimeMillis();
-			saved = writeProject(new File(projectPath), p, false);
-			t2 = System.currentTimeMillis();
-			PluginServices.getLogger().info(
-					"Project saved. " + (t2 - t1) + " miliseconds");
-			getProjectFrame().setProject(p);
-		}
-		return saved;
-	}
+    /**
+     * Guarda el proyecto actual en disco.
+     */
+    private boolean saveProject() {
+        boolean saved = false;
+        // if (p.getPath() == null) {
+        if (projectPath == null) {
+            saved = saveAsProject(null);
+        } else {
+            long t1, t2;
+            t1 = System.currentTimeMillis();
+            saved = writeProject(new File(projectPath), p, false);
+            t2 = System.currentTimeMillis();
+            PluginServices.getLogger().info(
+                    "Project saved. " + (t2 - t1) + " miliseconds");
+            getProjectFrame().setProject(p);
+        }
+        return saved;
+    }
 
-	private boolean saveAsProject(File file) {
-		boolean saved = false;
+    private boolean saveAsProject(File file) {
+        boolean saved = false;
 
-		if (lastSavePath == null) {
-			lastSavePath = projectPath;
-		}
+        if (lastSavePath == null) {
+            lastSavePath = projectPath;
+        }
 
-		if (file == null) {
-			Preferences prefs = Preferences.userRoot().node("gvsig.foldering");
-			JFileChooser jfc = new JFileChooser(PROJECT_FILE_CHOOSER_ID,
-					prefs.get("ProjectsFolder", null));
+        if (file == null) {
+            Preferences prefs = Preferences.userRoot().node("gvsig.foldering");
+            JFileChooser jfc = new JFileChooser(PROJECT_FILE_CHOOSER_ID,
+                    prefs.get("ProjectsFolder", null));
 
-			jfc.setDialogTitle(PluginServices.getText(this, "guardar_proyecto"));
+            jfc.setDialogTitle(PluginServices.getText(this, "guardar_proyecto"));
 
-			GenericFileFilter projExtensionFilter = new GenericFileFilter(
-					Project.FILE_EXTENSION, MessageFormat.format(PluginServices
-							.getText(this, "tipo_fichero_proyecto"),
-							Project.FILE_EXTENSION));
-      jfc.addChoosableFileFilter(projExtensionFilter);
-      jfc.setFileFilter(projExtensionFilter);
+            GenericFileFilter projExtensionFilter = new GenericFileFilter(
+                    Project.FILE_EXTENSION, MessageFormat.format(PluginServices
+                            .getText(this, "tipo_fichero_proyecto"),
+                            Project.FILE_EXTENSION));
+            jfc.addChoosableFileFilter(projExtensionFilter);
+            jfc.setFileFilter(projExtensionFilter);
 
-			if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) != JFileChooser.APPROVE_OPTION) {
-				return saved;
-			}
-			file = jfc.getSelectedFile();
-		}
+            if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) != JFileChooser.APPROVE_OPTION) {
+                return saved;
+            }
+            file = jfc.getSelectedFile();
+        }
 
-		if (!(file.getPath().toLowerCase().endsWith(Project.FILE_EXTENSION
-				.toLowerCase()))) {
-			file = new File(file.getPath() + Project.FILE_EXTENSION);
-		}
-		saved = writeProject(file, p);
-		String filePath = file.getAbsolutePath();
-		lastSavePath = filePath.substring(0,
-				filePath.lastIndexOf(File.separatorChar));
+        if (!(file.getPath().toLowerCase().endsWith(Project.FILE_EXTENSION
+                .toLowerCase()))) {
+            file = new File(file.getPath() + Project.FILE_EXTENSION);
+        }
+        saved = writeProject(file, p);
+        String filePath = file.getAbsolutePath();
+        lastSavePath = filePath.substring(0,
+                filePath.lastIndexOf(File.separatorChar));
 
-		getProjectFrame().setProject(p);
-		return saved;
-	}
+        getProjectFrame().setProject(p);
+        return saved;
+    }
 
-	/**
-	 * Checks whether the project and related unsaved data is modified, and
-	 * allows the user to save it.
-	 *
-	 * @return true if the data has been correctly saved, false otherwise
-	 */
-	private boolean askSave() {
-		if (p != null && p.hasChanged()) {
-			TerminationProcess process = Launcher.getTerminationProcess();
-			UnsavedDataPanel panel = process.getUnsavedDataPanel();
-			panel.setHeaderText(PluginServices.getText(this,
-					"_Select_resources_to_save_before_closing_current_project"));
-			panel.setAcceptText(
-					PluginServices.getText(this, "save_resources"),
-					PluginServices
-							.getText(this,
-									"Save_the_selected_resources_and_close_current_project"));
-			panel.setCancelText(PluginServices.getText(this, "Cancel"),
-					PluginServices.getText(this, "Return_to_current_project"));
-			int closeCurrProj;
-			try {
-				closeCurrProj = process.manageUnsavedData();
-				if (closeCurrProj == JOptionPane.NO_OPTION) {
-					// the user chose to return to current project
-					return false;
-				}
-			} catch (Exception e) {
-				LOG.error("Some data can not be saved", e);
-			}
-		}
-		return true;
-	}
+    /**
+     * Checks whether the project and related unsaved data is modified, and
+     * allows the user to save it.
+     *
+     * @return true if the data has been correctly saved, false otherwise
+     */
+    private boolean askSave() {
+        if (p != null && p.hasChanged()) {
+            TerminationProcess process = Launcher.getTerminationProcess();
+            UnsavedDataPanel panel = process.getUnsavedDataPanel();
+            panel.setHeaderText(PluginServices.getText(this,
+                    "_Select_resources_to_save_before_closing_current_project"));
+            panel.setAcceptText(
+                    PluginServices.getText(this, "save_resources"),
+                    PluginServices
+                            .getText(this,
+                                    "Save_the_selected_resources_and_close_current_project"));
+            panel.setCancelText(PluginServices.getText(this, "Cancel"),
+                    PluginServices.getText(this, "Return_to_current_project"));
+            int closeCurrProj;
+            try {
+                closeCurrProj = process.manageUnsavedData();
+                if (closeCurrProj == JOptionPane.NO_OPTION) {
+                    // the user chose to return to current project
+                    return false;
+                }
+            } catch (Exception e) {
+                LOG.error("Some data can not be saved", e);
+            }
+        }
+        return true;
+    }
 
-        @Override
-	public void execute(String command) {
-		this.execute(command, null);
-	}
+    @Override
+    public void execute(String command) {
+        this.execute(command, null);
+    }
 
-        @Override
+    @Override
     public void execute(String actionCommand, Object[] args) {
         if (actionCommand.equals("application-project-new")) {
             if (!askSave()) {
@@ -364,13 +367,13 @@
                 JFileChooser jfc = new JFileChooser(PROJECT_FILE_CHOOSER_ID, prefs.get("ProjectsFolder", null));
                 ProjectPreviewPanel preview = new ProjectPreviewPanel();
                 jfc.setAccessory(preview);
-                jfc.addPropertyChangeListener(preview);                
+                jfc.addPropertyChangeListener(preview);
 
-                GenericFileFilter projExtensionFilter =
-                    new GenericFileFilter(Project.FILE_EXTENSION, PluginServices.getText(this, "tipo_fichero_proyecto"));
+                GenericFileFilter projExtensionFilter
+                        = new GenericFileFilter(Project.FILE_EXTENSION, PluginServices.getText(this, "tipo_fichero_proyecto"));
                 jfc.addChoosableFileFilter(projExtensionFilter);
-                GenericFileFilter bakExtensionFilter =
-                    new GenericFileFilter(Project.FILE_BAK, PluginServices.getText(this, "tipo_fichero_proyecto_bak"));
+                GenericFileFilter bakExtensionFilter
+                        = new GenericFileFilter(Project.FILE_BAK, PluginServices.getText(this, "tipo_fichero_proyecto_bak"));
                 jfc.addChoosableFileFilter(bakExtensionFilter);
                 jfc.setFileFilter(projExtensionFilter);
 
@@ -400,7 +403,6 @@
 //            getProjectFrame().refreshControls();
 
             // p.restoreWindowProperties();
-
         } else if (actionCommand.equals("application-project-save")) {
             // saveProject();
             try {
@@ -415,7 +417,6 @@
 
     }
 
-
     private void createEmptyProject() {
         setProject(ProjectManager.getInstance().createProject());
         p.setName(PluginServices.getText(this, "untitled"));
@@ -430,77 +431,74 @@
     public void postInitialize() {
         PluginsManager pluginsManager = PluginsLocator.getManager();
         pluginsManager.addStartupTask(
-                "createEmptyProject", 
+                "createEmptyProject",
                 new Runnable() {
-                    @Override
-                    public void run() {
-                        createEmptyProject();
-                    }
-                }, 
-                true, 
+            @Override
+            public void run() {
+                createEmptyProject();
+            }
+        },
+                true,
                 1000
         );
     }
 
+    /**
+     * Escribe el proyecto en XML.
+     *
+     * @param file Fichero.
+     * @param p Proyecto.
+     */
+    public boolean writeProject(File file, Project p) {
+        return writeProject(file, p, true);
+    }
 
-	/**
-	 * Escribe el proyecto en XML.
-	 *
-	 * @param file
-	 *            Fichero.
-	 * @param p
-	 *            Proyecto.
-	 */
-	public boolean writeProject(File file, Project p) {
-		return writeProject(file, p, true);
-	}
-
     /**
-     * Escribe el proyecto en disco. 
-     * Pero permite decidir si se pide confirmación para sobreescribir
+     * Escribe el proyecto en disco. Pero permite decidir si se pide
+     * confirmación para sobreescribir
      *
      * @param file Fichero.
      * @param p Proyecto.
      * @param askConfirmation boolean
      * @return
      */
-public boolean writeProject(File file, Project p, boolean askConfirmation) {
+    public boolean writeProject(File file, Project p, boolean askConfirmation) {
         I18nManager i18n = ToolsLocator.getI18nManager();
         ApplicationManager application = ApplicationLocator.getManager();
         if (askConfirmation && file.exists()) {
             int resp = application.confirmDialog(
-                    i18n.getTranslation("fichero_ya_existe_seguro_desea_guardarlo"), 
-                    i18n.getTranslation("guardar"), 
-                    JOptionPane.YES_NO_OPTION, 
-                    JOptionPane.QUESTION_MESSAGE, 
+                    i18n.getTranslation("fichero_ya_existe_seguro_desea_guardarlo"),
+                    i18n.getTranslation("guardar"),
+                    JOptionPane.YES_NO_OPTION,
+                    JOptionPane.QUESTION_MESSAGE,
                     "Overwrite_project_file"
             );
             if (resp != JOptionPane.YES_OPTION) {
                 return false;
             }
         }
-        LOG.info("Writing project '"+ file.getAbsolutePath()+"'.");
+        LOG.info("Writing project '" + file.getAbsolutePath() + "'.");
         try {
-            fireBeforeSavingFileEvent(new SaveEvent(this,SaveEvent.BEFORE_SAVING, file));
+            fireBeforeSavingFileEvent(new SaveEvent(this, SaveEvent.BEFORE_SAVING, file));
             BufferedImage img = ApplicationLocator.getManager().getUIManager().getImagePreview();
             img = scale(img, 0.40);
-            p.saveState(file,img);
+            p.saveState(file, img);
 
             PluginServices.getMainFrame().setTitle(file.getName());
             setPath(file.toString());
 
         } catch (Exception e) {
             application.messageDialog(
-                    i18n.getTranslation("_Problems_saving_the_project_XnlX_It_is_possible_that_this_was_not_saved_properly_and_can_not_be_loaded_again"), 
-                    null, 
-                    i18n.getTranslation("guardar"), 
-                    JOptionPane.ERROR_MESSAGE, 
+                    i18n.getTranslation("_Problems_saving_the_project_XnlX_It_is_possible_that_this_was_not_saved_properly_and_can_not_be_loaded_again"),
+                    null,
+                    i18n.getTranslation("guardar"),
+                    JOptionPane.ERROR_MESSAGE,
                     "Problems_saving_the_project"
             );
-            LOG.warn("Error writing project '"+file.getAbsolutePath()+"'.", e);
+            LOG.warn("Error writing project '" + file.getAbsolutePath() + "'.", e);
             return false;
-        }        
-        LOG.warn("Wrote project '"+file.getAbsolutePath()+"'.");
+        }
+        LOG.warn("Wrote project '" + file.getAbsolutePath() + "'.");
         return true;
     }
 
@@ -523,390 +521,385 @@
     }
 
     private BufferedImage scale(BufferedImage before, double factor) {
-        int w = (int) (before.getWidth()*factor);
-        int h = (int) (before.getHeight()*factor);
+        int w = (int) (before.getWidth() * factor);
+        int h = (int) (before.getHeight() * factor);
         BufferedImage after = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
         AffineTransform at = new AffineTransform();
         at.scale(factor, factor);
         AffineTransformOp scaleOp = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR);
-        after = scaleOp.filter(before, after);        
+        after = scaleOp.filter(before, after);
         return after;
     }
-    
-	public Project readProject(String path) {
-		Project project = ProjectManager.getInstance().createProject();
 
-		project.loadState(new File(path));
-		return (Project) project;
-	}
+    public Project readProject(String path) {
+        Project project = ProjectManager.getInstance().createProject();
 
-	/**
-	 * Lee del XML el proyecto.<br>
-	 * <br>
-	 *
-	 * Reads the XML of the project.<br>
-	 * It returns a project object holding all needed info that is not linked to
-	 * the Project Dialog. <br>
-	 * In case you want the project to be linked to the window you must set this
-	 * object to the extension:<br>
-	 *
-	 * <b>Example:</b><br>
-	 *
-	 * ...<br>
-	 * ...<br>
-	 * Project p = ProjectExtension.readProject(projectFile);<br>
-	 * ProjectExtension.setProject(p); ...<br>
-	 * ...<br>
-	 *
-	 * @param file
-	 *            Fichero.
-	 *
-	 * @return Project
-	 *
-	 */
-	public Project readProject(File file) {
-		Project project = ProjectManager.getInstance().createProject();
+        project.loadState(new File(path));
+        return (Project) project;
+    }
 
-		project.loadState(file);
-		Set<String> unloadedObjects = project.getUnloadedObjects();
+    /**
+     * Lee del XML el proyecto.<br>
+     * <br>
+     *
+     * Reads the XML of the project.<br>
+     * It returns a project object holding all needed info that is not linked to
+     * the Project Dialog. <br>
+     * In case you want the project to be linked to the window you must set this
+     * object to the extension:<br>
+     *
+     * <b>Example:</b><br>
+     *
+     * ...<br>
+     * .
+     * ..<br>
+     * Project p = ProjectExtension.readProject(projectFile);<br>
+     * ProjectExtension.setProject(p); ...<br>
+     * .
+     * ..<br>
+     *
+     * @param file Fichero.
+     *
+     * @return Project
+     *
+     */
+    public Project readProject(File file) {
+        Project project = ProjectManager.getInstance().createProject();
+
+        project.loadState(file);
+        Set<String> unloadedObjects = project.getUnloadedObjects();
         List<Exception> errors = project.getLoadErrors();
-        
-		if( !CollectionUtils.isEmpty(unloadedObjects) ) {
-		    StringBuilder builder = new StringBuilder();
-		    builder.append("Unloaded elements loading the project:\n");
-		    Iterator<String> it = unloadedObjects.iterator();
-		    while(it.hasNext()){
+
+        if (!CollectionUtils.isEmpty(unloadedObjects)) {
+            StringBuilder builder = new StringBuilder();
+            builder.append("Unloaded elements loading the project:\n");
+            Iterator<String> it = unloadedObjects.iterator();
+            while (it.hasNext()) {
                 builder.append("\t");
-		        builder.append(it.next());
-		        builder.append("\n");
-		    }
+                builder.append(it.next());
+                builder.append("\n");
+            }
 
-		    LOG.warn(builder.toString());
+            LOG.warn(builder.toString());
         }
-		if( !CollectionUtils.isEmpty(unloadedObjects) || !CollectionUtils.isEmpty(errors) ) {
-		    ApplicationManager application = ApplicationLocator.getManager();
-		    I18nManager i18nManager = ToolsLocator.getI18nManager();
+        if (!CollectionUtils.isEmpty(unloadedObjects) || !CollectionUtils.isEmpty(errors)) {
+            ApplicationManager application = ApplicationLocator.getManager();
+            I18nManager i18nManager = ToolsLocator.getI18nManager();
 
-		    application.messageDialog(
-		        i18nManager.getTranslation("_some_project_elements_could_not_be_loaded")+"\n"+
-	                i18nManager.getTranslation("_maybe_you_need_to_install_any_plugins")+"\n"+
-	                i18nManager.getTranslation("_Recovered_data_may_be_corrupted")+"\n\n"+
-	                i18nManager.getTranslation("_see_error_log_for_more_information"),
-	            i18nManager.getTranslation("warning"),
-		    JOptionPane.WARNING_MESSAGE);
+            application.messageDialog(
+                    i18nManager.getTranslation("_some_project_elements_could_not_be_loaded") + "\n"
+                    + i18nManager.getTranslation("_maybe_you_need_to_install_any_plugins") + "\n"
+                    + i18nManager.getTranslation("_Recovered_data_may_be_corrupted") + "\n\n"
+                    + i18nManager.getTranslation("_see_error_log_for_more_information"),
+                    i18nManager.getTranslation("warning"),
+                    JOptionPane.WARNING_MESSAGE);
 
-		} else {
-            
+        } else {
+
         }
-                return (Project) project;
-	}
+        return (Project) project;
+    }
 
-	/**
-	 * Devuelve el proyecto.
-	 *
-	 * @return Proyecto.
-	 */
-	public Project getProject() {
-		return p;
-	}
+    /**
+     * Devuelve el proyecto.
+     *
+     * @return Proyecto.
+     */
+    public Project getProject() {
+        return p;
+    }
 
-	/**
-	 * @see org.gvsig.andami.plugins.IExtension#isEnabled()
-	 */
-	public boolean isEnabled() {
-		return true;
-	}
+    /**
+     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
+     */
+    public boolean isEnabled() {
+        return true;
+    }
 
-	/**
-	 * @see org.gvsig.andami.plugins.IExtension#isVisible()
-	 */
-	public boolean isVisible() {
-		return true;
-	}
+    /**
+     * @see org.gvsig.andami.plugins.IExtension#isVisible()
+     */
+    public boolean isVisible() {
+        return true;
+    }
 
-	/**
-	 * Sets the project
-	 *
-	 * @param p
-	 */
-	public void setProject(Project p) {
-		this.p = p;
-		getProjectFrame().setProject(p);
-	}
+    /**
+     * Sets the project
+     *
+     * @param p
+     */
+    public void setProject(Project p) {
+        this.p = p;
+        getProjectFrame().setProject(p);
+    }
 
-	private void registerDocuments() {
-		ViewManager.register();
-	}
+    private void registerDocuments() {
+        ViewManager.register();
+    }
 
-	private void initializeDocumentActionsExtensionPoint() {
-		ExtensionPointManager epMan = ToolsLocator.getExtensionPointManager();
-		epMan.add(
-				"DocumentActions_View",
-				"Context menu options of the view document list"
-						+ " in the project window "
-						+ "(register instances of "
-						+ "org.gvsig.app.project.AbstractDocumentContextMenuAction)");
-	}
+    private void initializeDocumentActionsExtensionPoint() {
+        ExtensionPointManager epMan = ToolsLocator.getExtensionPointManager();
+        epMan.add(
+                "DocumentActions_View",
+                "Context menu options of the view document list"
+                + " in the project window "
+                + "(register instances of "
+                + "org.gvsig.app.project.AbstractDocumentContextMenuAction)");
+    }
 
-	public static String getPath() {
-		return projectPath;
-	}
+    public static String getPath() {
+        return projectPath;
+    }
 
-	public static void setPath(String path) {
-		projectPath = path;
-	}
+    public static void setPath(String path) {
+        projectPath = path;
+    }
 
-	public IWindow getProjectWindow() {
-		return getProjectFrame();
-	}
+    public IWindow getProjectWindow() {
+        return getProjectFrame();
+    }
 
-        @Override
-	public IExtensionStatus getStatus() {
-		return this;
-	}
+    @Override
+    public IExtensionStatus getStatus() {
+        return this;
+    }
 
-        @Override
-	public boolean hasUnsavedData() {
-		return p.hasChanged();
-	}
+    @Override
+    public boolean hasUnsavedData() {
+        return p.hasChanged();
+    }
 
-        @Override
-	public IUnsavedData[] getUnsavedData() {
-		if (hasUnsavedData()) {
-			UnsavedProject data = new UnsavedProject(this);
-			IUnsavedData[] dataArray = { data };
-			return dataArray;
-		} else {
-			return null;
-		}
-	}
+    @Override
+    public IUnsavedData[] getUnsavedData() {
+        if (hasUnsavedData()) {
+            UnsavedProject data = new UnsavedProject(this);
+            IUnsavedData[] dataArray = {data};
+            return dataArray;
+        } else {
+            return null;
+        }
+    }
 
-	/**
-	 * Implements the IUnsavedData interface to show unsaved projects in the
-	 * Unsavad Data dialog.
-	 *
-	 * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
-	 */
-	public class UnsavedProject extends UnsavedData {
+    /**
+     * Implements the IUnsavedData interface to show unsaved projects in the
+     * Unsavad Data dialog.
+     *
+     * @author Cesar Martinez Izquierdo <cesar.martinez@iver.es>
+     */
+    public class UnsavedProject extends UnsavedData {
 
-		public UnsavedProject(IExtension extension) {
-			super(extension);
-		}
+        public UnsavedProject(IExtension extension) {
+            super(extension);
+        }
 
-                @Override
-		public String getDescription() {
-			if (getPath() == null) {
-				return PluginServices.getText(ProjectExtension.this,
-						"Unnamed_new_gvsig_project_");
-			} else {
-				return PluginServices.getText(ProjectExtension.this,
-						"Modified_project_");
-			}
-		}
+        @Override
+        public String getDescription() {
+            if (getPath() == null) {
+                return PluginServices.getText(ProjectExtension.this,
+                        "Unnamed_new_gvsig_project_");
+            } else {
+                return PluginServices.getText(ProjectExtension.this,
+                        "Modified_project_");
+            }
+        }
 
-                @Override
-		public String getResourceName() {
-			if (getPath() == null) {
-				return PluginServices.getText(ProjectExtension.this, "Unnamed");
-			} else {
-				return getPath();
-			}
+        @Override
+        public String getResourceName() {
+            if (getPath() == null) {
+                return PluginServices.getText(ProjectExtension.this, "Unnamed");
+            } else {
+                return getPath();
+            }
 
-		}
+        }
 
-                @Override
-		public boolean saveData() {
-			return saveProject();
-		}
-
-                @Override
-		public String getIcon() {
-			return "project-icon";
-		}
-	}
-
         @Override
-	public IMonitorableTask[] getRunningProcesses() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+        public boolean saveData() {
+            return saveProject();
+        }
 
         @Override
-	public boolean hasRunningProcesses() {
-		// TODO Auto-generated method stub
-		return false;
-	}
+        public String getIcon() {
+            return "project-icon";
+        }
+    }
 
-	/**
-	 * Adds the specified before saving listener to receive
-	 * "before saving file events" from this component. If l is null, no
-	 * exception is thrown and no action is performed.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @param l
-	 *            the before saving listener.
-	 * @see SaveEvent
-	 * @see BeforeSavingListener
-	 * @see #removeListener(BeforeSavingListener)
-	 * @see #getBeforeSavingListeners
-	 */
-	public synchronized void addListener(BeforeSavingListener l) {
-		if (l == null) {
-			return;
-		}
-		if (!this.beforeSavingListeners.contains(l)) {
-			this.beforeSavingListeners.add(l);
-		}
-	}
+    @Override
+    public IMonitorableTask[] getRunningProcesses() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	/**
-	 * Adds the specified after saving listener to receive
-	 * "after saving file events" from this component. If l is null, no
-	 * exception is thrown and no action is performed.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @param l
-	 *            the after saving listener.
-	 * @see SaveEvent
-	 * @see AfterSavingListener
-	 * @see #removeListener(AfterSavingListener)
-	 * @see #getAfterSavingListeners()
-	 */
-	public synchronized void addListener(AfterSavingListener l) {
-		if (l == null) {
-			return;
-		}
+    @Override
+    public boolean hasRunningProcesses() {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-		if (!this.afterSavingListeners.contains(l)) {
-			this.afterSavingListeners.add(l);
-		}
+    /**
+     * Adds the specified before saving listener to receive "before saving file
+     * events" from this component. If l is null, no exception is thrown and no
+     * action is performed.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @param l the before saving listener.
+     * @see SaveEvent
+     * @see BeforeSavingListener
+     * @see #removeListener(BeforeSavingListener)
+     * @see #getBeforeSavingListeners
+     */
+    public synchronized void addListener(BeforeSavingListener l) {
+        if (l == null) {
+            return;
+        }
+        if (!this.beforeSavingListeners.contains(l)) {
+            this.beforeSavingListeners.add(l);
+        }
+    }
 
-	}
+    /**
+     * Adds the specified after saving listener to receive "after saving file
+     * events" from this component. If l is null, no exception is thrown and no
+     * action is performed.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @param l the after saving listener.
+     * @see SaveEvent
+     * @see AfterSavingListener
+     * @see #removeListener(AfterSavingListener)
+     * @see #getAfterSavingListeners()
+     */
+    public synchronized void addListener(AfterSavingListener l) {
+        if (l == null) {
+            return;
+        }
 
-	/**
-	 * Returns an array of all the before saving listeners registered on this
-	 * component.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @return all of this component's <code>BeforeSavingListener</code>s or an
-	 *         empty array if no key listeners are currently registered
-	 *
-	 * @see #addBeforeSavingListener(BeforeSavingListener)
-	 * @see #removeBeforeSavingListener(BeforeSavingListener)
-	 */
-	public synchronized BeforeSavingListener[] getBeforeSavingListeners() {
-		return this.beforeSavingListeners
-				.toArray(new BeforeSavingListener[] {});
-	}
+        if (!this.afterSavingListeners.contains(l)) {
+            this.afterSavingListeners.add(l);
+        }
 
-	/**
-	 * Returns an array of all the after saving listeners registered on this
-	 * component.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @return all of this component's <code>AfterSavingListener</code>s or an
-	 *         empty array if no key listeners are currently registered
-	 *
-	 * @see #addAfterSavingListener(AfterSavingListener)
-	 * @see #removeAfterSavingListener
-	 */
-	public synchronized AfterSavingListener[] getAfterSavingListeners() {
-		return this.afterSavingListeners.toArray(new AfterSavingListener[] {});
+    }
 
-	}
+    /**
+     * Returns an array of all the before saving listeners registered on this
+     * component.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @return all of this component's <code>BeforeSavingListener</code>s or an
+     * empty array if no key listeners are currently registered
+     *
+     * @see #addBeforeSavingListener(BeforeSavingListener)
+     * @see #removeBeforeSavingListener(BeforeSavingListener)
+     */
+    public synchronized BeforeSavingListener[] getBeforeSavingListeners() {
+        return this.beforeSavingListeners
+                .toArray(new BeforeSavingListener[]{});
+    }
 
-	/**
-	 * Removes the specified before saving listener so that it no longer
-	 * receives save file events from this component. This method performs no
-	 * function, nor does it throw an exception, if the listener specified by
-	 * the argument was not previously added to this component. If listener
-	 * <code>l</code> is <code>null</code>, no exception is thrown and no action
-	 * is performed.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @param l
-	 *            the before saving listener
-	 * @see SaveEvent
-	 * @see BeforeSavingListener
-	 * @see #addListener(BeforeSavingListener)
-	 * @see #getBeforeSavingListeners()
-	 */
-	public synchronized void removeListener(BeforeSavingListener l) {
-		if (l == null) {
-			return;
-		}
+    /**
+     * Returns an array of all the after saving listeners registered on this
+     * component.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @return all of this component's <code>AfterSavingListener</code>s or an
+     * empty array if no key listeners are currently registered
+     *
+     * @see #addAfterSavingListener(AfterSavingListener)
+     * @see #removeAfterSavingListener
+     */
+    public synchronized AfterSavingListener[] getAfterSavingListeners() {
+        return this.afterSavingListeners.toArray(new AfterSavingListener[]{});
 
-		this.beforeSavingListeners.remove(l);
-	}
+    }
 
-	/**
-	 * Removes the specified after saving listener so that it no longer receives
-	 * save file events from this component. This method performs no function,
-	 * nor does it throw an exception, if the listener specified by the argument
-	 * was not previously added to this component. If listener <code>l</code> is
-	 * <code>null</code>, no exception is thrown and no action is performed.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @param l
-	 *            the after saving listener
-	 * @see SaveEvent
-	 * @see AfterSavingListener
-	 * @see #addListener(AfterSavingListener)
-	 * @see #getAfterSavingListeners()
-	 */
-	public synchronized void removeListener(AfterSavingListener l) {
-		if (l == null) {
-			return;
-		}
+    /**
+     * Removes the specified before saving listener so that it no longer
+     * receives save file events from this component. This method performs no
+     * function, nor does it throw an exception, if the listener specified by
+     * the argument was not previously added to this component. If listener
+     * <code>l</code> is <code>null</code>, no exception is thrown and no action
+     * is performed.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @param l the before saving listener
+     * @see SaveEvent
+     * @see BeforeSavingListener
+     * @see #addListener(BeforeSavingListener)
+     * @see #getBeforeSavingListeners()
+     */
+    public synchronized void removeListener(BeforeSavingListener l) {
+        if (l == null) {
+            return;
+        }
 
-		this.afterSavingListeners.remove(l);
-	}
+        this.beforeSavingListeners.remove(l);
+    }
 
-	/**
-	 * Reports a before saving file event.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @param evt
-	 *            the before saving file event
-	 */
-	protected void fireBeforeSavingFileEvent(SaveEvent evt) {
-		if ((evt.getID() != SaveEvent.BEFORE_SAVING) || (evt.getFile() == null)) {
-			return;
-		}
+    /**
+     * Removes the specified after saving listener so that it no longer receives
+     * save file events from this component. This method performs no function,
+     * nor does it throw an exception, if the listener specified by the argument
+     * was not previously added to this component. If listener <code>l</code> is
+     * <code>null</code>, no exception is thrown and no action is performed.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @param l the after saving listener
+     * @see SaveEvent
+     * @see AfterSavingListener
+     * @see #addListener(AfterSavingListener)
+     * @see #getAfterSavingListeners()
+     */
+    public synchronized void removeListener(AfterSavingListener l) {
+        if (l == null) {
+            return;
+        }
 
-		Iterator<BeforeSavingListener> iter = this.beforeSavingListeners
-				.iterator();
+        this.afterSavingListeners.remove(l);
+    }
 
-		while (iter.hasNext()) {
-			iter.next().beforeSaving(evt);
-		}
-	}
+    /**
+     * Reports a before saving file event.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @param evt the before saving file event
+     */
+    protected void fireBeforeSavingFileEvent(SaveEvent evt) {
+        if ((evt.getID() != SaveEvent.BEFORE_SAVING) || (evt.getFile() == null)) {
+            return;
+        }
 
-	/**
-	 * Reports a after saving file event.
-	 *
-	 * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
-	 *
-	 * @param evt
-	 *            the after saving file event
-	 */
-	protected void fireAfterSavingFileEvent(SaveEvent evt) {
-		if ((evt.getID() != SaveEvent.AFTER_SAVING) || (evt.getFile() == null)) {
-			return;
-		}
-		Iterator<AfterSavingListener> iter = this.afterSavingListeners
-				.iterator();
+        Iterator<BeforeSavingListener> iter = this.beforeSavingListeners
+                .iterator();
 
-		while (iter.hasNext()) {
-			iter.next().afterSaving(evt);
-		}
+        while (iter.hasNext()) {
+            iter.next().beforeSaving(evt);
+        }
+    }
 
-	}
+    /**
+     * Reports a after saving file event.
+     *
+     * @author Pablo Piqueras Bartolomé <pablo.piqueras@iver.es>
+     *
+     * @param evt the after saving file event
+     */
+    protected void fireAfterSavingFileEvent(SaveEvent evt) {
+        if ((evt.getID() != SaveEvent.AFTER_SAVING) || (evt.getFile() == null)) {
+            return;
+        }
+        Iterator<AfterSavingListener> iter = this.afterSavingListeners
+                .iterator();
+
+        while (iter.hasNext()) {
+            iter.next().afterSaving(evt);
+        }
+
+    }
 }
