Index: ViewControls.java
===================================================================
--- ViewControls.java	(revision 38563)
+++ ViewControls.java	(revision 38564)
@@ -46,6 +46,9 @@
  */
 package org.gvsig.app.extension;
 
+import javax.swing.JOptionPane;
+
+import org.gvsig.andami.IconThemeHelper;
 import org.gvsig.andami.PluginServices;
 import org.gvsig.andami.plugins.Extension;
 import org.gvsig.andami.preferences.IPreference;
@@ -53,13 +56,12 @@
 import org.gvsig.app.gui.preferencespage.GridPage;
 import org.gvsig.app.gui.preferencespage.ViewPage;
 import org.gvsig.app.project.Project;
-import org.gvsig.app.project.documents.AbstractDocument;
 import org.gvsig.app.project.documents.view.Encuadrator;
 import org.gvsig.app.project.documents.view.ViewDocument;
+import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
 import org.gvsig.app.project.documents.view.gui.ExtentListSelectorModel;
 import org.gvsig.app.project.documents.view.gui.FPanelExtentSelector;
 import org.gvsig.app.project.documents.view.gui.FPanelLocConfig;
-import org.gvsig.app.project.documents.view.gui.DefaultViewPanel;
 import org.gvsig.app.project.documents.view.toc.gui.FPopupMenu;
 import org.gvsig.app.project.documents.view.toolListeners.snapping.Snapping;
 import org.gvsig.fmap.mapcontext.MapContext;
@@ -67,6 +69,7 @@
 import org.gvsig.fmap.mapcontext.layers.FLayers;
 import org.gvsig.fmap.mapcontrol.MapControl;
 import org.gvsig.tools.ToolsLocator;
+import org.gvsig.tools.dataTypes.DataTypes;
 import org.gvsig.tools.extensionpoint.ExtensionPointManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -90,17 +93,21 @@
 	 * @see com.iver.mdiApp.plugins.IExtension#updateUI(java.lang.String)
 	 */
 	public void execute(String s) {
-		ViewDocument model = vista.getModel();
-		MapContext mapa = model.getMapContext();
+		execute(s,null);
+	}
+	
+	public void execute(String command, Object[] args) {
+		ViewDocument document = vista.getViewDocument();
+		MapContext mapa = document.getMapContext();
 		MapControl mapCtrl = vista.getMapControl();
-		logger.debug("Comand : " + s);
 
-		if (s.equals("FULL") ) {
+		if (command.equalsIgnoreCase("view-navigation-zoom-all") ) {
 			// mapa.beginAtomicEvent();
 			mapa.getViewPort().setEnvelope(mapa.getLayers().getFullEnvelope());
-			((AbstractDocument)vista.getModel()).setModified(true);
+			document.setModified(true);
 			// mapa.endAtomicEvent();
-		} else if (s.equals("ENCUADRE") ) {
+			
+		} else if (command.equalsIgnoreCase("view-navigation-frame-manager") ) {
 			FPanelExtentSelector l = new FPanelExtentSelector();
 
 			ProjectExtension p = (ProjectExtension) PluginServices.getExtension(org.gvsig.app.extension.ProjectExtension.class);
@@ -110,50 +117,61 @@
 			project.addPropertyChangeListener(modelo);
 			l.setModel(modelo);
 			l.addSelectionListener(new Encuadrator(project, mapa, vista));
-			((AbstractDocument)vista.getModel()).setModified(true);
+			document.setModified(true);
 			PluginServices.getMDIManager().addWindow(l);
-		} else if (s.equals("CONFIG_LOCATOR") ) {
+			
+		} else if (command.equalsIgnoreCase("view-locator-setup") ) {
 			//Set up the map overview
 			FPanelLocConfig m_panelLoc = new FPanelLocConfig(vista.getMapOverview());
 			PluginServices.getMDIManager().addWindow(m_panelLoc);
 			m_panelLoc.setPreferredSize(m_panelLoc.getSize());
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("PAN") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("view-navigation-pan") ) {
 			mapCtrl.setTool("pan");
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("ZOOM_IN") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("view-navigation-zoom-in-topoint") ) {
 			mapCtrl.setTool("zoomIn");
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("ZOOM_OUT") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("view-navigation-zoom-out-topoint") ) {
 			mapCtrl.setTool("zoomOut");
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("CAPAS_VISIBLES") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("layer-set-visible") ) {
 			setVisibles(true, mapa.getLayers());
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("CAPAS_NOVISIBLES") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("layer-set-hide") ) {
 			setVisibles(false, mapa.getLayers());
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("CAPAS_ACTIVAS") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("layer-set-active") ) {
 			setActives(true, mapa.getLayers());
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("CAPAS_NOACTIVAS") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("layer-set-inactive") ) {
 			setActives(false, mapa.getLayers());
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("SAVERASTER") ) {
-			mapCtrl.setTool("saveRaster");
-		} else if (s.equals("SELECTIMAGE") ) {
-			mapCtrl.setTool("selectImage");
-		} else if (s.equals("ACTION_ZOOM_IN") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("view-navigation-zoom-in-center") ) {
 			mapCtrl.zoomIn();
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.equals("ACTION_ZOOM_OUT") ) {
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("view-navigation-zoom-out-center") ) {
 			mapCtrl.zoomOut();
-			((AbstractDocument)vista.getModel()).setModified(true);
-		} else if (s.startsWith("CHANGE_SCALE_")){
-			String scl=s.replaceAll("CHANGE_SCALE_","");
-			long scale=Long.parseLong(scl);
-			mapa.setScaleView(scale);
-			((AbstractDocument)vista.getModel()).setModified(true);
+			document.setModified(true);
+			
+		} else if (command.equalsIgnoreCase("view-change-scale")) {
+			try {
+				Long scale = (Long) ToolsLocator.getDataTypesManager().coerce(DataTypes.LONG, args[0]);
+				mapa.setScaleView(scale.longValue());
+				document.setModified(true);
+			} catch(Throwable ex) {
+				logger.info("Can't change scale of view.", ex);
+				PluginServices.getMainFrame().getStatusBar().message("Can't change scale of view.", JOptionPane.ERROR_MESSAGE);
+			}
 		}
 	}
 
@@ -205,7 +223,7 @@
 
 		if (f!=null && f instanceof DefaultViewPanel) {
 			vista = (DefaultViewPanel) f;
-			ViewDocument model = vista.getModel();
+			ViewDocument model = vista.getViewDocument();
 			MapContext mapa = model.getMapContext();
 
 			return mapa.getLayers().getLayersCount() > 0;
@@ -237,49 +255,20 @@
 	}
 
 	private void registerIcons(){
-
-		PluginServices.getIconTheme().registerDefault(
-				"view-zoom-in",
-				this.getClass().getClassLoader().getResource("images/ZoomIn.png")
-			);
-		PluginServices.getIconTheme().registerDefault(
-				"view-zoom-out",
-				this.getClass().getClassLoader().getResource("images/ZoomOut.png")
-			);
-		PluginServices.getIconTheme().registerDefault(
-				"view-zoom-map-contents",
-				this.getClass().getClassLoader().getResource("images/MapContents.png")
-			);
-		PluginServices.getIconTheme().registerDefault(
-				"view-zoom-center-in",
-				this.getClass().getClassLoader().getResource("images/zoommas.png")
-			);
-		PluginServices.getIconTheme().registerDefault(
-				"view-zoom-center-out",
-				this.getClass().getClassLoader().getResource("images/zoommenos.png")
-			);
-
-		PluginServices.getIconTheme().registerDefault(
-				"view-pan",
-				this.getClass().getClassLoader().getResource("images/Pan.png")
-			);
-
-		PluginServices.getIconTheme().registerDefault(
-				"view-zoom-manager",
-				this.getClass().getClassLoader().getResource("images/encuadre.png")
-			);
-		
-		PluginServices.getIconTheme().registerDefault(
-				"toc-layer-group",
-				this.getClass().getClassLoader().getResource("images/layerGroup.png")
-			);
+		IconThemeHelper.registerIcon("action", "view-navigation-zoom-in-topoint", this);
+		IconThemeHelper.registerIcon("action", "view-navigation-zoom-out-topoint", this);
+		IconThemeHelper.registerIcon("action", "view-navigation-zoom-all", this);
+		IconThemeHelper.registerIcon("action", "view-navigation-zoom-in-center", this);
+		IconThemeHelper.registerIcon("action", "view-navigation-zoom-out-center", this);
+		IconThemeHelper.registerIcon("action", "view-navigation-pan", this);
+		IconThemeHelper.registerIcon("action", "view-navigation-frame-manager", this);
 	}
 
 	/**
 	 * @see org.gvsig.andami.plugins.IExtension#isEnabled()
 	 */
 	public boolean isEnabled() {
-		ViewDocument model = vista.getModel();
+		ViewDocument model = vista.getViewDocument();
 		MapContext mapa = model.getMapContext();
 
 		FLayers layers = mapa.getLayers();
