Index: DefaultJTopologyReport.java
===================================================================
--- DefaultJTopologyReport.java	(revision 726)
+++ DefaultJTopologyReport.java	(revision 727)
@@ -6,10 +6,13 @@
 import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import java.net.URL;
+import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 import javax.swing.DefaultComboBoxModel;
+import javax.swing.ImageIcon;
 import javax.swing.JComponent;
 import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
@@ -22,6 +25,7 @@
 import javax.swing.event.TableModelEvent;
 import javax.swing.event.TableModelListener;
 import javax.swing.table.TableModel;
+import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.gvsig.expressionevaluator.ExpressionBuilder;
 import org.gvsig.expressionevaluator.ExpressionEvaluatorLocator;
@@ -39,6 +43,7 @@
 import org.gvsig.tools.swing.api.ToolsSwingLocator;
 import org.gvsig.tools.swing.api.ToolsSwingManager;
 import org.gvsig.tools.swing.api.task.TaskStatusController;
+import org.gvsig.tools.swing.icontheme.IconTheme;
 import org.gvsig.tools.task.TaskStatus;
 import org.gvsig.topology.lib.api.TopologyLocator;
 import org.gvsig.topology.lib.api.TopologyPlan;
@@ -70,25 +75,25 @@
     private class TopologyRuleActionParametersListener implements ActionListener {
 
         private final TopologyRule rule;
-        private final TopologyReportLine line;
+        private final List<TopologyReportLine> lines;
         private final TopologyRuleAction action;
         private final JDynForm form;
 
         public TopologyRuleActionParametersListener(
                 TopologyRule rule,
-                TopologyReportLine line,
+                List<TopologyReportLine> lines,
                 TopologyRuleAction action,
                 JDynForm form
         ) {
             this.action = action;
-            this.line = line;
+            this.lines = lines;
             this.rule = rule;
             this.form = form;
         }
 
         @Override
         public void actionPerformed(ActionEvent e) {
-            doExecuteRuleAction(rule, line, action, form);
+            doExecuteRuleAction(rule, lines, action, form);
         }
     }
 
@@ -96,25 +101,25 @@
     private class TopologyRuleActionListener implements ActionListener {
 
         private final TopologyRule rule;
-        private final TopologyReportLine line;
+        private final List<TopologyReportLine> lines;
         private final TopologyRuleAction action;
 
         public TopologyRuleActionListener(
                 TopologyRule rule,
-                TopologyReportLine line,
+                List<TopologyReportLine> lines,
                 TopologyRuleAction action
         ) {
             this.action = action;
-            this.line = line;
+            this.lines = lines;
             this.rule = rule;
         }
 
         @Override
         public void actionPerformed(ActionEvent e) {
             if ( this.action.hasParameters() ) {
-                doShowActionParametersPanel(this.rule, this.line, this.action);
+                doShowActionParametersPanel(this.rule, this.lines, this.action);
             } else {
-                doExecuteRuleAction(rule, line, action, null);
+                doExecuteRuleAction(rule, lines, action, null);
             }
         }
     }
@@ -141,18 +146,30 @@
         };
         this.tblErrors.setModel(this.linesModel);
         this.tblErrors.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
-        this.btnZoom.addActionListener(new ActionListener() {
+        this.btnZoomGeometry.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                doZoom();
+                doZoomGeometry();
             }
         });
-        this.btnCenter.addActionListener(new ActionListener() {
+        this.btnZoomError.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
-                doCenter();
+                doZoomError();
             }
         });
+        this.btnCenterGeometry.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                doCenterGeometry();
+            }
+        });
+        this.btnCenterError.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                doCenterError();
+            }
+        });
         this.btnRefresh.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
@@ -169,7 +186,7 @@
             @Override
             public void mouseClicked(MouseEvent e) {
                 if( e.getButton()==MouseEvent.BUTTON1 && e.getClickCount()==2 ) {
-                    doCenter();
+                    doCenterError();
                 }
             }
         });
@@ -207,6 +224,18 @@
                 doUpdateFilter();
             }
         });
+        this.btnShowForm.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                services.setShowFormWhenEdit(btnShowForm.isSelected());
+            }
+        });
+        this.btnEraseErrorMarks.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                services.addError(null);
+            }
+        });
         DefaultComboBoxModel<ListElement<TopologyRuleFactory>> modelRules = new DefaultComboBoxModel<>();
         modelRules.addElement(new ListElement<>(i18n.getTranslation("_Any_rule"), (TopologyRuleFactory)null));
         List<TopologyRuleFactory> factories = TopologyLocator.getTopologyManager().getRuleFactories();
@@ -244,18 +273,36 @@
         this.tabData.setEnabledAt(1, false);
 
     }
+    
+    @Override
+    public ImageIcon loadImage(String imageName) {
+        String name = FilenameUtils.getBaseName(imageName);
+        IconTheme theme = ToolsSwingLocator.getIconThemeManager().getDefault();
+        if (theme.exists(name)) {
+            return theme.get(name);
+        }
+        URL url = this.getClass().getResource("/"+imageName);
+        if (url == null) {
+            return null;
+        }
+        return new ImageIcon(url);
+    }
 
     private void translate() {
         ToolsSwingManager tsm = ToolsSwingLocator.getToolsSwingManager();
         tsm.translate(this.btnActions);
-        tsm.translate(this.btnCenter);
+        tsm.translate(this.btnCenterError);
+        tsm.translate(this.btnCenterGeometry);
         tsm.translate(this.btnRefresh);
         tsm.translate(this.btnShowErrors);
         tsm.translate(this.btnShowExceptions);
-        tsm.translate(this.btnZoom);
+        tsm.translate(this.btnZoomError);
+        tsm.translate(this.btnZoomGeometry);
+        tsm.translate(this.btnEraseErrorMarks);
         tsm.translate(this.btnVisibleExtentOnly);
         tsm.translate(this.btnParametersAccept);
         tsm.translate(this.btnParametersCancel);
+        tsm.translate(this.btnShowForm);
         tsm.translate(this.lblShow);
         tsm.translate(this.tabData);
     }
@@ -383,11 +430,18 @@
         if (n < 0) {
             return;
         }
-        TopologyReportLine line = this.linesModel.getLine(n);
-        TopologyRule rule = line.getRule();
+        int[] selectedRows = this.tblErrors.getSelectedRows();
+        TopologyRule rule = this.linesModel.getLine(selectedRows[0]).getRule();
         List<TopologyRuleAction> actions = rule.getActions();
         if (actions == null || actions.isEmpty()) {
             return;
+        }        
+        List<TopologyReportLine>lines = new ArrayList<>();
+        for (int selectedRow : selectedRows) {
+            TopologyReportLine line = this.linesModel.getLine(selectedRow);
+            if( line.getRule()==rule ) {
+                lines.add(line);
+            }
         }
         JPopupMenu menu = new JPopupMenu();
         for (TopologyRuleAction action : actions) {
@@ -397,7 +451,10 @@
             } else {
                 item = new JMenuItem(action.getName()); 
             }
-            item.addActionListener(new TopologyRuleActionListener(rule, line, action));
+            item.addActionListener(new TopologyRuleActionListener(rule, lines, action));
+            if( lines.size()>1 && action.hasParameters() ) {
+                item.setEnabled(false);
+            }
             menu.add(item);
         }
         menu.show(this.btnActions, 0, this.btnActions.getHeight());
@@ -405,7 +462,7 @@
 
     private void doExecuteRuleAction(
             TopologyRule rule,
-            TopologyReportLine line,
+            List<TopologyReportLine> lines,
             TopologyRuleAction action,
             JDynForm form
     ) {
@@ -416,17 +473,19 @@
                 form.getValues(parameters);
             }
         }
-        action.execute(rule, line, parameters);
+        for (TopologyReportLine line : lines) {
+            action.execute(rule, line, parameters);
+        }
         this.tabData.setEnabledAt(0, true);
         this.tabData.setEnabledAt(1, false);
         this.tabData.setSelectedIndex(0);
         this.pnlParameters.removeAll();
-        this.services.refreshView();
+        this.services.addError(null);
     }
 
     private void doShowActionParametersPanel(
             TopologyRule rule,
-            TopologyReportLine line,
+            List<TopologyReportLine> lines,
             TopologyRuleAction action
     ) {
         I18nManager i18n = ToolsLocator.getI18nManager();
@@ -456,14 +515,14 @@
                 }
             }
             this.btnParametersAccept.addActionListener(
-                new TopologyRuleActionParametersListener(rule, line, action, form)
+                new TopologyRuleActionParametersListener(rule, lines, action, form)
             );
         } catch (Exception ex) {
             LOGGER.warn("Can't show action parameters panel.",ex);
         }
     }
 
-    private void doZoom() {
+    private void doZoomGeometry() {
         int n = this.tblErrors.getSelectedRow();
         if (n < 0) {
             return;
@@ -473,7 +532,23 @@
         this.services.zoomTo(geom.getEnvelope());
     }
 
-    private void doCenter() {
+    private void doZoomError() {
+        int n = this.tblErrors.getSelectedRow();
+        if (n < 0) {
+            return;
+        }
+        TopologyReportLine line = this.linesModel.getLine(n);
+        Geometry geom = line.getError();
+        if( geom == null ) {
+            geom = line.getGeometry();
+            services.addError(null);
+        } else {
+            services.addError(geom);
+        }
+        this.services.zoomTo(geom.getEnvelope());
+    }
+
+    private void doCenterGeometry() {
         try {
             int n = this.tblErrors.getSelectedRow();
             if (n < 0) {
@@ -487,6 +562,26 @@
         }
     }
 
+    private void doCenterError() {
+        try {
+            int n = this.tblErrors.getSelectedRow();
+            if (n < 0) {
+                return;
+            }
+            TopologyReportLine line = this.linesModel.getLine(n);
+            Geometry geom = line.getError();
+            if( geom == null ) {
+                geom = line.getGeometry();
+                services.addError(null);
+            } else {
+                services.addError(geom);
+            }
+            this.services.centerTo(geom.centroid());
+        } catch (Exception ex) {
+            LOGGER.warn("Can't center topology error", ex);
+        }
+    }
+
     private void doRowSelected() {
         try {
             int n = this.tblErrors.getSelectedRow();
@@ -497,7 +592,8 @@
             if (line.getFeature1() == null) {
                 return;
             }
-            FeatureSelection selection = line.getDataSet1().getStore().getFeatureSelection();
+            this.services.addError(null);
+            FeatureSelection selection = line.getDataSet1().getFeatureStore().getFeatureSelection();
             selection.deselectAll();
             selection.select(line.getFeature1());
         } catch (Exception ex) {
